GNU bug report logs - #11261
24.1.50; cursor doesn't move in a long line

Previous Next

Package: emacs;

Reported by: Katsumi Yamaoka <yamaoka <at> jpl.org>

Date: Mon, 16 Apr 2012 23:42:02 UTC

Severity: normal

Found in version 24.1.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11261 in the body.
You can then email your comments to 11261 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11261; Package emacs. (Mon, 16 Apr 2012 23:42:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Katsumi Yamaoka <yamaoka <at> jpl.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 16 Apr 2012 23:42:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.1.50; cursor doesn't move in a long line
Date: Tue, 17 Apr 2012 08:40:40 +0900
Hi,

When I view an html source, of which lines are very long, I meet
with a symptom that C-f, C-b, and so forth don't move the cursor.
One discovered yesterday that it happens only when the header line
exists in a buffer (we use emacs-w3m that ises the header line for
the tab browsing).  Here's a recipe to reproduce this with Emacs -Q:

(let ((fox "The quick brown fox jumps over the lazy dog."))
  (pop-to-buffer "*testing*")
  (erase-buffer)
  (setq header-line-format fox)
  (dotimes (var 1000)
    (insert fox "  "))
  (goto-char (point-min))
  (search-forward "fox" nil t 500))

Could this be fixed?

Thanks in advance.
Regards,




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11261; Package emacs. (Tue, 17 Apr 2012 03:00:02 GMT) Full text and rfc822 format available.

Message #8 received at 11261 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Katsumi Yamaoka <yamaoka <at> jpl.org>
Cc: 11261 <at> debbugs.gnu.org
Subject: Re: bug#11261: 24.1.50; cursor doesn't move in a long line
Date: Tue, 17 Apr 2012 05:56:52 +0300
> Date: Tue, 17 Apr 2012 08:40:40 +0900
> From: Katsumi Yamaoka <yamaoka <at> jpl.org>
> 
> (let ((fox "The quick brown fox jumps over the lazy dog."))
>   (pop-to-buffer "*testing*")
>   (erase-buffer)
>   (setq header-line-format fox)
>   (dotimes (var 1000)
>     (insert fox "  "))
>   (goto-char (point-min))
>   (search-forward "fox" nil t 500))
> 
> Could this be fixed?

This is a clear regression, so I will look into it ASAP.

Thanks.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Tue, 17 Apr 2012 15:32:02 GMT) Full text and rfc822 format available.

Notification sent to Katsumi Yamaoka <yamaoka <at> jpl.org>:
bug acknowledged by developer. (Tue, 17 Apr 2012 15:32:02 GMT) Full text and rfc822 format available.

Message #13 received at 11261-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: yamaoka <at> jpl.org
Cc: 11261-done <at> debbugs.gnu.org
Subject: Re: bug#11261: 24.1.50; cursor doesn't move in a long line
Date: Tue, 17 Apr 2012 18:29:22 +0300
> Date: Tue, 17 Apr 2012 05:56:52 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 11261 <at> debbugs.gnu.org
> 
> > Date: Tue, 17 Apr 2012 08:40:40 +0900
> > From: Katsumi Yamaoka <yamaoka <at> jpl.org>
> > 
> > (let ((fox "The quick brown fox jumps over the lazy dog."))
> >   (pop-to-buffer "*testing*")
> >   (erase-buffer)
> >   (setq header-line-format fox)
> >   (dotimes (var 1000)
> >     (insert fox "  "))
> >   (goto-char (point-min))
> >   (search-forward "fox" nil t 500))
> > 
> > Could this be fixed?
> 
> This is a clear regression, so I will look into it ASAP.

Fixed in revision 107846 on the emacs-24 branch.  The patch is below,
if you don't want to wait for the next pretest.

