This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix truncation of TUI command history


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]