diff options
author | Tom Tromey <tom@tromey.com> | 2020-09-27 20:30:30 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-09-27 20:30:32 -0600 |
commit | 9e820dec13ec153f5843a30afe6d1c5037405278 (patch) | |
tree | 4dd4ccdadf25c5eb5781d4034cc5be52e109d32a /gdb/tui/tui-disasm.c | |
parent | c15c15c8d998af6676562d15b9a1f1dcac1fa3ea (diff) | |
download | gdb-9e820dec13ec153f5843a30afe6d1c5037405278.zip gdb-9e820dec13ec153f5843a30afe6d1c5037405278.tar.gz gdb-9e820dec13ec153f5843a30afe6d1c5037405278.tar.bz2 |
Use a curses pad for source and disassembly windows
This changes the TUI source and disassembly windows to use a curses
pad for their text. This is an important step toward properly
handling non-ASCII characters, because it makes it easy to scroll
horizontally without needing gdb to also understand multi-byte
character boundaries -- this can be wholly delegated to curses.
Horizontal scrolling is probably also faster now, because no
re-rendering is required.
gdb/ChangeLog
2020-09-27 Tom Tromey <tom@tromey.com>
* unittests/tui-selftests.c: Update.
* tui/tui-winsource.h (struct tui_source_window_base)
<extra_margin, show_line_number, refresh_pad>: New methods.
<m_max_length, m_pad>: New members.
(tui_copy_source_line): Update.
* tui/tui-winsource.c (tui_copy_source_line): Remove line_no,
first_col, line_width, ndigits parameters. Add length.
(tui_source_window_base::show_source_line): Write to pad. Line
number now 0-based.
(tui_source_window_base::refresh_pad): New method.
(tui_source_window_base::show_source_content): Write to pad. Call
refresh_pad.
(tui_source_window_base::do_scroll_horizontal): Call refresh_pad,
not refill.
(tui_source_window_base::update_exec_info): Call
show_line_number.
* tui/tui-source.h (struct tui_source_window) <extra_margin>: New
method.
<m_digits>: New member.
* tui/tui-source.c (tui_source_window::set_contents): Set m_digits
and m_max_length.
(tui_source_window::show_line_number): New method.
* tui/tui-io.h (tui_puts): Fix comment.
* tui/tui-disasm.c (tui_disasm_window::set_contents): Set
m_max_length.
Diffstat (limited to 'gdb/tui/tui-disasm.c')
-rw-r--r-- | gdb/tui/tui-disasm.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index d684b02..0b7980e 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -318,8 +318,7 @@ tui_disasm_window::set_contents (struct gdbarch *arch, const struct symtab_and_line &sal) { int i; - int offset = m_horizontal_offset; - int max_lines, line_width; + int max_lines; CORE_ADDR cur_pc; struct tui_locator_window *locator = tui_locator_win_info_ptr (); int tab_len = tui_tab_width; @@ -336,7 +335,6 @@ tui_disasm_window::set_contents (struct gdbarch *arch, /* Window size, excluding highlight box. */ max_lines = height - 2; - line_width = width - TUI_EXECINFO_SIZE - 2; /* Get temporary table that will hold all strings (addr & insn). */ std::vector<tui_asm_line> asm_lines; @@ -348,6 +346,7 @@ tui_disasm_window::set_contents (struct gdbarch *arch, /* Now construct each line. */ m_content.resize (max_lines); + m_max_length = -1; for (i = 0; i < max_lines; i++) { tui_source_element *src = &m_content[i]; @@ -370,7 +369,9 @@ tui_disasm_window::set_contents (struct gdbarch *arch, } const char *ptr = line.c_str (); - src->line = tui_copy_source_line (&ptr, -1, offset, line_width, 0); + int line_len; + src->line = tui_copy_source_line (&ptr, &line_len); + m_max_length = std::max (m_max_length, line_len); src->line_or_addr.loa = LOA_ADDRESS; src->line_or_addr.u.addr = addr; |