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
2f664768
Commit
2f664768
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: rename a function, and adjust some comments
parent
c9e99642
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/move.c
+13
-15
src/move.c
src/proto.h
+1
-1
src/proto.h
src/winio.c
+9
-9
src/winio.c
with
23 additions
and
25 deletions
+23
-25
src/move.c
View file @
2f664768
...
...
@@ -385,7 +385,7 @@ void do_home(void)
openfile
->
placewewant
=
xplustabs
();
if
(
need_
screen_update
(
was_column
,
openfile
->
placewewant
))
if
(
need_
horizontal_scroll
(
was_column
,
openfile
->
placewewant
))
update_line
(
openfile
->
current
,
openfile
->
current_x
);
}
...
...
@@ -397,7 +397,7 @@ void do_end(void)
openfile
->
current_x
=
strlen
(
openfile
->
current
->
data
);
openfile
->
placewewant
=
xplustabs
();
if
(
need_
screen_update
(
was_column
,
openfile
->
placewewant
))
if
(
need_
horizontal_scroll
(
was_column
,
openfile
->
placewewant
))
update_line
(
openfile
->
current
,
openfile
->
current_x
);
}
...
...
@@ -439,12 +439,11 @@ void do_up(bool scroll_only)
#endif
editwinrows
/
2
+
1
);
/* If we're not on the first line of the edit window, and the target
* column is beyond the screen or the mark is on, redraw the prior
* and current lines. */
if
(
need_screen_update
(
was_column
,
0
))
/* Redraw the prior line if it was horizontally scrolled. */
if
(
need_horizontal_scroll
(
was_column
,
0
))
update_line
(
openfile
->
current
->
next
,
0
);
if
(
need_screen_update
(
0
,
xplustabs
()))
/* Redraw the current line if it needs to be horizontally scrolled. */
if
(
need_horizontal_scroll
(
0
,
xplustabs
()))
update_line
(
openfile
->
current
,
openfile
->
current_x
);
}
...
...
@@ -522,12 +521,11 @@ void do_down(bool scroll_only)
}
}
/* If we're not on the last line of the edit window, and the target
* column is beyond the screen or the mark is on, redraw the prior
* and current lines. */
if
(
need_screen_update
(
was_column
,
0
))
/* Redraw the prior line if it was horizontally scrolled. */
if
(
need_horizontal_scroll
(
was_column
,
0
))
update_line
(
openfile
->
current
->
prev
,
0
);
if
(
need_screen_update
(
0
,
xplustabs
()))
/* Redraw the current line if it needs to be horizontally scrolled. */
if
(
need_horizontal_scroll
(
0
,
xplustabs
()))
update_line
(
openfile
->
current
,
openfile
->
current_x
);
}
...
...
@@ -566,7 +564,7 @@ void do_left(void)
openfile
->
placewewant
=
xplustabs
();
if
(
need_
screen_update
(
was_column
,
openfile
->
placewewant
))
if
(
need_
horizontal_scroll
(
was_column
,
openfile
->
placewewant
))
update_line
(
openfile
->
current
,
openfile
->
current_x
);
}
...
...
@@ -583,7 +581,7 @@ void do_right(void)
else
if
(
openfile
->
current
!=
openfile
->
filebot
)
{
openfile
->
current_x
=
0
;
openfile
->
placewewant
=
0
;
if
(
need_
screen_update
(
was_column
,
0
))
if
(
need_
horizontal_scroll
(
was_column
,
0
))
update_line
(
openfile
->
current
,
0
);
do_down_void
();
return
;
...
...
@@ -591,6 +589,6 @@ void do_right(void)
openfile
->
placewewant
=
xplustabs
();
if
(
need_
screen_update
(
was_column
,
openfile
->
placewewant
))
if
(
need_
horizontal_scroll
(
was_column
,
openfile
->
placewewant
))
update_line
(
openfile
->
current
,
openfile
->
current_x
);
}
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
2f664768
...
...
@@ -785,7 +785,7 @@ void reset_cursor(void);
void
edit_draw
(
filestruct
*
fileptr
,
const
char
*
converted
,
int
line
,
size_t
start
);
int
update_line
(
filestruct
*
fileptr
,
size_t
index
);
bool
need_
screen_update
(
const
size_t
old_column
,
const
size_t
new_column
);
bool
need_
horizontal_scroll
(
const
size_t
old_column
,
const
size_t
new_column
);
void
edit_scroll
(
scroll_dir
direction
,
ssize_t
nlines
);
void
edit_redraw
(
filestruct
*
old_current
);
void
edit_refresh
(
void
);
...
...
This diff is collapsed.
Click to expand it.
src/winio.c
View file @
2f664768
...
...
@@ -2602,16 +2602,16 @@ int update_line(filestruct *fileptr, size_t index)
return
extralinesused
;
}
/* Return TRUE if we need an update after moving the cursor, and
* FALSE otherwise. We need an update if the mark is on, or if
* old_column and new_column are on different pages. */
bool
need_screen_update
(
const
size_t
old_column
,
const
size_t
new_column
)
/* Check whether old_column and new_column are on different "pages" (or that
* the mark is on), which means that the relevant line needs to be redrawn. */
bool
need_horizontal_scroll
(
const
size_t
old_column
,
const
size_t
new_column
)
{
return
#ifndef NANO_TINY
openfile
->
mark_set
||
if
(
openfile
->
mark_set
)
return
TRUE
;
else
#endif
get_page_start
(
old_column
)
!=
get_page_start
(
new_column
);
return
(
get_page_start
(
old_column
)
!=
get_page_start
(
new_column
)
)
;
}
/* When edittop changes, try and figure out how many lines
...
...
@@ -2740,7 +2740,7 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
for
(
i
=
nlines
;
i
>
0
&&
foo
!=
NULL
;
i
--
)
{
if
((
i
==
nlines
&&
direction
==
DOWNWARD
)
||
(
i
==
1
&&
direction
==
UPWARD
))
{
if
(
need_
screen_update
(
openfile
->
placewewant
,
0
))
if
(
need_
horizontal_scroll
(
openfile
->
placewewant
,
0
))
update_line
(
foo
,
(
foo
==
openfile
->
current
)
?
openfile
->
current_x
:
0
);
}
else
...
...
@@ -2786,7 +2786,7 @@ void edit_redraw(filestruct *old_current)
/* Update current if we've changed page, or if it differs from
* old_current and needs to be horizontally scrolled. */
if
(
need_
screen_update
(
was_pww
,
openfile
->
placewewant
)
||
if
(
need_
horizontal_scroll
(
was_pww
,
openfile
->
placewewant
)
||
(
old_current
!=
openfile
->
current
&&
get_page_start
(
openfile
->
placewewant
)
>
0
))
update_line
(
openfile
->
current
,
openfile
->
current_x
);
...
...
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