return true;
}
+ /* Return the width of the box. */
+ int box_width () const
+ {
+ return can_box () ? 1 : 0;
+ }
+
+ /* Return the size of the box. */
+ int box_size () const
+ {
+ return 2 * box_width ();
+ }
+
/* Resize this window. The parameters are used to set the window's
size and position. */
virtual void resize (int height, int width,
cur_pc = tui_location.addr ();
/* Window size, excluding highlight box. */
- max_lines = height - 2;
+ max_lines = height - box_size ();
/* Get temporary table that will hold all strings (addr & insn). */
std::vector<tui_asm_line> asm_lines;
for (i = 0; i < start_element_no; i++)
m_regs_content[i].y = 0;
- m_regs_column_count = (width - 2) / m_item_width;
+ m_regs_column_count = (width - box_size ()) / m_item_width;
if (m_regs_column_count == 0)
m_regs_column_count = 1;
- m_item_width = (width - 2) / m_regs_column_count;
+ m_item_width = (width - box_size ()) / m_regs_column_count;
/* Now create each data "sub" window, and write the display into
it. */
int cur_y = 1;
- while (i < m_regs_content.size () && cur_y <= height - 2)
+ while (i < m_regs_content.size () && cur_y <= height - box_size ())
{
for (int j = 0;
j < m_regs_column_count && i < m_regs_content.size ();
int last_line_no, first_line_on_last_page;
last_line_no = last_regs_line_no ();
- first_line_on_last_page = last_line_no - (height - 2);
+ first_line_on_last_page = last_line_no - (height - box_size ());
if (first_line_on_last_page < 0)
first_line_on_last_page = 0;
check_and_display_highlight_if_needed ();
if (prompt != NULL)
{
- int half_width = (width - 2) / 2;
+ int half_width = (width - box_size ()) / 2;
int x_pos;
if (strlen (prompt) >= half_width)
/* 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;
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;
{
/* Emit "+-TITLE-+" -- so 2 characters on the right and 2 on
the left. */
- int max_len = win_info->width - 2 - 2;
+ int max_len = win_info->width - win_info->box_size () - 2;
if (win_info->title ().size () <= max_len)
mvwaddstr (win, 0, 2, win_info->title ().c_str ());
tui_source_window_base::do_erase_source_content (const char *str)
{
int x_pos;
- int half_width = (width - 2) / 2;
+ int half_width = (width - box_size ()) / 2;
m_content.clear ();
if (handle != NULL)
gdb_assert (pad_width > 0 || m_pad.get () == nullptr);
gdb_assert (pad_x + view_width <= pad_width || m_pad.get () == nullptr);
- int sminrow = y + 1;
+ int sminrow = y + box_width ();
int smincol = x + left_margin;
int smaxrow = sminrow + m_content.size () - 1;
int smaxcol = smincol + view_width - 1;
for (int lineno = 0; lineno < m_content.size (); lineno++)
show_source_line (lineno);
- /* Calling check_and_display_highlight_if_needed will call refresh_window
- (so long as the current window can be boxed), which will ensure that
- the newly loaded window content is copied to the screen. */
- gdb_assert (can_box ());
- check_and_display_highlight_if_needed ();
+ if (can_box ())
+ {
+ /* Calling check_and_display_highlight_if_needed will call refresh_window
+ (so long as the current window can be boxed), which will ensure that
+ the newly loaded window content is copied to the screen. */
+ check_and_display_highlight_if_needed ();
+ }
+ else
+ refresh_window ();
}
tui_source_window_base::tui_source_window_base ()
if (src_element->is_exec_point)
element[TUI_EXEC_POS] = '>';
- mvwaddstr (handle.get (), i + 1, 1, element);
+ mvwaddstr (handle.get (), i + box_width (), box_width (), element);
show_line_number (i);
}
/* Return the size of the left margin space, this is the space used to
display things like breakpoint markers. */
int left_margin () const
- { return 1 + TUI_EXECINFO_SIZE + extra_margin (); }
+ { return box_width () + TUI_EXECINFO_SIZE + extra_margin (); }
/* Return the width of the area that is available for window content.
This is the window width minus the borders and the left margin, which
is used for displaying things like breakpoint markers. */
int view_width () const
- { return width - left_margin () - 1; }
+ { return width - left_margin () - box_width (); }
void show_source_content ();