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
1ebb1da3
Commit
1ebb1da3
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: elide a parameter that is always 1
And adjust the comments accordingly.
parent
1fb3218a
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/move.c
+2
-2
src/move.c
src/proto.h
+1
-1
src/proto.h
src/winio.c
+15
-30
src/winio.c
with
18 additions
and
33 deletions
+18
-33
src/move.c
View file @
1ebb1da3
...
...
@@ -502,7 +502,7 @@ void do_up(bool scroll_only)
set_proper_index_and_pww
(
&
leftedge
,
target_column
,
FALSE
);
if
(
scroll_only
)
edit_scroll
(
BACKWARD
,
1
);
edit_scroll
(
BACKWARD
);
edit_redraw
(
was_current
,
FLOWING
);
...
...
@@ -526,7 +526,7 @@ void do_down(bool scroll_only)
set_proper_index_and_pww
(
&
leftedge
,
target_column
,
TRUE
);
if
(
scroll_only
)
edit_scroll
(
FORWARD
,
1
);
edit_scroll
(
FORWARD
);
edit_redraw
(
was_current
,
FLOWING
);
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
1ebb1da3
...
...
@@ -661,7 +661,7 @@ bool line_needs_update(const size_t old_column, const size_t new_column);
int
go_back_chunks
(
int
nrows
,
filestruct
**
line
,
size_t
*
leftedge
);
int
go_forward_chunks
(
int
nrows
,
filestruct
**
line
,
size_t
*
leftedge
);
bool
less_than_a_screenful
(
size_t
was_lineno
,
size_t
was_leftedge
);
void
edit_scroll
(
bool
direction
,
int
nrows
);
void
edit_scroll
(
bool
direction
);
#ifndef NANO_TINY
size_t
get_softwrap_breakpoint
(
const
char
*
text
,
size_t
leftedge
,
bool
*
end_of_line
);
...
...
This diff is collapsed.
Click to expand it.
src/winio.c
View file @
1ebb1da3
...
...
@@ -2912,57 +2912,42 @@ bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge)
return
(
openfile
->
current
->
lineno
-
was_lineno
<
editwinrows
);
}
/* Scroll the edit window in the given direction and
the given number of rows,
*
and
draw
new lines on the blank lines left after the scrolling
. */
void
edit_scroll
(
bool
direction
,
int
nrows
)
/* Scroll the edit window
one row
in the given direction
,
and
* draw
the relevant content on the resultant blank row
. */
void
edit_scroll
(
bool
direction
)
{
filestruct
*
line
;
size_t
leftedge
;
int
remainder
=
0
,
nrows
=
1
;
/* Part 1: nrows is the number of rows we're going to scroll the text of
* the edit window. */
/* Move the top line of the edit window the requested number of rows up or
* down, and reduce the number of rows with the amount we couldn't move. */
/* Move the top line of the edit window one row up or down. */
if
(
direction
==
BACKWARD
)
nrows
-
=
go_back_chunks
(
nrows
,
&
openfile
->
edittop
,
&
openfile
->
firstcolumn
);
remainder
=
go_back_chunks
(
1
,
&
openfile
->
edittop
,
&
openfile
->
firstcolumn
);
else
nrows
-
=
go_forward_chunks
(
nrows
,
&
openfile
->
edittop
,
&
openfile
->
firstcolumn
);
remainder
=
go_forward_chunks
(
1
,
&
openfile
->
edittop
,
&
openfile
->
firstcolumn
);
/* Don't bother scrolling zero rows, nor more than the window can hold. */
if
(
nrows
==
0
)
{
if
(
remainder
>
0
)
{
#ifndef NANO_TINY
statusline
(
ALERT
,
"
Under
scroll
ing
-- please report a bug"
);
statusline
(
ALERT
,
"
Could not
scroll -- please report a bug"
);
#endif
return
;
}
if
(
nrows
>=
editwinrows
)
{
#ifndef NANO_TINY
if
(
editwinrows
>
1
)
statusline
(
ALERT
,
"Overscrolling -- please report a bug"
);
#endif
refresh_needed
=
TRUE
;
return
;
}
/*
S
croll the text of the edit window
a number of
row
s
up or down. */
/*
Actually s
croll the text of the edit window
one
row up or down. */
scrollok
(
edit
,
TRUE
);
wscrl
(
edit
,
(
direction
==
BACKWARD
)
?
-
nrows
:
nrows
);
wscrl
(
edit
,
(
direction
==
BACKWARD
)
?
-
1
:
1
);
scrollok
(
edit
,
FALSE
);
/* Part 2: nrows is now the number of rows in the scrolled region of the
* edit window that we need to draw. */
/* If we're not on the first "page" (when not softwrapping), or the mark
* is on, the row next to the scrolled region needs to be redrawn too. */
if
(
line_needs_update
(
openfile
->
placewewant
,
0
)
&&
nrows
<
editwinrows
)
nrows
++
;
/* If we scrolled backward,
start on the first line of the blank regio
n. */
/* If we scrolled backward,
the top row needs to be redraw
n. */
line
=
openfile
->
edittop
;
leftedge
=
openfile
->
firstcolumn
;
/* If we scrolled forward,
move down to the start of the blank regio
n. */
/* If we scrolled forward,
the bottom row needs to be redraw
n. */
if
(
direction
==
FORWARD
)
go_forward_chunks
(
editwinrows
-
nrows
,
&
line
,
&
leftedge
);
...
...
@@ -2977,8 +2962,8 @@ void edit_scroll(bool direction, int nrows)
}
#endif
/* Draw new content on the blank row
s inside the scrolled region
*
(and on the bordering row too
when it was deemed necessary). */
/* Draw new content on the blank row
(and on the bordering row too
* when it was deemed necessary). */
while
(
nrows
>
0
&&
line
!=
NULL
)
{
nrows
-=
update_line
(
line
,
(
line
==
openfile
->
current
)
?
openfile
->
current_x
:
0
);
...
...
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