Closed CreativeCactus closed 3 years ago
Thanks @CreativeCactus, this looks like a great start to a solution! However, on my computer, it echos #mcfly:
to the history and never includes the current command line. It looks like array[0]
is always blank for me in bash (3.2) on OS X.
It looks like bash <4 has no READLINE_LINE
, so we will either need a version check, or find another way to get the current line in the bind handler.
Also, ${array[0]}
should have been ${array[@]}
, my bad.
@cantino
I've added a version check to use the $READLINE_LINE
trick.
For bash<4
, you might be able to use those control characters to move up a line and clear it? It's not as elegant, but it might be worth trying if you have not already. Maybe even bind -x '"C-r": "printf some control characters"
.
Unfortunately I don't have much time to experiment this week, but this branch should now be suitable to merge (pending review) as a fix for bash>=4
users.
Sorry for the delay on this, I'll need to test it out on a virtual machine when I have a chance. It's too bad that it needs to version check bash, but I guess that's unavoidable.
I've rebased and updated this in #113
Fixes https://github.com/cantino/mcfly/issues/100
I don't know enough about the first
bind
ifset -o | grep "vi " | grep -q on
passes, but I'm sure someone who knows why this condition exists can copy my pattern. :)