[14/16] Use wclrtoeol in tui_show_source_line

Message ID 20181128001435.12703-15-tom@tromey.com
State New
Headers show
Series
  • Add styling to the gdb CLI and TUI
Related show

Commit Message

Tom Tromey Nov. 28, 2018, 12:14 a.m.
This changes tui_show_source_line to use wclrtoeol rather than
manually emitting a sequence of spaces.

gdb/ChangeLog
2018-11-27  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_show_source_line): Use wclrtoeol.
---
 gdb/ChangeLog           | 4 ++++
 gdb/tui/tui-winsource.c | 8 +-------
 2 files changed, 5 insertions(+), 7 deletions(-)

-- 
2.17.2

Comments

Joel Brobecker Dec. 24, 2018, 8:03 a.m. | #1
> This changes tui_show_source_line to use wclrtoeol rather than

> manually emitting a sequence of spaces.

> 

> gdb/ChangeLog

> 2018-11-27  Tom Tromey  <tom@tromey.com>

> 

> 	* tui/tui-winsource.c (tui_show_source_line): Use wclrtoeol.


This one can go in on its own, I think!


-- 
Joel

Patch

diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 49eb4ce6fc..0bf74383b1 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -272,7 +272,6 @@  static void
 tui_show_source_line (struct tui_win_info *win_info, int lineno)
 {
   struct tui_win_element *line;
-  int x;
 
   line = win_info->generic.content[lineno - 1];
   if (line->which_element.source.is_exec_point)
@@ -284,12 +283,7 @@  tui_show_source_line (struct tui_win_info *win_info, int lineno)
     wattroff (win_info->generic.handle, A_STANDOUT);
 
   /* Clear to end of line but stop before the border.  */
-  x = getcurx (win_info->generic.handle);
-  while (x + 1 < win_info->generic.width)
-    {
-      waddch (win_info->generic.handle, ' ');
-      x = getcurx (win_info->generic.handle);
-    }
+  wclrtoeol (win_info->generic.handle);
 }
 
 void