mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
* view.c (move_backward2): Bugfix: Only move the view if the cursor would be out-of-view.
This commit is contained in:
parent
a540dee8b5
commit
fb4fd57695
21
src/view.c
21
src/view.c
@ -1308,26 +1308,29 @@ move_backward2 (WView *view, offset_type current, int lines)
|
||||
} else {
|
||||
view->edit_cursor %= view->bytes_per_line;
|
||||
}
|
||||
if (current >= lines * view->bytes_per_line) {
|
||||
current -= lines * view->bytes_per_line;
|
||||
} else {
|
||||
current %= view->bytes_per_line;
|
||||
if (current > view->edit_cursor) {
|
||||
/* cursor is out-of-view -- adjust the view */
|
||||
if (current >= lines * view->bytes_per_line) {
|
||||
current -= lines * view->bytes_per_line;
|
||||
} else {
|
||||
current %= view->bytes_per_line;
|
||||
}
|
||||
}
|
||||
return current;
|
||||
return current;
|
||||
} else {
|
||||
if (current == view->first)
|
||||
return current;
|
||||
if (current == view->first)
|
||||
return current;
|
||||
|
||||
if (view->wrap_mode)
|
||||
return move_backward2_textmode_wrap (view, current, lines);
|
||||
|
||||
/* There is one virtual '\n' at the end,
|
||||
* so that the last line is shown */
|
||||
if (current == view->last_byte && get_byte (view, current - 1) != '\n')
|
||||
if (current == view->last_byte && get_byte (view, current - 1) != '\n')
|
||||
lines--;
|
||||
while (current > view->first && get_byte(view, current - 1) != '\n')
|
||||
current--;
|
||||
while (lines > 0) {
|
||||
while (lines > 0) {
|
||||
if (current > view->first)
|
||||
current--;
|
||||
lines--;
|
||||
|
Loading…
Reference in New Issue
Block a user