master a807411c752 11/12: Merge from origin/emacs-31

Eli Zaretskii <[email protected]>
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: master
commit a807411c752ea0ed631f18dd983a6aa837395523
Merge: 6db6231536d 6a6a578c389
Author: Eli Zaretskii <[email protected]>
Commit: Eli Zaretskii <[email protected]>

    Merge from origin/emacs-31
    
    6a6a578c389 ; * etc/PROBLEMS: Problems with resizing frames on Waylan...
    165152e7cdc Fix an infloop during cursor movement
    e435a8e8692 Merge branch 'emacs-31' of git.savannah.gnu.org:/srv/git/...
    57e9e94be9b ; etc/NEWS: Minor reordering.
    c5a9ed14990 vc-dir: Set major mode before popping to the buffer
    aae4cb25da5 hs-hide-block-behavior: Fix some terminology
    2b47d719225 Backport: Fix freeze in NS event handling (bug#81510)
---
 etc/PROBLEMS | 17 +++++++++++++++++
 src/xdisp.c  | 10 +++++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index 64cf1576c5a..96b9e3df18a 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -498,6 +498,23 @@ support for those formats by default, so you might need to install
 additional support packages.  E.g., on Fedora you need to install the
 'gdk-pixbuf2-modules-extra' package.
 
+*** Resizing frames of GTK Emacs does not work on Wayland running on X11.
+
+This was reported with KDE Plasma, which recently is based on Wayland
+exclusively (as is GNOME).  The default character-wise resizing of the
+frame depends on whether the window manager is willing to process the
+hints provided by Emacs; evidently, Wayland-based window managers no
+longer do.
+
+One workaround is to customize frame-resize-pixelwise to a non-nil
+value.  Another workaround is to add a window rule in KDE Plasma's
+System Settings (under "Window Management->Application settings for
+Emacs->Size and Position") that forces KDE Plasma to obey geometry
+restrictions.
+
+Yet another solution is to use the PGTK build of Emacs, which works
+better on Wayland.
+
 ** Lisp problems
 
 *** Changes made to .el files do not take effect.
diff --git a/src/xdisp.c b/src/xdisp.c
index beb8d980ee3..5ab9bf9809e 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -11316,10 +11316,18 @@ move_it_vertically_backward (struct it *it, int dy)
      y-distance.  */
   SAVE_IT (it2, *it, it2data);
   it2.max_ascent = it2.max_descent = 0;
+  ptrdiff_t to_pos = start_pos;
   do
     {
+      /* Avoid inflooping of there's a large display string with several
+         embedded newlines, which makes move_it_to stop after START_POS
+         but still inside a display or overlay string.  */
+      if (IT_CHARPOS (it2) >= start_pos)
+	to_pos = -1;
       move_it_to (&it2, start_pos, -1, -1, it2.vpos + 1,
-		  MOVE_TO_POS | MOVE_TO_VPOS);
+		  (to_pos > 0
+		    ? (MOVE_TO_POS | MOVE_TO_VPOS)
+		   : MOVE_TO_VPOS));
     }
   while (!(IT_POS_VALID_AFTER_MOVE_P (&it2)
 	   /* If we are in a display string which starts at START_POS,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.