Thanks.

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2012-04-13 18:08:18 +0000
+++ src/ChangeLog	2012-04-17 15:25:17 +0000
@@ -1,3 +1,14 @@
+2012-04-17  Eli Zaretskii  <eliz <at> gnu.org>
+
+	* xdisp.c (string_buffer_position_lim): Limit starting position to
+	BEGV.
+	(set_cursor_from_row): If called for a mode-line or header-line
+	row, return zero immediately.
+	(try_cursor_movement): If inside continuation line, don't back up
+	farther than the first row after the header line, if any.  Don't
+	consider the header-line row as "partially visible", even if
+	MATRIX_ROW_PARTIALLY_VISIBLE_P returns non-zero.  (Bug#11261)
+
 2012-04-13  Atsuo Ohki  <ohki <at> gssm.otsuka.tsukuba.ac.jp>  (tiny change)
 
 	* lread.c (lisp_file_lexically_bound_p): Fix hang at ";-*-\n" (bug#11238).

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2012-04-09 12:46:34 +0000
+++ src/xdisp.c	2012-04-17 15:25:17 +0000
@@ -4979,7 +4979,7 @@ string_buffer_position_lim (Lisp_Object 
   Lisp_Object limit, prop, pos;
   int found = 0;
 
-  pos = make_number (from);
+  pos = make_number (max (from, BEGV));
 
   if (!back_p)	/* looking forward */
     {
@@ -13690,6 +13690,13 @@ set_cursor_from_row (struct window *w, s
      comes from a text property, not from an overlay.  */
   int string_from_text_prop = 0;
 
+  /* Don't even try doing anything if called for a mode-line or
+     header-line row, since the rest of the code isn't prepared to
+     deal with such calamities.  */
+  xassert (!row->mode_line_p);
+  if (row->mode_line_p)
+    return 0;
+
   /* Skip over glyphs not having an object at the start and the end of
      the row.  These are special glyphs like truncation marks on
      terminal frames.  */
@@ -14906,6 +14913,8 @@ try_cursor_movement (Lisp_Object window,
 	  else if (rc != CURSOR_MOVEMENT_SUCCESS
 		   && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)))
 	    {
+	      struct glyph_row *row1;
+
 	      /* If rows are bidi-reordered and point moved, back up
 		 until we find a row that does not belong to a
 		 continuation line.  This is because we must consider
@@ -14916,24 +14925,28 @@ try_cursor_movement (Lisp_Object window,
 	      /* FIXME: Revisit this when glyph ``spilling'' in
 		 continuation lines' rows is implemented for
 		 bidi-reordered rows.  */
-	      while (MATRIX_ROW_CONTINUATION_LINE_P (row))
+	      for (row1 = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
+		   MATRIX_ROW_CONTINUATION_LINE_P (row);
+		   --row)
 		{
 		  /* If we hit the beginning of the displayed portion
 		     without finding the first row of a continued
 		     line, give up.  */
-		  if (row <= w->current_matrix->rows)
+		  if (row <= row1)
 		    {
 		      rc = CURSOR_MOVEMENT_MUST_SCROLL;
 		      break;
 		    }
 		  xassert (row->enabled_p);
-		  --row;
 		}
 	    }
 	  if (must_scroll)
 	    ;
 	  else if (rc != CURSOR_MOVEMENT_SUCCESS
 	      && MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)
+	      /* Make sure this isn't a header line by any chance, since
+		 then MATRIX_ROW_PARTIALLY_VISIBLE_P might yield non-zero.  */
+	      && !row->mode_line_p
 	      && make_cursor_line_fully_visible_p)
 	    {
 	      if (PT == MATRIX_ROW_END_CHARPOS (row)





Message #14 received at 11261-done <at> debbugs.gnu.org (full text, mbox):

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 11261-done <at> debbugs.gnu.org
Subject: Re: bug#11261: 24.1.50; cursor doesn't move in a long line
Date: Wed, 18 Apr 2012 07:21:55 +0900
Eli Zaretskii wrote:
> Fixed in revision 107846 on the emacs-24 branch.  The patch is below,
> if you don't want to wait for the next pretest.

Thank you for fixing this so quickly.  I started a daily work,
that is to bootstrap the fresh Emacs trunk, having applied a patch.
(It takes 2~3 hours on Cygwin even in a very fast PC. :<)




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 16 May 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 4 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.