diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
index c653b82..db6ce0c 100644
a
|
b
|
adjust_top_file (WPanel * panel) |
1349 | 1349 | { |
1350 | 1350 | int items; |
1351 | 1351 | |
| 1352 | panel->selected = CLAMP (panel->selected, 0, panel->dir.len - 1); |
| 1353 | |
1352 | 1354 | items = panel_items (panel); |
1353 | 1355 | |
1354 | 1356 | if (panel->dir.len <= items) |
… |
… |
set_panel_formats (WPanel * p) |
4498 | 4500 | void |
4499 | 4501 | select_item (WPanel * panel) |
4500 | 4502 | { |
4501 | | /* Although currently all over the code we set the selection and |
4502 | | top file to decent values before calling select_item, I could |
4503 | | forget it someday, so it's better to do the actual fitting here */ |
4504 | | |
4505 | | if (panel->selected < 0) |
4506 | | panel->selected = 0; |
4507 | | |
4508 | | if (panel->selected > panel->dir.len - 1) |
4509 | | panel->selected = panel->dir.len - 1; |
4510 | | |
4511 | 4503 | adjust_top_file (panel); |
4512 | 4504 | |
4513 | 4505 | panel->dirty = 1; |