diff --git a/README.md b/README.md index b6e7265..770b0a2 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ This should include libreadline. If it doesn't, you need to build bash to use th Control-C usually sends a SIGNINT signal that is handled by zsh, readline, or the program that calls readline. For other keys: -- In readline, chars marked as rl_delete (usually Control-D), rl_newline (usually return), rl_complete (usually tab), and rl_clear_screen (usually Control-L) are sent to readline. All other keys are sent to vim. +- In readline, chars marked as rl_delete (usually Control-D), rl_newline (usually return), rl_complete (usually tab), and rl_clear_screen (usually Control-L) are sent to readline. All other keys are sent to vim. This means that if you use readline's built-in vi-mode, Control-L and Control-D probably won't be sent to the shell. - In zsh, Athame is hardcoded to send tab, Control-D, carriage return, new line, and Control-L to zsh. All other keys are sent to vim. This behavior will likely change in the future. ####I got the error "Couldn't load vim path" diff --git a/athame_util.h b/athame_util.h index e276678..3b47bd1 100644 --- a/athame_util.h +++ b/athame_util.h @@ -976,10 +976,12 @@ static int athame_get_vim_info_inner() } if (command) { - setenv("ATHAME_VIM_COMMAND", command, 1); - strcpy(athame_command, command); - command_cursor = cmd_pos; - // Don't record a change because the highlight for incsearch might not have changed yet. + if(strcmp(athame_command, command) !=0 || command_cursor != cmd_pos) { + setenv("ATHAME_VIM_COMMAND", command, 1); + strcpy(athame_command, command); + command_cursor = cmd_pos; + changed =1; + } } } else diff --git a/athamerc b/athamerc index ba72fd6..bb03217 100644 --- a/athamerc +++ b/athamerc @@ -18,7 +18,7 @@ set textwidth=0 "Don't try to wrap text startinsert "Start in insert mode. Most shell vi-modes do this. " These make arrows more shell like. Feel free to comment them out: -if has("patch928") +if v:version>=800 || has("patch928") " These maps can segfault in earlier vim versions. inoremap A inoremap A diff --git a/readline.patch b/readline.patch index e7756a0..fff9402 100644 --- a/readline.patch +++ b/readline.patch @@ -138,12 +138,13 @@ diff -ru a/readline.c b/readline.c /* Restore the original of this history line, iff the line that we are editing was originally in the history, AND the line has changed. */ entry = current_history (); -@@ -561,7 +566,14 @@ +@@ -561,7 +566,16 @@ } RL_SETSTATE(RL_STATE_READCMD); - c = rl_read_key (); -+ if (athame_enabled()) ++ int use_athame = athame_enabled(); ++ if (use_athame) + { + c = athame_loop(fileno(rl_instream)); + } @@ -151,6 +152,7 @@ diff -ru a/readline.c b/readline.c + c = rl_read_key(); + athame_after_bypass(); + } ++ if (!use_athame || c) { RL_UNSETSTATE(RL_STATE_READCMD); /* look at input.c:rl_getc() for the circumstances under which this will @@ -162,6 +164,14 @@ diff -ru a/readline.c b/readline.c RL_CHECK_SIGNALS (); /* If there was no change in _rl_last_command_was_kill, then no kill +@@ -608,6 +623,7 @@ + if (rl_pending_input == 0 && lk == _rl_last_command_was_kill) + _rl_last_command_was_kill = 0; + ++} + _rl_internal_char_cleanup (); + + #if defined (READLINE_CALLBACKS) diff -ru a/shlib/Makefile.in b/shlib/Makefile.in --- a/shlib/Makefile.in 2015-07-15 00:03:32.898231038 -0400 +++ b/shlib/Makefile.in 2015-07-14 23:37:04.674826478 -0400 diff --git a/test/shell/expected5 b/test/shell/expected5 new file mode 100644 index 0000000..29159de --- /dev/null +++ b/test/shell/expected5 @@ -0,0 +1,2 @@ +good +yay diff --git a/test/shell/inst5.sh b/test/shell/inst5.sh new file mode 100644 index 0000000..bc3bd44 --- /dev/null +++ b/test/shell/inst5.sh @@ -0,0 +1,6 @@ +input=0 +read -e input +good +echo $input > out5 +read -en3 input +yayecho $input >> out5