This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/gdb-8.3-branch] Fix vertical scrolling of TUI source window


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ed4c1406c8d0e7dfad6eb0c7ef1c01999f590e2a

commit ed4c1406c8d0e7dfad6eb0c7ef1c01999f590e2a
Author: Eli Zaretskii <eliz@gnu.org>
Date:   Sat Mar 16 19:53:46 2019 +0200

    Fix vertical scrolling of TUI source window
    
    gdb/ChangeLog:
    2019-03-16  Eli Zaretskii  <eliz@gnu.org>
    
    	* 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:
---
 gdb/ChangeLog      | 6 ++++++
 gdb/source-cache.c | 7 +++++++
 2 files changed, 13 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6da0282..5db2799 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
 2019-03-16  Eli Zaretskii  <eliz@gnu.org>
 
+	* 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  <eliz@gnu.org>
+
 	* tui/tui-winsource.c (tui_show_source_line): Revert "Use
 	wclrtoeol in tui_show_source_line".  This reverts changes made in
 	commit 4a3045920bbe4e50a0f4920b0fdc4e88ef23015c.
diff --git a/gdb/source-cache.c b/gdb/source-cache.c
index 1ed2601..9211f09 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");


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]