Re: [RFC 8.3 0/3] Some style fixes

Eli Zaretskii
2019-03-13T15:44:19Z

> Date: Tue, 12 Mar 2019 17:08:33 +0000 (UTC)
> From: "Hannes Domani via gdb-patches" <gdb-patches@sourceware.org>
>
> In copy_source_line() it checks if (column < first_col), and because of the ++column directly
> before, it basically starts with 1 instead of 0.
>
> Attached is a patch that fixes most of 2) and 3), but I ignored the handling of escaped
> characters, because I just don't have them in any of my sources.

I can confirm that this patch fixes the problems with horizontal
scrolling, with or without TAB characters in the sources. I think we
should push it.

I also found another regression in the TUI configuration: if you step
with, say, "next" through the program, and execution winds up on a
line that is longer than the source window-width, then the current
line gets redrawn in reverse video, and as result it overwrites the
window-frame and a portion of the next source line. This happens
because we only update one source line, and we do that in a way that
doesn't take the window width and horizontal scrolling offset into
account.

Here's the patch that fixes this regression:

--- gdb/tui/tui-winsource.c~5 2019-03-12 16:51:50.000000000 +0200
+++ gdb/tui/tui-winsource.c 2019-03-13 08:21:02.303443600 +0200
@@ -382,12 +387,30 @@ tui_set_is_exec_point_at (struct tui_lin
{
changed++;
content[i]->which_element.source.is_exec_point = new_state;
- tui_show_source_line (win_info, i + 1);
}
i++;
}
if (changed)
- tui_refresh_win (&win_info->generic);
+ {
+ struct gdbarch *gdbarch = win_info->detail.source_info.gdbarch;
+ struct symtab *s = NULL;
+
+ if (win_info->generic.type == SRC_WIN)
+ {
+ struct symtab_and_line cursal
+ = get_current_source_symtab_and_line ();
+
+ if (cursal.symtab == NULL)
+ s = find_pc_line_symtab (get_frame_pc (get_selected_frame (NULL)));
+ else
+ s = cursal.symtab;
+ }
+ tui_update_source_window_as_is (win_info, gdbarch, s,
+ win_info->generic.content[0]
+ ->which_element.source.line_or_addr,
+ FALSE);
+ tui_refresh_win (&win_info->generic);
+ }
}

/* Update the execution windows to show the active breakpoints.