Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID
	autolearn=ham autolearn_force=no version=3.4.1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=brasslantern-com.20150623.gappssmtp.com; s=20150623;
        h=from:message-id:date:in-reply-to:comments:references:to:subject
         :mime-version;
        bh=onw2TNow33rgodzugan4yAsQLlgl8RmUXiZulmgWtrc=;
        b=AgfvjGds1p4PLu0HdHlT/n5swzx3PDJm8Yw/7tMaxbnPcfleLvuelZALK5l1MRIQhU
         XNTuCgbjkD+Qm/WMS69VJKYdbLXnhVzKdEA6N2Y1mh7RAsEmeXd66jyPovSEBNblzn2k
         pbid2EczbbIv5E4Ufez86pS1I2qMu574vvP4A4ExlJwBYMrw/BGXf1ZuWhJcF1LgBDmr
         hOCOH19BlDaT+IxAQbb9wlNbSkaACyWKNP5Wi8XCjZ6FkyUseG3clvaubfO3yo8Q5d93
         ViL5j26H82cV3fhuwdxh9qC2rFEKMOOy7TRxop8bhchsfcCaVUVYSBSGMQC6CSG7yCKK
         p0Og==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:message-id:date:in-reply-to:comments
         :references:to:subject:mime-version;
        bh=onw2TNow33rgodzugan4yAsQLlgl8RmUXiZulmgWtrc=;
        b=QqOHg/MRkP0/0H3I6mKXu3vTIRFnRFr4KAqKr+gpR52KEuWQhT+2002qv257JyfMsa
         gyGWOdf+xIpDFJ3J9M4Dzq27BrE7ULaRkinx3iP4Z5PZRMtVl1KDByzaU6ehNxe1OAOC
         AUbPVhNS8qJIhzkg1/6dNI0LgZfbAE9HwzoVsgSJLw+g1syJMCN8GOpXY0i2Z9kHDOza
         /arbA2NcuKJn0+ao+rR7XY1TEPzl/r2f3u6xw4Xv6z6dpTzgjl+JYzLR34x3m32TIJYL
         udDteVmTyDAd1iwirX8TbW1ewZQpEySXvoz02KEyv6AByMx8Xe+lQM4Dmw/gie3H0dsk
         j0Vg==
X-Gm-Message-State: AD7BkJKRikVg59wAv/TGRlsIMvSVtQ94ODOvUoDMNr3sJ/KKL5SdOQNCd8NAlng2KbhvrQ==
X-Received: by 10.98.32.18 with SMTP id g18mr10882464pfg.116.1456771634845;
        Mon, 29 Feb 2016 10:47:14 -0800 (PST)
From: Bart Schaefer <schaefer@brasslantern.com>
Message-Id: <160229104724.ZM4162@torch.brasslantern.com>
Date: Mon, 29 Feb 2016 10:47:24 -0800
In-Reply-To: <20160228135652.GB2953@master>
Comments: In reply to Joe M <joe9mail@gmail.com>
        "Re: Behaviour of zle list-choices" (Feb 28,  7:56am)
References: <CAHjjW16S5=2=qQrRhZUtgFOC5GUW28SnMHcqa=yCDk7Mdap2eA@mail.gmail.com> 
	<56CFC947.1080507@gmx.com>  <20160228134000.GA2953@master> 
	<20160228135652.GB2953@master>
X-Mailer: OpenZMail Classic (0.9.2 24April2005)
To: zsh-workers@zsh.org, Joe M <joe9mail@gmail.com>
Subject: Signal handlers and Re: Behaviour of zle list-choices
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Seq: zsh-workers 38048

On Feb 28,  7:56am, Joe M wrote:
}
} > type -a -f TRAPINT
} > TRAPINT () {
} >         ft_zle_state[minibuffer]=no
} >         ft-psvx-default
} >         zle reset-prompt 2> /dev/null
} >         return 127
} > }
} 
} Thanks for your suggestion. Removing the above TRAPINT fixed the
} issue that I am noticing.

OK, that helps.  The problem is with calling reset-prompt (really,
with calling redisplay, which is implied by reset-prompt) from the
signal handler.  The change to resetneeded and clearflag during the
handler causes ZLE to attempt twice to erase the list and move the
cursor back to the start of the prompt, which ends up moving too far
(though only erasing the list once, oddly enough).  It's as though
ZLE gets confused about the state of ALWAYS_LAST_PROMPT.

The following appears to fix it, though I only vaguely understand why.
Anyone care to shed some additional light before this gets committed?

diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 7e4f328..aca676a 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -2435,8 +2435,8 @@ redisplay(UNUSED(char **args))
     moveto(0, 0);
     zputc(&zr_cr);		/* extra care */
     tc_upcurs(lprompth - 1);
-    resetneeded = 1;
-    clearflag = 0;
+    resetneeded = !showinglist;
+    clearflag = showinglist;
     return 0;
 }
 

