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
c277cd6e
Commit
c277cd6e
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: reshuffle some statements, to avoid double assignments
parent
384332d0
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/move.c
+14
-18
src/move.c
with
14 additions
and
18 deletions
+14
-18
src/move.c
View file @
c277cd6e
...
...
@@ -52,26 +52,24 @@ void do_last_line(void)
/* Move up one page. */
void
do_page_up
(
void
)
{
int
mustmove
;
size_t
leftedge
=
0
;
size_t
target_column
=
openfile
->
placewewant
;
int
mustmove
=
(
editwinrows
<
3
)
?
1
:
editwinrows
-
2
;
size_t
leftedge
=
0
,
target_column
;
/* If we're not in smooth scrolling mode, put the cursor at the
* beginning of the top line of the edit window, as Pico does. */
if
(
!
ISSET
(
SMOOTH_SCROLL
))
{
openfile
->
current
=
openfile
->
edittop
;
openfile
->
placewewant
=
target_column
=
openfile
->
firstcolumn
;
openfile
->
placewewant
=
openfile
->
firstcolumn
;
openfile
->
current_y
=
0
;
}
mustmove
=
(
editwinrows
<
3
)
?
1
:
editwinrows
-
2
;
#ifndef NANO_TINY
if
(
ISSET
(
SOFTWRAP
))
{
leftedge
=
(
openfile
->
placewewant
/
editwincols
)
*
editwincols
;
target_column
=
openfile
->
placewewant
%
editwincols
;
}
}
else
#endif
target_column
=
openfile
->
placewewant
;
/* Move up the required number of lines or chunks. If we can't, we're
* at the top of the file, so put the cursor there and get out. */
...
...
@@ -80,9 +78,9 @@ void do_page_up(void)
return
;
}
openfile
->
current_x
=
actual_x
(
openfile
->
current
->
data
,
leftedge
+
target_column
);
openfile
->
placewewant
=
leftedge
+
target_column
;
openfile
->
current_x
=
actual_x
(
openfile
->
current
->
data
,
openfile
->
placewewant
);
/* Scroll the edit window up a page. */
adjust_viewport
(
STATIONARY
);
...
...
@@ -92,26 +90,24 @@ void do_page_up(void)
/* Move down one page. */
void
do_page_down
(
void
)
{
int
mustmove
;
size_t
leftedge
=
0
;
size_t
target_column
=
openfile
->
placewewant
;
int
mustmove
=
(
editwinrows
<
3
)
?
1
:
editwinrows
-
2
;
size_t
leftedge
=
0
,
target_column
;
/* If we're not in smooth scrolling mode, put the cursor at the
* beginning of the top line of the edit window, as Pico does. */
if
(
!
ISSET
(
SMOOTH_SCROLL
))
{
openfile
->
current
=
openfile
->
edittop
;
openfile
->
placewewant
=
target_column
=
openfile
->
firstcolumn
;
openfile
->
placewewant
=
openfile
->
firstcolumn
;
openfile
->
current_y
=
0
;
}
mustmove
=
(
editwinrows
<
3
)
?
1
:
editwinrows
-
2
;
#ifndef NANO_TINY
if
(
ISSET
(
SOFTWRAP
))
{
leftedge
=
(
openfile
->
placewewant
/
editwincols
)
*
editwincols
;
target_column
=
openfile
->
placewewant
%
editwincols
;
}
}
else
#endif
target_column
=
openfile
->
placewewant
;
/* Move down the required number of lines or chunks. If we can't, we're
* at the bottom of the file, so put the cursor there and get out. */
...
...
@@ -120,9 +116,9 @@ void do_page_down(void)
return
;
}
openfile
->
current_x
=
actual_x
(
openfile
->
current
->
data
,
leftedge
+
target_column
);
openfile
->
placewewant
=
leftedge
+
target_column
;
openfile
->
current_x
=
actual_x
(
openfile
->
current
->
data
,
openfile
->
placewewant
);
/* Scroll the edit window down a page. */
adjust_viewport
(
STATIONARY
);
...
...
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