[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with bind -x
From: |
isabella parakiss |
Subject: |
Problem with bind -x |
Date: |
Tue, 21 Apr 2015 21:42:02 +0200 |
I noticed a problem with bind -x: readline re-prints the line if the
function is called when the cursor is not in the first line.
To reproduce it (and to understand what I mean, if it's not clear):
prompt$ myfunc () { :; }
prompt$ bind -x '"\C-a":myfunc'
Now write a line that's long enough to wrap, then press C-a
prompt$ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaa
Results in this:
prompt$ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
prompt$ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaa
Similar results also happen with heredocs and any command that spans
multiple lines when it's recalled with previous-history
It appears that removing these two lines from display.c fixes it:
--- a/lib/readline/display.c
+++ b/lib/readline/display.c
@@ -1936,8 +1936,8 @@ rl_on_new_line ()
if (visible_line)
visible_line[0] = '\0';
- _rl_last_c_pos = _rl_last_v_pos = 0;
- _rl_vis_botlin = last_lmargin = 0;
+ /*_rl_last_c_pos = _rl_last_v_pos = 0;*/
+ /*_rl_vis_botlin = last_lmargin = 0;*/
if (vis_lbreaks)
vis_lbreaks[0] = vis_lbreaks[1] = 0;
visible_wrap_offset = 0;
I don't know if it breaks something else...
Hope this helps.
---
xoxo iza
- Problem with bind -x,
isabella parakiss <=