mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-08 20:41:59 +03:00
* view.c (view_move_forward2): Backed out my last changes. The old
code worked better. :)
This commit is contained in:
parent
ac03019408
commit
9eff3cef04
@ -24,16 +24,13 @@
|
||||
* view.c (count_backspaces): Added a bounds check.
|
||||
* view.c (display): Using get_byte_indexed instead of get_byte.
|
||||
* view.c (move_forward2): Renamed to view_move_forward2 because
|
||||
of the equally-named function in src/help.c. Replaced the
|
||||
algorithm for the hexview mode by a much simpler version. Now
|
||||
we have 5 ?: operators less than before.
|
||||
of the equally-named function in src/help.c.
|
||||
* view.c (get_bottom_first): Added bounds checking.
|
||||
* view.c (move_right): Simplified the code.
|
||||
* view.c (goto_addr): Fixed an off-by-one error.
|
||||
* view.c (view_close_datasource): For the growing buffer cases,
|
||||
check if the datasource has already been closed before.
|
||||
* view.c (view_handle_editkey): Simplified the code.
|
||||
* view.c (view_move_forward2): Simplified the code.
|
||||
* view.c (get_byte_growing_buffer): Added bounds checking.
|
||||
|
||||
2005-04-07 Roland Illig <roland.illig@gmx.de>
|
||||
|
28
src/view.c
28
src/view.c
@ -1137,20 +1137,28 @@ static offset_type
|
||||
view_move_forward2 (WView *view, offset_type current, int lines, offset_type upto)
|
||||
{
|
||||
const int frame_shift = view->have_frame;
|
||||
const int bpl = view->bytes_per_line;
|
||||
offset_type q, p, linestart;
|
||||
int i, line;
|
||||
offset_type q, p, last_byte;
|
||||
int line;
|
||||
int col = 0;
|
||||
|
||||
if (view->hex_mode) {
|
||||
linestart = current - current % bpl;
|
||||
/* try to move as many lines down as possible */
|
||||
for (i = lines; i != 0; i--) {
|
||||
if (get_byte_indexed (view, linestart, i * bpl) != -1)
|
||||
break;
|
||||
last_byte = view_get_filesize (view);
|
||||
p = current + lines * view->bytes_per_line;
|
||||
p = (p >= last_byte) ? current : p;
|
||||
if (lines == 1) {
|
||||
q = view->edit_cursor + view->bytes_per_line;
|
||||
line = q / view->bytes_per_line;
|
||||
col = (last_byte - 1) / view->bytes_per_line;
|
||||
view->edit_cursor = (line > col) ? view->edit_cursor : q;
|
||||
view->edit_cursor = (view->edit_cursor < last_byte) ?
|
||||
view->edit_cursor : last_byte - 1;
|
||||
q = current + ((LINES - 2) * view->bytes_per_line);
|
||||
p = (view->edit_cursor < q) ? current : p;
|
||||
} else {
|
||||
view->edit_cursor = (view->edit_cursor < p) ?
|
||||
p : view->edit_cursor;
|
||||
}
|
||||
view->edit_cursor += i * bpl;
|
||||
return current + i * bpl;
|
||||
return p;
|
||||
} else {
|
||||
if (upto) {
|
||||
lines = -1;
|
||||
|
Loading…
Reference in New Issue
Block a user