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
f2f7498f
Commit
f2f7498f
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: rename two variables, for contrast, and frob some comments
parent
762f9972
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/winio.c
+17
-18
src/winio.c
with
17 additions
and
18 deletions
+17
-18
src/winio.c
View file @
f2f7498f
...
...
@@ -3006,16 +3006,16 @@ size_t get_softwrap_breakpoint(const char *text, size_t leftedge,
{
size_t
column
=
0
;
/* Current column position in text. */
size_t
prev_col
umn
=
0
;
size_t
prev
ious
_col
=
0
;
/* Previous column position in text. */
size_t
goal_column
;
/*
Column of t
he la
st character where we can break the text
. */
size_t
lastblank_col
umn
=
0
;
/*
Current
column position of the last
blank in text
. */
/*
T
he
p
la
ce at or before which text must be broken
. */
size_t
last
_
blank_col
=
0
;
/*
The
column position of the last
seen whitespace character
. */
const
char
*
farthest_blank
=
NULL
;
/* A pointer to the last seen whitespace character in text. */
int
char_len
=
0
;
/* Length of current character, in bytes. */
/* Length of
the
current character, in bytes. */
while
(
*
text
!=
'\0'
&&
column
<
leftedge
)
{
char_len
=
parse_mbchar
(
text
,
NULL
,
&
column
);
...
...
@@ -3029,39 +3029,38 @@ size_t get_softwrap_breakpoint(const char *text, size_t leftedge,
/* When breaking at blanks, do it *before* the target column. */
if
(
ISSET
(
AT_BLANKS
)
&&
is_blank_mbchar
(
text
)
&&
column
<
goal_column
)
{
farthest_blank
=
text
;
lastblank_col
umn
=
column
;
last
_
blank_col
=
column
;
}
prev_col
umn
=
column
;
prev
ious
_col
=
column
;
char_len
=
parse_mbchar
(
text
,
NULL
,
&
column
);
text
+=
char_len
;
}
/* If we didn't overshoot the target, we've found a breaking point. */
/* If we didn't overshoot the limit, we've found a breaking point;
* and we've reached EOL if we didn't even *reach* the limit. */
if
(
column
<=
goal_column
)
{
/* We've reached EOL if we didn't even reach the target. */
*
end_of_line
=
(
column
<
goal_column
);
return
column
;
}
/* If we're softwrapping at blanks and we found at least one blank,
move
*
the pointer back to the last blank, step beyond it, and we're don
e. */
/* If we're softwrapping at blanks and we found at least one blank,
break
*
after that blank -- if it doesn't overshoot the screen's edg
e. */
if
(
farthest_blank
!=
NULL
)
{
char_len
=
parse_mbchar
(
farthest_blank
,
NULL
,
&
lastblank_col
umn
);
char_len
=
parse_mbchar
(
farthest_blank
,
NULL
,
&
last
_
blank_col
);
text
=
farthest_blank
+
char_len
;
/* If we haven't overshot the screen's edge, break after the blank. */
if
(
lastblank_column
<=
goal_column
)
return
lastblank_column
;
if
(
last_blank_col
<=
goal_column
)
return
last_blank_col
;
}
/* If a tab is split over two chunks, break at the screen's edge. */
if
(
*
(
text
-
char_len
)
==
'\t'
)
prev_col
umn
=
goal_column
;
prev
ious
_col
=
goal_column
;
/* Otherwise, return the column of the last character that doesn't
* overshoot the
targe
t, since we can't break the text anywhere else. */
return
(
editwincols
>
1
)
?
prev_col
umn
:
column
-
1
;
* overshoot the
limi
t, since we can't break the text anywhere else. */
return
(
editwincols
>
1
)
?
prev
ious
_col
:
column
-
1
;
}
/* Get the row of the softwrapped chunk of the given line that column is on,
...
...
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