From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#43519: 28.0.50; Overlay at end of minibuf hides minibuf's real content Date: Wed, 23 Sep 2020 14:35:00 -0400 Message-ID: References: <83wo0p1twr.fsf@gnu.org> <83r1qx1q9v.fsf@gnu.org> <838sd425l2.fsf@gnu.org> <83y2l3xm15.fsf@gnu.org> <83eemvxbvg.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34665"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 43519@debbugs.gnu.org To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 23 20:50:59 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 1kL9r0-0008uJ-W3 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 23 Sep 2020 20:50:59 +0200 Original-Received: from localhost ([::1]:40962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kL9qz-0000cT-Vc for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 23 Sep 2020 14:50:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kL9cY-0002b7-67 for bug-gnu-emacs@gnu.org; Wed, 23 Sep 2020 14:36:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54518) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kL9cX-0001WI-Rh for bug-gnu-emacs@gnu.org; Wed, 23 Sep 2020 14:36:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kL9cX-0006Bx-NO for bug-gnu-emacs@gnu.org; Wed, 23 Sep 2020 14:36:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 23 Sep 2020 18:36: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.160088611123702 (code B ref 43519); Wed, 23 Sep 2020 18:36:01 +0000 Original-Received: (at 43519) by debbugs.gnu.org; 23 Sep 2020 18:35:11 +0000 Original-Received: from localhost ([127.0.0.1]:37831 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kL9bi-0006AE-Lz for submit@debbugs.gnu.org; Wed, 23 Sep 2020 14:35:10 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:39075) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kL9bh-00069v-6g for 43519@debbugs.gnu.org; Wed, 23 Sep 2020 14:35:09 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id C31EC809C7; Wed, 23 Sep 2020 14:35:03 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id EE4588005D; Wed, 23 Sep 2020 14:35:01 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1600886101; bh=79AbYZvE5BQyBG2omTxfMu+A+EMea5y+1t7FnB2wQ6k=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=LyD/bJsDNXntd1Aq37uLJW/eicMojCilavgxH6jTOofHNbDV9OkjpHnG61/rxfq2X qchVZugXTYacg6PlAdicFYSa520nL4TbUSfGx8Za9voxlVdnZ566zKKTlLYazNLJ6t ECtTgt1Va1LHZo7BDNPEQtsJR40i9Kg6RxmIy4N7eqjBJV5+u3lfS7IVLge1slWnev CudH79von4sdckQ6xW71jBzfTgAYguSOWVF7PcwR/6kcYms4uTJSZ3HTJxiTWy0CG8 0d9Y/z9BM1nRUcoENc8xzj0tq4cptA9OTeGkkcZQuyWiLKwnU7yD+a+P1xgvtpu5Zr Vwvxp/hcUG8vA== Original-Received: from alfajor (unknown [45.72.232.131]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B766012051B; Wed, 23 Sep 2020 14:35:01 -0400 (EDT) In-Reply-To: (Gregory Heytings's message of "Mon, 21 Sep 2020 20:49:05 +0000") 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:188821 Archived-At: >>> IOW, you leave it entirely to the generic window-display code to select >>> window-start based just on the value of point? >> Yes. It seems to work very well. Even the corner case regression above >> doesn't seem very serious and can be addressed using the >> scroll_conservatively code. > A last note: w->start has already been set to its default value (BEGV) just > after entering resize_mini_window(), so the else part in your patch is not > necessary anymore. Your code has the same effect as simply doing: > if (height > max_height) height = (max_height / unit) * unit; > in place of the "Compute a suitable window start" part. Indeed, except that I (later) also removed that setting of w->start. Stefan diff --git a/src/xdisp.c b/src/xdisp.c index c05f97173d..c73212174a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -11799,10 +11799,10 @@ resize_mini_window_1 (void *a1, Lisp_Object exactly) means size the window exactly to the size needed. Otherwise, it's only enlarged until W's buffer is empty. - Set W->start to the right place to begin display. If the whole - contents fit, start at the beginning. Otherwise, start so as - to make the end of the contents appear. This is particularly - important for y-or-n-p, but seems desirable generally. + If the whole contents fit, set W->start at the beginning. + Otherwise, let redisplay do its thing to make sure point is displayed, + so we can control which part is more important by placing point + accordingly. Value is true if the window height has been changed. */ @@ -11824,9 +11824,10 @@ resize_mini_window (struct window *w, bool exact_p) return false; /* By default, start display at the beginning. */ - set_marker_both (w->start, w->contents, - BUF_BEGV (XBUFFER (w->contents)), - BUF_BEGV_BYTE (XBUFFER (w->contents))); + /* bug#43519: Let the redisplay choose the window start! + * set_marker_both (w->start, w->contents, + * BUF_BEGV (XBUFFER (w->contents)), + * BUF_BEGV_BYTE (XBUFFER (w->contents))); */ /* Nil means don't try to resize. */ if ((NILP (Vresize_mini_windows) @@ -11885,24 +11886,18 @@ resize_mini_window (struct window *w, bool exact_p) if (height > max_height) { height = (max_height / unit) * unit; - init_iterator (&it, w, ZV, ZV_BYTE, NULL, DEFAULT_FACE_ID); - move_it_vertically_backward (&it, height - unit); - /* The following move is usually a no-op when the stuff - displayed in the mini-window comes entirely from buffer - text, but it is needed when some of it comes from overlay - strings, especially when there's an after-string at ZV. - This happens with some completion packages, like - icomplete, ido-vertical, etc. With those packages, if we - don't force w->start to be at the beginning of a screen - line, important parts of the stuff in the mini-window, - such as user prompt, will be hidden from view. */ - move_it_by_lines (&it, 0); - start = it.current.pos; + /* bug#43519: Let the redisplay choose the window start! + * + * init_iterator (&it, w, ZV, ZV_BYTE, NULL, DEFAULT_FACE_ID); + * move_it_vertically_backward (&it, height - unit); + * start = it.current.pos; */ } else - SET_TEXT_POS (start, BEGV, BEGV_BYTE); + { + SET_TEXT_POS (start, BEGV, BEGV_BYTE); - SET_MARKER_FROM_TEXT_POS (w->start, start); + SET_MARKER_FROM_TEXT_POS (w->start, start); + } if (EQ (Vresize_mini_windows, Qgrow_only)) { @@ -18923,6 +18918,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) /* Try to scroll by specified few lines. */ if ((0 < scroll_conservatively + || MINI_WINDOW_P (w) || 0 < emacs_scroll_step || temp_scroll_step || NUMBERP (BVAR (current_buffer, scroll_up_aggressively)) @@ -18933,7 +18929,9 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) /* The function returns -1 if new fonts were loaded, 1 if successful, 0 if not successful. */ int ss = try_scrolling (window, just_this_one_p, - scroll_conservatively, + (MINI_WINDOW_P (w) + ? SCROLL_LIMIT + 1 + : scroll_conservatively), emacs_scroll_step, temp_scroll_step, last_line_misfit); switch (ss)