mirror of https://github.com/MidnightCommander/mc
* view.c (view_handle_key): Fixed invalid-offset-bug when handling
ctrl-e in hex mode.
This commit is contained in:
parent
8335c0fab3
commit
fd4b2d7d35
|
@ -1,4 +1,9 @@
|
|||
2004-09-18 Roland Illig <roland.illig@gmx.de>
|
||||
2004-09-18 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* view.c (view_handle_key): Fixed invalid-offset-bug when handling
|
||||
ctrl-e in hex mode.
|
||||
|
||||
2004-09-18 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* help.c (search_string): Fixed a warning about a const qualifier.
|
||||
A local copy of the string is used for modifying.
|
||||
|
|
16
src/view.c
16
src/view.c
|
@ -162,6 +162,18 @@ struct WView {
|
|||
struct stat s; /* stat for file */
|
||||
};
|
||||
|
||||
static void view_move_cursor_to_eol(WView *view)
|
||||
{
|
||||
offset_type last_line = (view->last_byte - 1) / view->bytes_per_line;
|
||||
offset_type current_line = view->edit_cursor / view->bytes_per_line;
|
||||
|
||||
if (current_line == last_line) {
|
||||
view->edit_cursor = view->last_byte - 1;
|
||||
} else {
|
||||
view->edit_cursor = (1 + current_line) * view->bytes_per_line - 1;
|
||||
}
|
||||
view->dirty++;
|
||||
}
|
||||
|
||||
/* Maxlimit for skipping updates */
|
||||
int max_dirt_limit = 10;
|
||||
|
@ -2369,9 +2381,7 @@ view_handle_key (WView *view, int c)
|
|||
return MSG_HANDLED;
|
||||
|
||||
case XCTRL ('e'): /* End of line */
|
||||
view->edit_cursor -= view->edit_cursor % view->bytes_per_line;
|
||||
view->edit_cursor += view->bytes_per_line - 1;
|
||||
view->dirty++;
|
||||
view_move_cursor_to_eol (view);
|
||||
return MSG_HANDLED;
|
||||
|
||||
case XCTRL ('f'): /* Character forward */
|
||||
|
|
Loading…
Reference in New Issue