"Go to:" command was not updating row position, making next "down" movements
for one screenful print empty lines instead of showing the contents.
If the file is whole pages long, "down" movement at EOF was advancing position
+16 bytes, mapping the next portion (entirely past the end of the file),
then finding out that the new position is beyond the EOF, rolling it back
-16 bytes... ending up with this postion pointing *before* the mapped portion.
Any next access (e.g. "move right" key) SEGVs.
function old new delta
hexedit_main 1170 1184 +14
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
i++;
}
- printf(ESC"[%u;%uH", 1 + cursor / 16, 1 + pos + (cursor & 0xf) * 3);
+ G.row = cursor / 16;
+ printf(ESC"[%u;%uH", 1 + G.row, 1 + pos + (cursor & 0xf) * 3);
}
static void redraw_cur_line(void)
if (G.current_byte > G.eof_byte) {
/* _after_ eof - don't allow this */
G.current_byte -= 16;
+ if (G.current_byte < G.baseaddr)
+ move_mapping_lower();
break;
}
}