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