Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] move the cursor up only when redisplay is called the first time
- X-seq: zsh-workers 43394
- From: Yao-Wen Mao <leomaoyw@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] move the cursor up only when redisplay is called the first time
- Date: Thu, 6 Sep 2018 11:47:10 +0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=ZzfOYBv6tlIYJAN8H5xlFvMdW7klfirQkMQTbzlRMgQ=; b=c/LCc9t/ADGJasb5nIcUkPxOJjOePWl3Cz+jDu+dX+qHUi6Ko96GlXTgaxayzGAfvG 9jeB4mF06EBDb+mgL2TyUoG4aEHRXDsxZPE1zNHdcEwr2/0JCdfsV7BUbnQVsOG1NJ+F WjvRQo3M/+Xrx34VSxoVMSRZhQJc5T8gc3ZB+NqeK8z+DvMzVFpp4KFTJC52ApcW+Dzc lPM/zy3T6FWu81IQz5TZ/AZIqOprSAeHv3dxIWK6tJZU3tFqkLmI611OWNkG1o8usKrM sg8XTU85lGtN+vzyUMOMxQiU8p0cNNAr1Gje7OiaRb0sETRQTG4hqqmp0yLVluf3JwZd c9lw==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Last year I found an issue about reset-prompt with multiline prompt.
(Thread: `reset-prompt` multiple times cause multiline PROMPT redraw in the
wrong place)
When using mutliline prompt, ` lprompth` will be greater than 1. Now if
`redisplay` in zle_refresh.c is called multiple times without calling
`resetvideo`, then the cursor position will move to the wrong place.
To verify this, I create an ugly fix and rebuild to check that the problem
is gone. I add a flag `cursor_moved` to make sure that the cursor will only
move once before calling `resetvideo`.
I think this may not be a proper fix, is there anyone can help me to create
a better fix?
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index d0dd1ef06..1d1b2526e 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -210,6 +210,8 @@ int predisplaylen, postdisplaylen;
static int default_atr_on, special_atr_on;
+static int cursor_moved;
+
/*
* Array of region highlights, no special termination.
* The first element (0) always describes the region between
@@ -771,6 +773,8 @@ resetvideo(void)
if (showinglist > 0)
showinglist = -2;
trashedzle = 0;
+
+ cursor_moved = 0;
}
/*
@@ -2433,7 +2437,9 @@ redisplay(UNUSED(char **args))
{
moveto(0, 0);
zputc(&zr_cr); /* extra care */
- tc_upcurs(lprompth - 1);
+ if (!cursor_moved)
+ tc_upcurs(lprompth - 1);
+ cursor_moved = 1;
resetneeded = 1;
clearflag = 0;
return 0;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author