++lineptr;
++column;
+
+ auto process_tab = [&] ()
+ {
+ int max_tab_len = tui_tab_width;
+
+ --column;
+ for (int j = column % max_tab_len;
+ j < max_tab_len && column < first_col + line_width;
+ column++, j++)
+ if (column >= first_col)
+ result.push_back (' ');
+ };
+
/* We have to process all the text in order to pick up all the
escapes. */
- if (column < first_col || column > first_col + line_width)
- continue;
+ if (column <= first_col || column > first_col + line_width)
+ {
+ if (c == '\t')
+ process_tab ();
+ continue;
+ }
if (c == '\n' || c == '\r' || c == '\0')
{
result.push_back ('?');
}
else if (c == '\t')
- {
- int j, max_tab_len = tui_tab_width;
-
- for (j = column - ((column / max_tab_len) * max_tab_len);
- j < max_tab_len && column < first_col + line_width;
- column++, j++)
- result.push_back (' ');
- }
+ process_tab ();
else
result.push_back (c);
}
{
enum tui_status ret = TUI_FAILURE;
- if (s != (struct symtab *) NULL)
+ if (s != NULL)
{
int line_width, nlines;
int cur_line_no, cur_line;
struct tui_gen_win_info *locator
= tui_locator_win_info_ptr ();
- struct tui_source_info *src
- = &TUI_SRC_WIN->detail.source_info;
+ struct tui_source_window_base *src
+ = (struct tui_source_window_base *) TUI_SRC_WIN;
const char *s_filename = symtab_to_filename_for_display (s);
if (TUI_SRC_WIN->generic.title)
if (curr_line == (n_lines / 2 + 1))
{
- int i;
int xpos;
int warning_length = strlen (warning_string);
char *src_line;
- src_line = element->which_element.source.line;
-
if (warning_length >= ((line_width - 1) / 2))
xpos = 1;
else
xpos = (line_width - 1) / 2 - warning_length;
- for (i = 0; i < xpos; i++)
- src_line[i] = ' ';
-
- sprintf (src_line + i, "%s", warning_string);
-
- for (i = xpos + warning_length; i < line_width; i++)
- src_line[i] = ' ';
-
- src_line[i] = '\n';
-
- } /* end if */
+ src_line = xstrprintf ("%s%s", n_spaces (xpos), warning_string);
+ xfree (element->which_element.source.line);
+ element->which_element.source.line = src_line;
+ }
curr_line++;
-
- } /* end while */
+ }
}
struct tui_line_or_address line,
int noerror)
{
- TUI_SRC_WIN->detail.source_info.horizontal_offset = 0;
+ TUI_SRC_WIN->horizontal_offset = 0;
tui_update_source_window_as_is (TUI_SRC_WIN, gdbarch, s, line, noerror);
}
/* Scroll the source forward or backward vertically. */
void
-tui_vertical_source_scroll (enum tui_scroll_direction scroll_direction,
- int num_to_scroll)
+tui_source_window::do_scroll_vertical
+ (enum tui_scroll_direction scroll_direction, int num_to_scroll)
{
- if (TUI_SRC_WIN->generic.content != NULL)
+ if (generic.content != NULL)
{
struct tui_line_or_address l;
struct symtab *s;
- tui_win_content content = TUI_SRC_WIN->generic.content;
+ tui_win_content content = generic.content;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
- if (cursal.symtab == (struct symtab *) NULL)
+ if (cursal.symtab == NULL)
s = find_pc_line_symtab (get_frame_pc (get_selected_frame (NULL)));
else
s = cursal.symtab;