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:content-type;
        bh=Th0r0qeiNgI0TCMQK9YuA++V0NHKQJLhtquW+nky01w=;
        b=cAbfD4uLqLIrcCg50ZSAy6jty2zLiIFiYSKhYtE6dK9ozUePaTNRBcvQ8E3mnE82CK
         hBSH2pfqklK3a9qbRFizF/1f0HENZGAcecYAQQlL/th8i5NIeM+9kEX1CQsrDApoTCBg
         htNgM7FeBTEe/QULrPUHMN3j+sx/PElZtlzbmDUS83WtL8fBq6BiFM1M4J6F40NE/Eiz
         Im215KK1nQJUfsXKsgp8RKbNBsVRGk3dC/3xzB6OHTTxzaQTRYAXqBnJTjf41YzAayZI
         5+eQPDzuAlM3D4R0Gt7tFTSnoqXfJi/jjzWRqW/tb7IkriFWa8EH/T6giZFePucjEYKc
         Am9w==
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:content-type;
        bh=Th0r0qeiNgI0TCMQK9YuA++V0NHKQJLhtquW+nky01w=;
        b=gOTB9tlkgDvojjvoIM6R6p1J50cD7WLiyi7y3494yf0UP90inl92NdbCMpXb50B9Uz
         oHq2MmrycF50B5DoGL42GKDvg64qgz+4VVhDGJyw1+1BopmYHIeJdvfhgo/IrRY/0rJv
         B7ndmgA9qo9ehstri9AYs/ZJc96QtIoOwRF/ijscFaMCpqUJYxKfF0RylQt9YAJTBh6K
         SE/9HWt2gy96AYaVXKqIehhhAyB4q2w/SgGGncbE9kbtHVa3MF/mbsZUVX0RMAJMhQff
         2b7dxkn88+zPsgPn3kz7IZRdfS/dOPEEKGPGi4j2/AK4wZzJj8KAlKcq1WHZaWMMs5Q+
         necA==
X-Gm-Message-State: AG10YOT47aNJeAvAqP6sf43VF0EnDAyJBdP8GVapx/MdB7i7JCZ69qqrcMxyFhQtm+U2pQ==
X-Received: by 10.98.32.150 with SMTP id m22mr32928407pfj.27.1455648210757;
        Tue, 16 Feb 2016 10:43:30 -0800 (PST)
From: Bart Schaefer <schaefer@brasslantern.com>
Message-Id: <160216104351.ZM31803@torch.brasslantern.com>
Date: Tue, 16 Feb 2016 10:43:51 -0800
In-Reply-To: <20160216100140.GA27569@cventin.lip.ens-lyon.fr>
Comments: In reply to Vincent Lefevre <vincent@vinc17.net>
        "Re: clear-screen widget and prompt expansion" (Feb 16, 11:01am)
References: <20160204141206.GA9349@cventin.lip.ens-lyon.fr> 
	<160204073731.ZM25972@torch.brasslantern.com> 
	<20160216100140.GA27569@cventin.lip.ens-lyon.fr>
X-Mailer: OpenZMail Classic (0.9.2 24April2005)
To: zsh-workers@zsh.org
Subject: Re: clear-screen widget and prompt expansion
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Seq: zsh-workers 38001

On Feb 16, 11:01am, Vincent Lefevre wrote:
}
} I meant that prompt is already re-expanded when the terminal is
} resized. What I'm saying is that clear-screen is not consistent
} with that.

Ah.  Well, clear-screen is a widget and existed in primordial form
long before the shell even knew about SIGWINCH, so it's not very
surprising that it hasn't been overhauled with more recent changes
to prompt handling.

This raises the question of whether redisplay (^R) should also imply
a reset-prompt.  However, it explicitly says "the edit buffer" whereas
clear-screen mentions "redraw the prompt".

}   zle -A clear-screen real-clear-screen
}   cls-rp() { zle real-clear-screen; zle reset-prompt }
}   zle -N clear-screen cls-rp
} 
} [...] doesn't work in incremental search mode

That's because incremental-search has its own input loop and does not
recognize user-defined widgets.  An entirely different problem.

Does the following break anything?


diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 3d2471e..7e4f328 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -2424,6 +2424,7 @@ clearscreen(UNUSED(char **args))
     tcoutclear(TCCLEARSCREEN);
     resetneeded = 1;
     clearflag = 0;
+    reexpandprompt();
     return 0;
 }
 

