From 3a88e03f1786ae3efb9c5ca40bbf4d6e3081ee2a Mon Sep 17 00:00:00 2001
From: Anonymus Raccoon
Date: Sun, 24 May 2020 22:13:56 +0200
Subject: [PATCH] Fixing the cursor position with too long queries
---
src/shell.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/shell.c b/src/shell.c
index f75f34c..5f73da8 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -23,7 +23,10 @@ int process_key(int key, buffer_t *buffer, env_t *env)
{
if (key <= 0)
return (0);
- my_clrtobot();
+ if (env->window) {
+ my_move(env->window, NO_MOVE, env->window->w);
+ my_clrtobot();
+ }
if (buffer->quoted_insert) {
buffer->quoted_insert = false;
return (self_insert_command(key, buffer, env));
@@ -57,6 +60,8 @@ void shell_refresh(buffer_t *buffer, env_t *env)
static int oldwidth = -1;
if (oldwidth == -1)
oldwidth = env->window->w;
+ if (buffer->buffer && !buffer->buffer[0])
+ oldbuffer_pos = 0;
int y = env->window->y - (oldbuffer_pos + buffer->startx) / oldwidth;
int newy = y + (buffer->pos + buffer->startx) / env->window->w;