guile-user
[Top][All Lists]
Advanced

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

Re: Readline behavior with colored custom prompt


From: Nala Ginrut
Subject: Re: Readline behavior with colored custom prompt
Date: Fri, 26 Feb 2016 13:09:06 +0800

Are you looking for something like guile-colorized?
https://github.com/NalaGinrut/guile-colorized


On Thu, 2016-02-25 at 12:20 -0500, Matthew Keeter wrote:
> Hi all,
> 
> I’m seeing strange behavior with readline's interaction with ANSI codes.
> 
> Here’s a minimal sample script that reproduces the behavior:
> 
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> (use-modules (system repl repl) (system repl common))
> (use-modules (ice-9 readline))
> 
> (define (custom-prompt repl)  "\x1b[34m :D > \x1b[0m")
> 
> (activate-readline)
> (repl-default-option-set! 'prompt custom-prompt)
> 
> (start-repl)
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> 
> 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?
> 
> Thanks,
> Matt





reply via email to

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