This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix truncation of TUI command history
- From: Pedro Alves <palves at redhat dot com>
- To: Patrick Palka <patrick at parcs dot ath dot cx>, gdb-patches at sourceware dot org
- Date: Tue, 10 Feb 2015 17:29:56 +0000
- Subject: Re: [PATCH] Fix truncation of TUI command history
- Authentication-results: sourceware.org; auth=none
- References: <1420861759-10700-1-git-send-email-patrick at parcs dot ath dot cx> <1420861759-10700-2-git-send-email-patrick at parcs dot ath dot cx>
On 01/10/2015 03:49 AM, Patrick Palka wrote:
> We need to move the cursor because
> when ncurses outputs a newline it truncates any text that appears
> past the end of the cursor.
Can you merge this sentence into the comment in the code?
> else
> {
> - wmove (w, TUI_CMD_WIN->detail.command_info.cur_line,
> - TUI_CMD_WIN->detail.command_info.curch);
> - waddch (w, ch);
> + /* Move cursor to the end of the command line before emitting the
> + newline. */
... as this as is doesn't explain _why_ we need to do that, which
may make the reader wonder.
> + int px = TUI_CMD_WIN->detail.command_info.curch;
> + int py = TUI_CMD_WIN->detail.command_info.cur_line;
> + px += rl_end - rl_point;
> + py += px / TUI_CMD_WIN->generic.width;
> + px %= TUI_CMD_WIN->generic.width;
> + wmove (w, py, px);
> + waddch (w, ch);
> }
> }
>
>
OK with that change. Thanks!
Thanks,
Pedro Alves