binutils-gdb/gdb/tui
Pedro Alves 9753a2f6d7 Fix PR tui/21216: TUI line breaks regression
Commit d7e747318f ("Eliminate make_cleanup_ui_file_delete / make
ui_file a class hierarchy") regressed the TUI's command window.
Newlines miss doing a "carriage return", resulting in output like:

~~~~~~~~~~~~~~~~~~
(gdb) helpList of classes of commands:

                                      aliases -- Aliases of other commands
                                                                          breakpoints -- Making program stop at certain points
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Before the commit mentioned above, the default ui_file->to_write
implementation had a hack that would defer into the ui_file->to_fputs
method.  The TUI's ui_file did not implement the to_write method, so
all writes would end up going to the ncurses window via tui_file_fputs
-> tui_puts.

After the commit above, the hack is gone, but the TUI's ui_file still
does not implement the ui_file::write method.  Since tui_file inherits
from stdio_file, writing to a tui_file ends up doing fwrite on the
FILE stream the TUI is "associated" with, via stdio_file::write,
instead of writing to the ncurses window.

The fix is to have tui_file override the "write" method.

New test included.

gdb/ChangeLog:
2017-03-08  Pedro Alves  <palves@redhat.com>

	PR tui/21216
	* tui/tui-file.c (tui_file::write): New.
	* tui/tui-file.h (tui_file): Override "write".
	* tui/tui-io.c (do_tui_putc, update_start_line): New functions,
	factored out from ...
	(tui_puts): ... here.
	(tui_putc): Use them.
	(tui_write): New function.
	* tui/tui-io.h (tui_write): Declare.

gdb/testsuite/ChangeLog:
2017-03-08  Pedro Alves  <palves@redhat.com>

	PR tui/21216
	* gdb.tui/tui-nl-filtered-output.exp: New file.
2017-03-08 00:14:59 +00:00
..
ChangeLog-1998-2003
tui-command.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-command.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-data.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-data.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-disasm.c Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy 2017-02-02 11:11:47 +00:00
tui-disasm.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-file.c Fix PR tui/21216: TUI line breaks regression 2017-03-08 00:14:59 +00:00
tui-file.h Fix PR tui/21216: TUI line breaks regression 2017-03-08 00:14:59 +00:00
tui-hooks.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-hooks.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-interp.c C++-fy struct interp/cli_interp/tui_interp/mi_interp 2017-02-03 16:30:04 +00:00
tui-io.c Fix PR tui/21216: TUI line breaks regression 2017-03-08 00:14:59 +00:00
tui-io.h Fix PR tui/21216: TUI line breaks regression 2017-03-08 00:14:59 +00:00
tui-layout.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-layout.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-out.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-out.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-regs.c Fix "layout reg" crash 2017-03-07 13:54:02 +00:00
tui-regs.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-source.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-source.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-stack.c Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy 2017-02-02 11:11:47 +00:00
tui-stack.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-win.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-win.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-windata.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-windata.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-wingeneral.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-wingeneral.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-winsource.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui-winsource.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tui.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00