diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2015-11-24 03:04:14 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-11-24 03:04:14 +0100 |
commit | e921a619b0fab58bff7a753c991839843b096191 (patch) | |
tree | 8ce39af78213dfebeb0305db2ab9871960f77420 | |
parent | 25282cfe235d3dceecd07ab98e90ce6c2cbde767 (diff) | |
download | xK-e921a619b0fab58bff7a753c991839843b096191.tar.gz xK-e921a619b0fab58bff7a753c991839843b096191.tar.xz xK-e921a619b0fab58bff7a753c991839843b096191.zip |
degesch: readline fixups
When a new buffer was created automatically (channel was joined),
we didn't bother to erase the current line buffer.
-rw-r--r-- | degesch.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -226,8 +226,7 @@ input_erase (struct input *self) (void) self; rl_set_prompt (""); - rl_replace_line ("", 0); - rl_point = rl_mark = 0; + rl_replace_line ("", false); rl_redisplay (); } @@ -325,12 +324,15 @@ input_save_buffer (struct input *self, struct input_buffer *buffer) buffer->saved_line = rl_copy_text (0, rl_end); buffer->saved_point = rl_point; buffer->saved_mark = rl_mark; + + rl_replace_line ("", true); + if (self->prompt_shown > 0) + rl_redisplay (); } static void input_restore_buffer (struct input *self, struct input_buffer *buffer) { - // Restore the target buffer's history if (buffer->history) { // history_get_history_state() just allocates a new HISTORY_STATE @@ -352,10 +354,9 @@ input_restore_buffer (struct input *self, struct input_buffer *buffer) free (state); } - // Try to restore the target buffer's readline state if (buffer->saved_line) { - rl_replace_line (buffer->saved_line, 0); + rl_replace_line (buffer->saved_line, true); rl_point = buffer->saved_point; rl_mark = buffer->saved_mark; free (buffer->saved_line); @@ -441,7 +442,7 @@ input_restore (struct input *self) hard_assert (self->saved_line); rl_set_prompt (self->prompt); - rl_replace_line (self->saved_line, 0); + rl_replace_line (self->saved_line, false); rl_point = self->saved_point; rl_mark = self->saved_mark; free (self->saved_line); |