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
86e71fa0
Commit
86e71fa0
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: specify more directly in what manner to move the viewport
parent
5237a42d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/move.c
+16
-24
src/move.c
src/nano.c
+1
-1
src/nano.c
src/proto.h
+1
-1
src/proto.h
src/search.c
+2
-3
src/search.c
src/winio.c
+2
-2
src/winio.c
with
22 additions
and
31 deletions
+22
-31
src/move.c
View file @
86e71fa0
...
...
@@ -146,7 +146,7 @@ void do_para_begin(bool update_screen)
openfile
->
current_x
=
0
;
if
(
update_screen
)
edit_redraw
(
was_current
);
edit_redraw
(
was_current
,
CENTERING
);
}
/* Move up to first start of a paragraph before the current line. */
...
...
@@ -182,7 +182,7 @@ void do_para_end(bool update_screen)
openfile
->
current_x
=
strlen
(
openfile
->
current
->
data
);
if
(
update_screen
)
edit_redraw
(
was_current
);
edit_redraw
(
was_current
,
CENTERING
);
}
/* Move down to just after the first end of a paragraph. */
...
...
@@ -211,7 +211,7 @@ void do_prev_block(void)
openfile
->
current
=
openfile
->
current
->
next
;
openfile
->
current_x
=
0
;
edit_redraw
(
was_current
);
edit_redraw
(
was_current
,
CENTERING
);
}
/* Move to the next block of text in the file. */
...
...
@@ -229,7 +229,7 @@ void do_next_block(void)
}
openfile
->
current_x
=
0
;
edit_redraw
(
was_current
);
edit_redraw
(
was_current
,
CENTERING
);
}
/* Move to the previous word in the file. If allow_punct is TRUE, treat
...
...
@@ -272,10 +272,8 @@ void do_prev_word(bool allow_punct, bool update_screen)
openfile
->
current_x
=
move_mbright
(
openfile
->
current
->
data
,
openfile
->
current_x
);
if
(
update_screen
)
{
focusing
=
FALSE
;
edit_redraw
(
was_current
);
}
if
(
update_screen
)
edit_redraw
(
was_current
,
FLOWING
);
}
/* Move to the previous word in the file, treating punctuation as part of a
...
...
@@ -321,10 +319,8 @@ bool do_next_word(bool allow_punct, bool update_screen)
break
;
}
if
(
update_screen
)
{
focusing
=
FALSE
;
edit_redraw
(
was_current
);
}
if
(
update_screen
)
edit_redraw
(
was_current
,
FLOWING
);
/* Return whether we started on a word. */
return
started_on_word
;
...
...
@@ -390,10 +386,9 @@ void do_home(void)
/* If we changed chunk, we might be offscreen. Otherwise,
* update current if the mark is on or we changed "page". */
if
(
ISSET
(
SOFTWRAP
)
&&
moved_off_chunk
)
{
focusing
=
FALSE
;
edit_redraw
(
was_current
);
}
else
if
(
line_needs_update
(
was_column
,
openfile
->
placewewant
))
if
(
ISSET
(
SOFTWRAP
)
&&
moved_off_chunk
)
edit_redraw
(
was_current
,
FLOWING
);
else
if
(
line_needs_update
(
was_column
,
openfile
->
placewewant
))
update_line
(
openfile
->
current
,
openfile
->
current_x
);
}
...
...
@@ -442,10 +437,9 @@ void do_end(void)
/* If we changed chunk, we might be offscreen. Otherwise,
* update current if the mark is on or we changed "page". */
if
(
ISSET
(
SOFTWRAP
)
&&
moved_off_chunk
)
{
focusing
=
FALSE
;
edit_redraw
(
was_current
);
}
else
if
(
line_needs_update
(
was_column
,
openfile
->
placewewant
))
if
(
ISSET
(
SOFTWRAP
)
&&
moved_off_chunk
)
edit_redraw
(
was_current
,
FLOWING
);
else
if
(
line_needs_update
(
was_column
,
openfile
->
placewewant
))
update_line
(
openfile
->
current
,
openfile
->
current_x
);
}
...
...
@@ -572,8 +566,7 @@ void do_left(void)
openfile
->
current
=
openfile
->
current
->
prev
;
openfile
->
current_x
=
strlen
(
openfile
->
current
->
data
);
focusing
=
FALSE
;
edit_redraw
(
openfile
->
current
->
next
);
edit_redraw
(
openfile
->
current
->
next
,
FLOWING
);
return
;
}
...
...
@@ -612,8 +605,7 @@ void do_right(void)
openfile
->
current
=
openfile
->
current
->
next
;
openfile
->
current_x
=
0
;
focusing
=
FALSE
;
edit_redraw
(
openfile
->
current
->
prev
);
edit_redraw
(
openfile
->
current
->
next
,
FLOWING
);
return
;
}
...
...
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
86e71fa0
...
...
@@ -1788,7 +1788,7 @@ int do_mouse(void)
/* The cursor moved; clean the cutbuffer on the next cut. */
cutbuffer_reset
();
edit_redraw
(
current_save
);
edit_redraw
(
current_save
,
CENTERING
);
}
/* No more handling is needed. */
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
86e71fa0
...
...
@@ -674,7 +674,7 @@ size_t number_of_chunks_in(filestruct *line);
void
ensure_firstcolumn_is_aligned
(
void
);
#endif
size_t
actual_last_column
(
size_t
leftedge
,
size_t
column
);
void
edit_redraw
(
filestruct
*
old_current
);
void
edit_redraw
(
filestruct
*
old_current
,
update_type
manner
);
void
edit_refresh
(
void
);
void
adjust_viewport
(
update_type
location
);
void
total_redraw
(
void
);
...
...
This diff is collapsed.
Click to expand it.
src/search.c
View file @
86e71fa0
...
...
@@ -459,7 +459,7 @@ void go_looking(void)
statusline
(
HUSH
,
"Took: %.2f"
,
(
double
)(
clock
()
-
start
)
/
CLOCKS_PER_SEC
);
#endif
edit_redraw
(
was_current
);
edit_redraw
(
was_current
,
CENTERING
);
search_replace_abort
();
}
...
...
@@ -1073,8 +1073,7 @@ void do_find_bracket(void)
/* If count is zero, we've found a matching bracket. Update
* the screen and get out. */
if
(
count
==
0
)
{
focusing
=
FALSE
;
edit_redraw
(
current_save
);
edit_redraw
(
current_save
,
FLOWING
);
break
;
}
}
else
{
...
...
This diff is collapsed.
Click to expand it.
src/winio.c
View file @
86e71fa0
...
...
@@ -3189,7 +3189,7 @@ bool current_is_offscreen(void)
/* Update any lines between old_current and current that need to be
* updated. Use this if we've moved without changing any text. */
void
edit_redraw
(
filestruct
*
old_current
)
void
edit_redraw
(
filestruct
*
old_current
,
update_type
manner
)
{
size_t
was_pww
=
openfile
->
placewewant
;
...
...
@@ -3197,7 +3197,7 @@ void edit_redraw(filestruct *old_current)
/* If the current line is offscreen, scroll until it's onscreen. */
if
(
current_is_offscreen
())
{
adjust_viewport
(
(
focusing
||
!
ISSET
(
SMOOTH_SCROLL
)
)
?
CENTERING
:
FLOW
ING
);
adjust_viewport
(
ISSET
(
SMOOTH_SCROLL
)
?
manner
:
CENTER
ING
);
refresh_needed
=
TRUE
;
return
;
}
...
...
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