public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug tui/14126] New: Color escape sequences don't work in tui mode
@ 2012-05-21  3:58 jan at majutsushi dot net
  2015-07-08 15:45 ` [Bug tui/14126] " dilyan.palauzov at aegee dot org
  0 siblings, 1 reply; 2+ messages in thread
From: jan at majutsushi dot net @ 2012-05-21  3:58 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14126

             Bug #: 14126
           Summary: Color escape sequences don't work in tui mode
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tui
        AssignedTo: unassigned@sourceware.org
        ReportedBy: jan@majutsushi.net
    Classification: Unclassified


If TUI mode is enabled then coloring the prompt or output using escape
sequences doesn't work, the sequences are instead shown as-is.

Example:

In normal mode, "echo \033[32mFOO\033[0m\n" will print "FOO" in green. However,
if the TUI is enabled, it will print "^[[32mFOO^[[0m" instead. This makes
trying to make the output more readable rather difficult.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug tui/14126] Color escape sequences don't work in tui mode
  2012-05-21  3:58 [Bug tui/14126] New: Color escape sequences don't work in tui mode jan at majutsushi dot net
@ 2015-07-08 15:45 ` dilyan.palauzov at aegee dot org
  0 siblings, 0 replies; 2+ messages in thread
From: dilyan.palauzov at aegee dot org @ 2015-07-08 15:45 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-08 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-21  3:58 [Bug tui/14126] New: Color escape sequences don't work in tui mode jan at majutsushi dot net
2015-07-08 15:45 ` [Bug tui/14126] " dilyan.palauzov at aegee dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).