This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug tui/14126] Color escape sequences don't work in tui mode
- From: "dilyan.palauzov at aegee dot org" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Wed, 08 Jul 2015 15:44:59 +0000
- Subject: [Bug tui/14126] Color escape sequences don't work in tui mode
- Auto-submitted: auto-generated
- References: <bug-14126-4717 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=14126
dilyan.palauzov at aegee dot org <dilyan.palauzov at aegee dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dilyan.palauzov at aegee dot org
--- Comment #1 from dilyan.palauzov at aegee dot org <dilyan.palauzov at aegee dot org> ---
\w is expanded to the working directory, the problem with TUI and
extended-prompt are (only) the escape sequences. The proposed patch below just
discards all non-printing characters, between \[ and \], in TUI mode.
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index a2df254..cab10d2 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -5137,7 +5137,8 @@ Substitute the current working directory.
Begin a sequence of non-printing characters. These sequences are
typically used with the ESC character, and are not counted in the string
length. Example: ``\[\e[0;34m\](gdb)\[\e[0m\]'' will return a
-blue-colored ``(gdb)'' prompt where the length is five.
+blue-colored ``(gdb)'' prompt where the length is five. In TUI mode
+these characters are discarded.
@item \]
End a sequence of non-printing characters.
@end table
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 97906ce..b77866a 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -232,6 +232,22 @@ tui_redisplay_readline (void)
height = 1;
for (in = 0; prompt && prompt[in]; in++)
{
+ /* Drop characters from extended-prompt between \[ == \001 and \] = \002
+ The point is, that waddch prints ^ instead of control characters and
+ in turn the latter are not interpreted by the terminal. TUI prints
+ then ^ and this is ugly.
+
+ It seems there is no way to send escape characters to the terminal
+ under curses, at least not with fputc (c , stdout);
+
+ Skiping escape sequences, which are not within \[ and \] is hard, as
+ only the terminal has knowledge where the sequence ends and where the
+ actual input starts. */
+ if (prompt[in] == '\001')
+ {
+ do { in++; } while (prompt[in] != '\002' && prompt[in] != '\0');
+ continue;
+ }
waddch (w, prompt[in]);
getyx (w, line, col);
if (col <= prev_col)
--
You are receiving this mail because:
You are on the CC list for the bug.