From: Eli Zaretskii Date: Sat, 16 Mar 2019 17:53:46 +0000 (+0200) Subject: Fix vertical scrolling of TUI source window X-Git-Tag: gdb-8.3-release~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ed4c1406c8d0e7dfad6eb0c7ef1c01999f590e2a;p=thirdparty%2Fbinutils-gdb.git Fix vertical scrolling of TUI source window gdb/ChangeLog: 2019-03-16 Eli Zaretskii * source-cache.c (source_cache::get_source_lines): Call find_source_lines to initialize s->nlines. This fixes vertical scrolling of TUI source window when the DOWN arrow is pressed. (cherry picked from commit ab42892fb7d265e72a85e918d4f5c6dfeee3fcd8) --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6da02822c10..5db27999646 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2019-03-16 Eli Zaretskii + + * source-cache.c (source_cache::get_source_lines): Call + find_source_lines to initialize s->nlines. This fixes vertical + scrolling of TUI source window when the DOWN arrow is pressed. + 2019-03-16 Eli Zaretskii * tui/tui-winsource.c (tui_show_source_line): Revert "Use diff --git a/gdb/source-cache.c b/gdb/source-cache.c index 1ed2601c614..9211f098eb7 100644 --- a/gdb/source-cache.c +++ b/gdb/source-cache.c @@ -200,6 +200,13 @@ source_cache::get_source_lines (struct symtab *s, int first_line, std::ifstream input (fullname); if (input.is_open ()) { + if (s->line_charpos == 0) + { + scoped_fd desc = open_source_file (s); + if (desc.get () < 0) + return false; + find_source_lines (s, desc.get ()); + } srchilite::SourceHighlight highlighter ("esc.outlang"); highlighter.setStyleFile("esc.style");