Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
8f21d256
Commit
8f21d256
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: rename two variables, for distinguishing characters from columns
parent
08cfdbcb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/winio.c
+21
-21
src/winio.c
with
21 additions
and
21 deletions
+21
-21
src/winio.c
View file @
8f21d256
...
...
@@ -2089,7 +2089,7 @@ void statusline(message_type importance, const char *msg, ...)
{
va_list
ap
;
char
*
compound
,
*
message
;
size_t
start_
x
;
size_t
start_
col
;
bool
bracketed
;
#ifndef NANO_TINY
bool
old_whitespace
=
ISSET
(
WHITESPACE_DISPLAY
);
...
...
@@ -2133,10 +2133,10 @@ void statusline(message_type importance, const char *msg, ...)
message
=
display_string
(
compound
,
0
,
COLS
,
FALSE
);
free
(
compound
);
start_
x
=
(
COLS
-
strlenpt
(
message
))
/
2
;
bracketed
=
(
start_
x
>
1
);
start_
col
=
(
COLS
-
strlenpt
(
message
))
/
2
;
bracketed
=
(
start_
col
>
1
);
wmove
(
bottomwin
,
0
,
(
bracketed
?
start_
x
-
2
:
start_
x
));
wmove
(
bottomwin
,
0
,
(
bracketed
?
start_
col
-
2
:
start_
col
));
wattron
(
bottomwin
,
interface_color_pair
[
STATUS_BAR
]);
if
(
bracketed
)
waddstr
(
bottomwin
,
"[ "
);
...
...
@@ -2413,7 +2413,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
}
else
{
/* Second case: varnish is a multiline expression. */
const
filestruct
*
start_line
=
fileptr
->
prev
;
/* The first line before fileptr that matches 'start'. */
size_t
start_
col
;
size_t
start_
x
;
/* Where the match starts in that line. */
const
filestruct
*
end_line
;
/* The line that matches 'end'. */
...
...
@@ -2479,18 +2479,18 @@ void edit_draw(filestruct *fileptr, const char *converted, int
/* Now start_line is the first line before fileptr containing
* a start match. Is there a start on that line not followed
* by an end on that line? */
start_
col
=
0
;
start_
x
=
0
;
while
(
TRUE
)
{
start_
col
+=
startmatch
.
rm_so
;
start_
x
+=
startmatch
.
rm_so
;
startmatch
.
rm_eo
-=
startmatch
.
rm_so
;
if
(
regexec
(
varnish
->
end
,
start_line
->
data
+
start_
col
+
startmatch
.
rm_eo
,
0
,
NULL
,
(
start_
col
+
startmatch
.
rm_eo
==
0
)
?
start_
x
+
startmatch
.
rm_eo
,
0
,
NULL
,
(
start_
x
+
startmatch
.
rm_eo
==
0
)
?
0
:
REG_NOTBOL
)
==
REG_NOMATCH
)
/* No end found after this start. */
break
;
start_
col
++
;
if
(
regexec
(
varnish
->
start
,
start_line
->
data
+
start_
col
,
start_
x
++
;
if
(
regexec
(
varnish
->
start
,
start_line
->
data
+
start_
x
,
1
,
&
startmatch
,
REG_NOTBOL
)
==
REG_NOMATCH
)
/* No later start on this line. */
goto
step_two
;
...
...
@@ -2535,15 +2535,15 @@ void edit_draw(filestruct *fileptr, const char *converted, int
step_two:
/* Second step: look for starts on this line, but begin
* looking only after an end match, if there is one. */
start_
col
=
(
paintlen
==
0
)
?
0
:
endmatch
.
rm_eo
;
start_
x
=
(
paintlen
==
0
)
?
0
:
endmatch
.
rm_eo
;
while
(
regexec
(
varnish
->
start
,
fileptr
->
data
+
start_
col
,
1
,
&
startmatch
,
(
start_
col
==
0
)
?
while
(
regexec
(
varnish
->
start
,
fileptr
->
data
+
start_
x
,
1
,
&
startmatch
,
(
start_
x
==
0
)
?
0
:
REG_NOTBOL
)
==
0
)
{
/* Translate the match to be relative to the
* beginning of the line. */
startmatch
.
rm_so
+=
start_
col
;
startmatch
.
rm_eo
+=
start_
col
;
startmatch
.
rm_so
+=
start_
x
;
startmatch
.
rm_eo
+=
start_
x
;
x_start
=
(
startmatch
.
rm_so
<=
from_x
)
?
0
:
strnlenpt
(
fileptr
->
data
,
...
...
@@ -2576,10 +2576,10 @@ void edit_draw(filestruct *fileptr, const char *converted, int
fprintf
(
stderr
,
" Marking for id %i line %i as CSTARTENDHERE
\n
"
,
varnish
->
id
,
line
);
#endif
}
start_
col
=
endmatch
.
rm_eo
;
start_
x
=
endmatch
.
rm_eo
;
/* Skip over a zero-length match. */
if
(
endmatch
.
rm_so
==
endmatch
.
rm_eo
)
start_
col
+=
1
;
start_
x
+=
1
;
}
else
{
/* There is no end on this line. But we haven't yet
* looked for one on later lines. */
...
...
@@ -3293,7 +3293,7 @@ void do_credits(void)
if
(
crpos
<
CREDIT_LEN
)
{
const
char
*
what
;
size_t
start_
x
;
size_t
start_
col
;
if
(
credits
[
crpos
]
==
NULL
)
{
assert
(
0
<=
xlpos
&&
xlpos
<
XLCREDIT_LEN
);
...
...
@@ -3303,9 +3303,9 @@ void do_credits(void)
}
else
what
=
credits
[
crpos
];
start_
x
=
COLS
/
2
-
strlenpt
(
what
)
/
2
-
1
;
start_
col
=
COLS
/
2
-
strlenpt
(
what
)
/
2
-
1
;
mvwaddstr
(
edit
,
editwinrows
-
1
-
(
editwinrows
%
2
),
start_
x
,
what
);
start_
col
,
what
);
}
wrefresh
(
edit
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help