From fd0aa065a2e89a09e637c25c0521bca5cdfd28c7 Mon Sep 17 00:00:00 2001 From: anon Date: Sat, 2 Sep 2023 23:09:16 +0200 Subject: [PATCH] fixed text changing bugs --- src/display.c | 1 + src/input.c | 5 ++--- src/readline.c | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/display.c b/src/display.c index 17240a7..d852ecb 100644 --- a/src/display.c +++ b/src/display.c @@ -268,6 +268,7 @@ void force_window(){ break; case INPUT_CHANGE_TO: case INPUT_APPEND: + case INPUT_READ: current_window = &winput; break; } diff --git a/src/input.c b/src/input.c index 8e5677d..d48598c 100644 --- a/src/input.c +++ b/src/input.c @@ -393,8 +393,6 @@ int change_input(const int c) { } } - input_mode = INPUT_NORMAL; - return 0; } @@ -406,7 +404,8 @@ int changestring(const char *from, const char *to, const bool *const change, char msg[MSGLEN + 1]; /* message */ FILE *script; /* shell script file */ - /* Return early */ + + // Return early bool anymarked = false; /* any line marked */ for(int i = 0; i < change_len; i++) { if(change[i]) { diff --git a/src/readline.c b/src/readline.c index 3093506..3bfca9f 100644 --- a/src/readline.c +++ b/src/readline.c @@ -80,7 +80,10 @@ static void redisplay_function() { } static void callback_handler(char *line) { - if(!line) { return; } // XXX; should behave differently with different modes + if(!line) { + input_mode = INPUT_NORMAL; + return; + } add_history(line); @@ -127,6 +130,7 @@ static void callback_handler(char *line) { case CHANGE: if(totallines == 0){ return; } input_mode = INPUT_CHANGE_TO; + force_window(); break; case DEFINITION: case FILENAME: