[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Readline behavior with colored custom prompt

From: Matthew Keeter
Subject: Re: Readline behavior with colored custom prompt
Date: Thu, 25 Feb 2016 17:09:56 -0500

Figured it out, after a bit more searching – it’s purely due to readline's behavior.

readline obeys the magic characters \x01 and \x02, ignoring anything in between then
when calculating prompt length.  Wrapping the escape sequences makes everything
behave correctly.

(similar bug:


On Feb 25, 2016, at 1:53 PM, Matthew Keeter <address@hidden> wrote:

I think the fundamental issue is incorrect prompt length calculation, since it’s not just bounce-parens:
even with that turned off, scrolling through history ends up printing weird mismatched lines.

Here’s a similar issue discussed in nodejs:

Any suggestions where to look for prompt length calculations?
I flipped through guile-readline/readline.c but didn’t see any obvious places to apply a fix.


On Feb 25, 2016, at 1:05 PM, Mike Gran <address@hidden> wrote:

On Thursday, February 25, 2016 9:21 AM, Matthew Keeter <address@hidden> wrote:

Run this and you’ll get a Guile shell.  Into that shell, type

  '(1 2 3 4 5 6 7 8 9 10)

The final parenthesis will highlight a character midway through the string
(instead of the first parenthesis).

The same issues happen if you try to scroll through history: lines end up
overlapping in strange ways.

Removing the ANSI codes from custom-prompt resolves the issue, but I’d really
like to have a colored prompt and correct readline behavior.

Does anyone have any ideas?

The conflict is likely between your codes and the bounce-parens functionality
of the readline prompt.

(readline-set! bounce-parens 0)  should disable that functionality and make the
colored prompt work.

To get your escape sequences and bounce-parens working would probably require
more thinking...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]