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] Remove fields curch and cur_line from TUI_CMD_WIN


On 08/19/2015 05:38 AM, Patrick Palka wrote:
> These fields are currently used to track the location of the cursor
> inside the command window.  But their usefulness is questionable because
> ncurses already internally keeps track of the location of the cursor,
> whose coordinates we can query using the functions getyx(), getcurx() or
> getcury().  It is an unnecessary pain to keep these fields in sync with
> ncurses, and their meaning is not well-defined anyway.  For instance, it
> is not clear whether the coordinates held in these fields are
> authoritative, or whether the coordinates reported by ncurses are.
> 
> So to keep things simple, this patch removes these fields and replaces
> existing reads of these fields with calls to the appropriate ncurses
> querying functions, and writes to these fields with calls to wmove()
> (when necessary and applicable).
> 
> In the function tui_cont_sig(), I removed the call to wmove() entirely
> because moving to (start_line, curch) makes no sense.  The move should
> have been to (cur_line, curch) -- which would now be a no-op.
> 
> Does this seem like a step in the right direction?  These fields like an
> unnecessary abstraction.
> 

Sounds like a good idea to me.

> Tested on x86_64 Fedora 22, with seemingly no obvious regressions.
> 
> gdb/ChangeLog:
> 
> 	* tui/tui-data.h (tui_command_info): Remove fields cur_line and
> 	curch.
> 	* tui/tui-data.c (tui_clear_win_detail) [CMD_WIN]: Don't set
> 	cur_line or curch, instead call wmove().
> 	(init_win_info) [CMD_WIN]: Likewise.
> 	* tui/tui-io.c (tui_puts): Likewise. Don't read cur_line,
> 	instead call getcury().
> 	(tui_redisplay_readline): Don't set cur_line or curch.
> 	(tui_mld_erase_entire_line): Don't read cur_line, instead call
> 	getcury().
> 	(tui_cont_sig): Remove call to wmove.
> 	(tui_getc): Don't read cur_line or curch, instead call getcury()
> 	or getyx().  Don't set curch.
> 	* tui/tui-win.c (make_visible_with_new_height) [CMD_WIN]: Don't
> 	set cur_line or curch.  Always move cursor to (0,0).

OK.

Thanks,
Pedro Alves


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