[gdb/tui] Add tui_win_info::{box_width,box_size}
[binutils-gdb.git] / gdb / tui / tui-source.c
index 6625f0cf0885686fb38a57958358d411aea7a72c..5e9a954f7c2eecd15c8fe55af9b83b6172419014 100644 (file)
@@ -53,7 +53,7 @@ tui_source_window::set_contents (struct gdbarch *arch,
 
   /* Take hilite (window border) into account, when
      calculating the number of lines.  */
-  int nlines = height - 2;
+  int nlines = height - box_size ();
 
   std::string srclines;
   const std::vector<off_t> *offsets;
@@ -201,7 +201,7 @@ tui_source_window::line_is_displayed (int line) const
 void
 tui_source_window::maybe_update (frame_info_ptr fi, symtab_and_line sal)
 {
-  int start_line = (sal.line - ((height - 2) / 2)) + 1;
+  int start_line = (sal.line - ((height - box_size ()) / 2)) + 1;
   if (start_line <= 0)
     start_line = 1;