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.
-Matt 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.
Thanks, Matt
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...
-Mike
|