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
0208ae71
Commit
0208ae71
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: rename a variable -- lines refers to buffer, rows to screen
parent
26fb907a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/global.c
+2
-2
src/global.c
src/move.c
+2
-2
src/move.c
src/proto.h
+1
-1
src/proto.h
src/winio.c
+15
-15
src/winio.c
with
20 additions
and
20 deletions
+20
-20
src/global.c
View file @
0208ae71
...
...
@@ -94,8 +94,8 @@ WINDOW *bottomwin;
* messages, the statusbar prompt, and a list of shortcuts. */
int
editwinrows
=
0
;
/* How many rows does the edit window take up? */
int
max
row
s
=
0
;
/* How many
usab
le lines
there are
(due to soft wrapping). */
int
max
line
s
=
0
;
/* How many
fi
le lines
can be shown
(due to soft wrapping). */
filestruct
*
cutbuffer
=
NULL
;
/* The buffer where we store cut text. */
...
...
This diff is collapsed.
Click to expand it.
src/move.c
View file @
0208ae71
...
...
@@ -100,7 +100,7 @@ void do_page_down(void)
/* If the cursor is less than a page away from the bottom of the file,
* put it at the end of the last line. */
if
(
openfile
->
current
->
lineno
+
max
row
s
-
2
>=
openfile
->
filebot
->
lineno
)
{
if
(
openfile
->
current
->
lineno
+
max
line
s
-
2
>=
openfile
->
filebot
->
lineno
)
{
do_last_line
();
return
;
}
...
...
@@ -112,7 +112,7 @@ void do_page_down(void)
openfile
->
placewewant
=
openfile
->
current_y
=
0
;
}
mustmove
=
(
max
row
s
<
3
)
?
1
:
max
row
s
-
2
;
mustmove
=
(
max
line
s
<
3
)
?
1
:
max
line
s
-
2
;
for
(
i
=
mustmove
;
i
>
0
&&
openfile
->
current
!=
openfile
->
filebot
;
i
--
)
{
openfile
->
current
=
openfile
->
current
->
next
;
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
0208ae71
...
...
@@ -76,7 +76,7 @@ extern WINDOW *topwin;
extern
WINDOW
*
edit
;
extern
WINDOW
*
bottomwin
;
extern
int
editwinrows
;
extern
int
max
row
s
;
extern
int
max
line
s
;
extern
filestruct
*
cutbuffer
;
extern
filestruct
*
cutbottom
;
...
...
This diff is collapsed.
Click to expand it.
src/winio.c
View file @
0208ae71
...
...
@@ -2755,30 +2755,30 @@ bool need_horizontal_scroll(const size_t old_column, const size_t new_column)
/* When edittop changes, try and figure out how many lines we really
* have to work with, accounting for softwrap mode. */
void
compute_max
row
s
(
void
)
void
compute_max
line
s
(
void
)
{
#ifndef NANO_TINY
if
(
ISSET
(
SOFTWRAP
))
{
int
screenrow
;
filestruct
*
line
=
openfile
->
edittop
;
max
row
s
=
0
;
max
line
s
=
0
;
for
(
screenrow
=
0
;
screenrow
<
editwinrows
&&
line
!=
NULL
;
screenrow
++
)
{
screenrow
+=
strlenpt
(
line
->
data
)
/
editwincols
;
line
=
line
->
next
;
max
row
s
++
;
max
line
s
++
;
}
if
(
screenrow
<
editwinrows
)
max
row
s
+=
editwinrows
-
screenrow
;
max
line
s
+=
editwinrows
-
screenrow
;
#ifdef DEBUG
fprintf
(
stderr
,
"recomputed: max
row
s = %d
\n
"
,
max
row
s
);
fprintf
(
stderr
,
"recomputed: max
line
s = %d
\n
"
,
max
line
s
);
#endif
}
else
#endif
/* !NANO_TINY */
max
row
s
=
editwinrows
;
max
line
s
=
editwinrows
;
}
/* Scroll the edit window in the given direction and the given number
...
...
@@ -2877,7 +2877,7 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
foo
=
foo
->
next
;
}
compute_max
row
s
();
compute_max
line
s
();
}
/* Update any lines between old_current and current that need to be
...
...
@@ -2889,9 +2889,9 @@ void edit_redraw(filestruct *old_current)
openfile
->
placewewant
=
xplustabs
();
/* If the current line is offscreen, scroll until it's onscreen. */
if
(
openfile
->
current
->
lineno
>=
openfile
->
edittop
->
lineno
+
max
row
s
||
if
(
openfile
->
current
->
lineno
>=
openfile
->
edittop
->
lineno
+
max
line
s
||
#ifndef NANO_TINY
(
openfile
->
current
->
lineno
==
openfile
->
edittop
->
lineno
+
max
row
s
-
1
&&
(
openfile
->
current
->
lineno
==
openfile
->
edittop
->
lineno
+
max
line
s
-
1
&&
ISSET
(
SOFTWRAP
)
&&
strlenpt
(
openfile
->
current
->
data
)
>=
editwincols
)
||
#endif
openfile
->
current
->
lineno
<
openfile
->
edittop
->
lineno
)
{
...
...
@@ -2933,15 +2933,15 @@ void edit_refresh(void)
filestruct
*
line
;
int
row
=
0
;
/* Figure out what max
row
s should really be. */
compute_max
row
s
();
/* Figure out what max
line
s should really be. */
compute_max
line
s
();
/* If the current line is out of view, get it back on screen. */
if
(
openfile
->
current
->
lineno
<
openfile
->
edittop
->
lineno
||
openfile
->
current
->
lineno
>=
openfile
->
edittop
->
lineno
+
max
row
s
)
{
openfile
->
current
->
lineno
>=
openfile
->
edittop
->
lineno
+
max
line
s
)
{
#ifdef DEBUG
fprintf
(
stderr
,
"edit-refresh: line = %ld, edittop = %ld and max
row
s = %d
\n
"
,
(
long
)
openfile
->
current
->
lineno
,
(
long
)
openfile
->
edittop
->
lineno
,
max
row
s
);
fprintf
(
stderr
,
"edit-refresh: line = %ld, edittop = %ld and max
line
s = %d
\n
"
,
(
long
)
openfile
->
current
->
lineno
,
(
long
)
openfile
->
edittop
->
lineno
,
max
line
s
);
#endif
adjust_viewport
((
focusing
||
!
ISSET
(
SMOOTH_SCROLL
))
?
CENTERING
:
STATIONARY
);
}
...
...
@@ -3021,7 +3021,7 @@ void adjust_viewport(update_type manner)
#ifdef DEBUG
fprintf
(
stderr
,
"adjust_viewport(): setting edittop to lineno %ld
\n
"
,
(
long
)
openfile
->
edittop
->
lineno
);
#endif
compute_max
row
s
();
compute_max
line
s
();
}
/* Unconditionally redraw the entire screen. */
...
...
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