From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8134 invoked by alias); 8 Jul 2015 15:45:01 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 8106 invoked by uid 48); 8 Jul 2015 15:45:00 -0000 From: "dilyan.palauzov at aegee dot org" To: gdb-prs@sourceware.org Subject: [Bug tui/14126] Color escape sequences don't work in tui mode Date: Wed, 08 Jul 2015 15:45:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: tui X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dilyan.palauzov at aegee dot org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-q3/txt/msg00066.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=14126 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 --- \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.