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
9066a96d
Commit
9066a96d
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: rename three variables, for more contrast and variety
parent
6abb551f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/text.c
+12
-14
src/text.c
with
12 additions
and
14 deletions
+12
-14
src/text.c
View file @
9066a96d
...
...
@@ -1545,10 +1545,10 @@ bool do_wrap(filestruct *line)
/* The length of the line we wrap. */
ssize_t
wrap_loc
;
/* The index of line->data where we wrap. */
const
char
*
after_break
;
const
char
*
remainder
;
/* The text after the wrap point. */
size_t
after_break
_len
;
/* The length of
after_break
. */
size_t
rest
_len
gth
;
/* The length of
the remainder
. */
const
char
*
next_line
=
NULL
;
/* The next line, minus indentation. */
size_t
next_line_len
=
0
;
...
...
@@ -1603,31 +1603,29 @@ bool do_wrap(filestruct *line)
* and the text of the next line, if they can fit without wrapping,
* the next line exists, and the prepend_wrap flag is set. */
/*
after_break
is the text that will be wrapped to the next line. */
after_break
=
line
->
data
+
wrap_loc
;
after_break
_len
=
line_len
-
wrap_loc
;
/*
The remainder
is the text that will be wrapped to the next line. */
remainder
=
line
->
data
+
wrap_loc
;
rest
_len
gth
=
line_len
-
wrap_loc
;
/* We prepend the wrapped text to the next line, if the prepend_wrap
* flag is set, there is a next line, and prepending would not make
* the line too long. */
if
(
prepend_wrap
&&
line
!=
openfile
->
filebot
)
{
const
char
*
end
=
after_break
+
move_mbleft
(
after_break
,
after_break_len
);
const
char
*
tail
=
remainder
+
move_mbleft
(
remainder
,
rest_length
);
/* Go to the end of the line. */
openfile
->
current_x
=
line_len
;
/* If after_break doesn't end in a blank, make sure it ends in a
* space. */
if
(
!
is_blank_mbchar
(
end
)
&&
!
ISSET
(
JUSTIFY_TRIM
))
{
/* If the remainder doesn't end in a blank, add a space. */
if
(
!
is_blank_mbchar
(
tail
)
&&
!
ISSET
(
JUSTIFY_TRIM
))
{
#ifndef NANO_TINY
add_undo
(
ADD
);
#endif
line
->
data
=
charealloc
(
line
->
data
,
line_len
+
2
);
line
->
data
[
line_len
]
=
' '
;
line
->
data
[
line_len
+
1
]
=
'\0'
;
after_break
=
line
->
data
+
wrap_loc
;
after_break
_len
++
;
remainder
=
line
->
data
+
wrap_loc
;
rest
_len
gth
++
;
openfile
->
totsize
++
;
openfile
->
current_x
++
;
#ifndef NANO_TINY
...
...
@@ -1638,7 +1636,7 @@ bool do_wrap(filestruct *line)
next_line
=
line
->
next
->
data
;
next_line_len
=
strlen
(
next_line
);
if
(
after_break
_len
+
next_line_len
<=
fill
)
{
if
(
rest
_len
gth
+
next_line_len
<=
fill
)
{
/* Delete the LF to join the two lines. */
do_delete
();
/* Delete any leading blanks from the joined-on line. */
...
...
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