diff --git a/src/viewer/lib.c b/src/viewer/lib.c
index 00be8d0..7eec141 100644
a
|
b
|
mcview_done (mcview_t * view) |
237 | 237 | { |
238 | 238 | char *canon_fname; |
239 | 239 | canon_fname = vfs_canon (view->filename); |
240 | | save_file_position (canon_fname, -1, 0, view->dpy_start, view->saved_bookmarks); |
| 240 | save_file_position (canon_fname, -1, 0, |
| 241 | view->hex_mode ? view->hex_cursor : view->dpy_start, |
| 242 | view->saved_bookmarks); |
241 | 243 | view->saved_bookmarks = NULL; |
242 | 244 | g_free (canon_fname); |
243 | 245 | } |
diff --git a/src/viewer/mcviewer.c b/src/viewer/mcviewer.c
index 3cf9948..c28adc8 100644
a
|
b
|
mcview_load (mcview_t * view, const char *command, const char *file, int start_l |
390 | 390 | |
391 | 391 | canon_fname = vfs_canon (view->filename); |
392 | 392 | load_file_position (canon_fname, &line, &col, &new_offset, &view->saved_bookmarks); |
393 | | new_offset = min (new_offset, mcview_get_filesize (view)); |
394 | | view->dpy_start = mcview_bol (view, new_offset, 0); |
| 393 | new_offset = min (new_offset, mcview_get_filesize (view)-1); |
| 394 | if (new_offset < 0) |
| 395 | new_offset = 0; |
| 396 | if (view->hex_mode) |
| 397 | { |
| 398 | view->dpy_start = new_offset - new_offset % view->bytes_per_line; |
| 399 | view->hex_cursor = new_offset; |
| 400 | } |
| 401 | else |
| 402 | view->dpy_start = mcview_bol (view, new_offset, 0); |
395 | 403 | g_free (canon_fname); |
396 | 404 | } |
397 | 405 | else if (start_line > 0) |