From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#43519: 28.0.50; Overlay at end of minibuf hides minibuf's real content Date: Mon, 21 Sep 2020 06:50:22 +0000 Message-ID: References: <83wo0p1twr.fsf@gnu.org> <83r1qx1q9v.fsf@gnu.org> <838sd425l2.fsf@gnu.org> Reply-To: Gregory Heytings Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23487"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Alpine 2.22 (NEB 394 2020-01-19) Cc: Stefan Monnier , 43519@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 21 08:51:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kKFfM-0005zP-HT for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Sep 2020 08:51:12 +0200 Original-Received: from localhost ([::1]:41752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKFfL-0002n7-EX for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Sep 2020 02:51:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54148) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKFfC-0002mw-B4 for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2020 02:51:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41622) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kKFfC-0005XR-1G for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2020 02:51:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kKFfB-0007PV-UB for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2020 02:51:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Sep 2020 06:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43519 X-GNU-PR-Package: emacs Original-Received: via spool by 43519-submit@debbugs.gnu.org id=B43519.160067103028444 (code B ref 43519); Mon, 21 Sep 2020 06:51:01 +0000 Original-Received: (at 43519) by debbugs.gnu.org; 21 Sep 2020 06:50:30 +0000 Original-Received: from localhost ([127.0.0.1]:53168 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kKFef-0007Oh-Ou for submit@debbugs.gnu.org; Mon, 21 Sep 2020 02:50:29 -0400 Original-Received: from mx.sdf.org ([205.166.94.24]:55762) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kKFec-0007OX-Dp for 43519@debbugs.gnu.org; Mon, 21 Sep 2020 02:50:27 -0400 Original-Received: from sdf.org (IDENT:ghe@faeroes.freeshell.org [205.166.94.9]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 08L6oO5K005900 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Mon, 21 Sep 2020 06:50:25 GMT Original-Received: (from ghe@localhost) by sdf.org (8.15.2/8.12.8/Submit) id 08L6odG2027477; Mon, 21 Sep 2020 06:50:39 GMT In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:188554 Archived-At: > > What I would suggest is to add a user option to set start to BEGV when > height > max_height, which is what is needed here. It would be reset to > nil in read_minibuf() before calling minibuffer-setup-hook, and would be > used in resize_mini_window() as follows: > > /* Compute a suitable window start. */ > if (height > max_height && !EQ (Vstart_display_at_beginning_of_minibuffer, Qt)) > > This would not break any existing behavior. Would this be a good way to > solve that problem? > After further testing, doing this is not enough, because it is necessary to update height even when start_display_at_beginning_of_minibuffer. So the code should be: if (height > max_height && !EQ (Vstart_display_at_beginning_of_minibuffer, Qt)) { ... } else { if (height > max_height) height = (max_height / unit) * unit; SET_TEXT_POS (start, BEGV, BEGV_BYTE); } Another note to answer Eli's previous questions: > > . Define in more detail what situations we would like to fix in the > display code, so that we could install special ad-hoc changes > there to handle those situations. For example: is it true that in > all of these situations starting the mini-window display at BOB > would DTRT? If so, I think this could be arranged. If not, why > not, and what is the more correct definition of the situations we > want to handle? > It is "true that in all of these situations starting the mini-window display at BOB would DTRT", but it is also true that in all of these situations the height overflow is due to an overlay at EOB. So another solution, which I think would be even better, but might change the existing behavior marginally, would be to calculate the height two times, once at EOB and once at EOB-1. With this Emacs would detect by itself the situations in which it is better to show the first max-mini-window-height lines instead of the last max-mini-window-height lines, and it would not be necessary to explicitly set a variable in minibuffer-setup-hook. The code would be: if (it.line_wrap == TRUNCATE) height_near_eob = height = unit; else { last_height = 0; move_it_to (&it, ZV - 1, -1, -1, -1, MOVE_TO_POS); if (it.max_ascent == 0 && it.max_descent == 0) height_near_eob = it.current_y + last_height; else height_near_eob = it.current_y + it.max_ascent + it.max_descent; height_near_eob -= min (it.extra_line_spacing, it.max_extra_line_spacing); move_it_to (&it, ZV, -1, -1, -1, MOVE_TO_POS); ... } if (height > max_height && height_near_eob > max_height) { ... } else { if (height > max_height) height = (max_height / unit) * unit; SET_TEXT_POS (start, BEGV, BEGV_BYTE); }