tui-winsource: Allocate for actual lines only

The logic for allocating a TUI source window's content buffer allocates
two more lines than needed, because it does not reduce the window height
by the highlight box's overhead.  However, it does reduce the line width
accordingly.  This patch makes the height and width calculation
consistent and improves the comment.

gdb/ChangeLog:

	* tui/tui-winsource.c (tui_alloc_source_buffer): Subtract
	highlight box's overhead when calculating the content height.
This commit is contained in:
Andreas Arnez 2016-11-09 13:02:13 +01:00
parent f5396833d3
commit 7bc2c8b83e
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2016-11-09 Andreas Arnez <arnez@linux.vnet.ibm.com>
* tui/tui-winsource.c (tui_alloc_source_buffer): Subtract
highlight box's overhead when calculating the content height.
2016-11-09 Andreas Arnez <arnez@linux.vnet.ibm.com> 2016-11-09 Andreas Arnez <arnez@linux.vnet.ibm.com>
* tui/tui-disasm.c (tui_set_disassem_content): Fix calculation of * tui/tui-disasm.c (tui_set_disassem_content): Fix calculation of

View File

@ -604,8 +604,11 @@ tui_alloc_source_buffer (struct tui_win_info *win_info)
char *src_line_buf; char *src_line_buf;
int i, line_width, max_lines; int i, line_width, max_lines;
max_lines = win_info->generic.height; /* Less the highlight box. */ /* The window width/height includes the highlight box. Determine actual
line_width = win_info->generic.width - 1; content dimensions, including string null-terminators. */
max_lines = win_info->generic.height - 2;
line_width = win_info->generic.width - 2 + 1;
/* /*
* Allocate the buffer for the source lines. Do this only once * Allocate the buffer for the source lines. Do this only once
* since they will be re-used for all source displays. The only * since they will be re-used for all source displays. The only