Skip to content
GitLab
Menu
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
e5731fe1
Commit
e5731fe1
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: reshuffle three statements, and shorten a comment
parent
2bbb6cfe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/text.c
+4
-7
src/text.c
with
4 additions
and
7 deletions
+4
-7
src/text.c
View file @
e5731fe1
...
@@ -1632,8 +1632,6 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
...
@@ -1632,8 +1632,6 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
/* Find the last blank that does not overshoot the target column. */
/* Find the last blank that does not overshoot the target column. */
while
(
*
line
!=
'\0'
&&
column
<=
goal
)
{
while
(
*
line
!=
'\0'
&&
column
<=
goal
)
{
char_len
=
parse_mbchar
(
line
,
NULL
,
&
column
);
if
(
is_blank_mbchar
(
line
)
||
(
snap_at_nl
&&
*
line
==
'\n'
))
{
if
(
is_blank_mbchar
(
line
)
||
(
snap_at_nl
&&
*
line
==
'\n'
))
{
lastblank
=
index
;
lastblank
=
index
;
...
@@ -1641,6 +1639,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
...
@@ -1641,6 +1639,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
break
;
break
;
}
}
char_len
=
parse_mbchar
(
line
,
NULL
,
&
column
);
line
+=
char_len
;
line
+=
char_len
;
index
+=
char_len
;
index
+=
char_len
;
}
}
...
@@ -1656,17 +1655,15 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
...
@@ -1656,17 +1655,15 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
return
(
index
-
char_len
);
return
(
index
-
char_len
);
#endif
#endif
/* If no blank was found within the goal width, try to find a
/* If no blank was found within the goal width, seek one after it. */
* blank beyond it. */
if
(
lastblank
<
0
)
{
if
(
lastblank
<
0
)
{
while
(
*
line
!=
'\0'
)
{
while
(
*
line
!=
'\0'
)
{
char_len
=
parse_mbchar
(
line
,
NULL
,
NULL
);
if
(
is_blank_mbchar
(
line
))
if
(
is_blank_mbchar
(
line
))
lastblank
=
index
;
lastblank
=
index
;
else
if
(
lastblank
>
0
)
else
if
(
lastblank
>
0
)
return
lastblank
;
return
lastblank
;
char_len
=
parse_mbchar
(
line
,
NULL
,
NULL
);
line
+=
char_len
;
line
+=
char_len
;
index
+=
char_len
;
index
+=
char_len
;
}
}
...
@@ -1675,7 +1672,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
...
@@ -1675,7 +1672,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
}
}
/* Move the pointer back to the last blank, and then step beyond it. */
/* Move the pointer back to the last blank, and then step beyond it. */
line
+
=
lastblank
-
index
;
line
=
l
ine
-
index
+
l
astblank
;
char_len
=
parse_mbchar
(
line
,
NULL
,
NULL
);
char_len
=
parse_mbchar
(
line
,
NULL
,
NULL
);
line
+=
char_len
;
line
+=
char_len
;
...
...
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