aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2023-06-09 16:44:12 +0200
committerTom de Vries <tdevries@suse.de>2023-06-09 16:44:12 +0200
commita3859ffba3a29b1409714cc2c44e4d0656de3021 (patch)
treea438b63da568f431520610f4db0e6a6541e4ee4b /gdb/tui
parent68bb2e3ee06fa4dbf39f95dc76743be5cd5254f5 (diff)
downloadgdb-a3859ffba3a29b1409714cc2c44e4d0656de3021.zip
gdb-a3859ffba3a29b1409714cc2c44e4d0656de3021.tar.gz
gdb-a3859ffba3a29b1409714cc2c44e4d0656de3021.tar.bz2
[gdb/tui] Simplify tui_puts_internal
Simplify tui_puts_internal by using continue, as per this [1] coding standard rule, making the function more readable and easier to understand. No functional changes. Tested on x86_64-linux. [1] https://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code Reviewed-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/tui')
-rw-r--r--gdb/tui/tui-io.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 908cb83..8cb68d1 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -523,36 +523,37 @@ tui_puts_internal (WINDOW *w, const char *string, int *height)
while ((c = *string++) != 0)
{
- if (c == '\n')
- saw_nl = true;
-
if (c == '\1' || c == '\2')
{
/* Ignore these, they are readline escape-marking
sequences. */
+ continue;
}
- else
+
+ if (c == '\033')
{
- if (c == '\033')
+ size_t bytes_read = apply_ansi_escape (w, string - 1);
+ if (bytes_read > 0)
{
- size_t bytes_read = apply_ansi_escape (w, string - 1);
- if (bytes_read > 0)
- {
- string = string + bytes_read - 1;
- continue;
- }
+ string = string + bytes_read - 1;
+ continue;
}
- do_tui_putc (w, c);
+ }
- if (height != nullptr)
- {
- int col = getcurx (w);
- if (col <= prev_col)
- ++*height;
- prev_col = col;
- }
+ if (c == '\n')
+ saw_nl = true;
+
+ do_tui_putc (w, c);
+
+ if (height != nullptr)
+ {
+ int col = getcurx (w);
+ if (col <= prev_col)
+ ++*height;
+ prev_col = col;
}
}
+
if (TUI_CMD_WIN != nullptr && w == TUI_CMD_WIN->handle.get ())
update_cmdwin_start_line ();
if (saw_nl)