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
9f884810
Commit
9f884810
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: use a subtraction instead of a counter
And return a better value, so that less calculation is needed.
parent
5d5666fb
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
+5
-8
src/winio.c
with
5 additions
and
8 deletions
+5
-8
src/winio.c
View file @
9f884810
...
...
@@ -2664,8 +2664,6 @@ int update_line(filestruct *fileptr, size_t index)
{
int
row
=
0
;
/* The row in the edit window we will be updating. */
int
extra_rows
=
0
;
/* The number of extra rows a softwrapped line occupies. */
char
*
converted
;
/* The data of the line with tabs and control characters expanded. */
size_t
from_col
=
0
;
...
...
@@ -2691,6 +2689,7 @@ int update_line(filestruct *fileptr, size_t index)
#ifndef NANO_TINY
if
(
ISSET
(
SOFTWRAP
))
{
size_t
full_length
=
strlenpt
(
fileptr
->
data
);
int
starting_row
=
row
;
for
(
from_col
=
0
;
from_col
<=
full_length
&&
row
<
editwinrows
;
from_col
+=
editwincols
)
{
...
...
@@ -2704,11 +2703,9 @@ int update_line(filestruct *fileptr, size_t index)
/* Draw the line. */
edit_draw
(
fileptr
,
converted
,
row
++
,
from_col
);
free
(
converted
);
extra_rows
++
;
}
return
--
extra
_row
s
;
return
(
row
-
starting
_row
)
;
}
#endif
...
...
@@ -2731,7 +2728,7 @@ int update_line(filestruct *fileptr, size_t index)
if
(
strlenpt
(
fileptr
->
data
)
>
from_col
+
editwincols
)
mvwaddch
(
edit
,
row
,
COLS
-
1
,
'$'
);
return
0
;
return
1
;
}
/* Check whether old_column and new_column are on different "pages" (or that
...
...
@@ -2945,9 +2942,9 @@ void edit_refresh(void)
while
(
row
<
editwinrows
&&
line
!=
NULL
)
{
if
(
line
==
openfile
->
current
)
row
+=
update_line
(
line
,
openfile
->
current_x
)
+
1
;
row
+=
update_line
(
line
,
openfile
->
current_x
);
else
row
+=
update_line
(
line
,
0
)
+
1
;
row
+=
update_line
(
line
,
0
);
line
=
line
->
next
;
}
...
...
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