Commit Diff
- Commit:
2ef8fcaedd93b1a56d0940ddd58a43a6d6c321f0
- From:
- Omar Polo <op@omarpolo.com>
- Date:
- Message:
- set_scroll_position: always set current_line There's a small chance we may end up finding the topline but not the current line if a page content is abruptedly changed. While here also drop `curfound = 1': it's a dead assignment since it returns in that conditions. Bug found while reading the output of clang' scan-build, but not thanks to clang. scan-build complained about the `curfound' variable, and by re-reading the code I spotted the missing case.
- Actions:
- Patch | Tree
--- ui.c +++ ui.c @@ -145,7 +145,6 @@ set_scroll_position(struct tab *tab, size_t top, size_ } if (!curfound && i == cur) { - curfound = 1; tab->buffer.current_line = vl; return; } @@ -155,6 +154,9 @@ set_scroll_position(struct tab *tab, size_t top, size_ tab->buffer.top_line = TAILQ_FIRST(&tab->buffer.head); tab->buffer.current_line = tab->buffer.top_line; } + + if (!curfound) + tab->buffer.current_line = tab->buffer.top_line; } void