unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11133: 24.0.94; Cursor gets "stuck" on an indented line with wrapped overlay
@ 2012-03-30 14:47 Ivan Andrus
  2012-03-30 16:12 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Ivan Andrus @ 2012-03-30 14:47 UTC (permalink / raw)
  To: 11133

Put the following (including comments) in a buffer and evaluate.

#+begin_src emacs-lisp
;; Note that the next line is indented
 ;; This buffer is for notes you don't want to save, and for Lisp evaluation.;; If you want to create a file, visit that file with C-x C-f,;; then enter the text in that file's own buffer.

;; evaluate this
(let ((ov (make-overlay
	   (progn (goto-char (point-min))
		  (forward-line)
		  (back-to-indentation)
		  (point))
	   (progn (end-of-line)
		  (point))
	   nil t nil)))
 (overlay-put ov 'display
	       (make-string 500 ?b)))

#+end_src

Now run `previous-line' several times and it will get stuck at the
indentation of the bbbbb line.  If you have an extremely wide screen you
may need to shrink the emacs window so that the bbbb line wraps.  Also
note that running `previous-line' with a large prefix-argument will
move past the line, and once it is stuck, running with a prefix-argument of 2 or
greater will allow you to move past.

FWIW, I ran into this while writing a LaTeX file with preview-mode and a
large equation that wrapped on my screen.

This does not seem to be a problem in Emacs 22.1.1 in a terminal which
is the only other emacs I have easy access to.

Thanks,
Ivan

In GNU Emacs 24.0.94.10 (i386-apple-darwin10.8.0, NS apple-appkit-1038.36)
of 2012-03-30 on oroszlan.local
Windowing system distributor `Apple', version 10.3.1038
Configured using:
`configure '--with-ns' '-C''

Important settings:
 value of $LC_ALL: nil
 value of $LC_COLLATE: nil
 value of $LC_CTYPE: UTF-8
 value of $LC_MESSAGES: nil
 value of $LC_MONETARY: nil
 value of $LC_NUMERIC: nil
 value of $LC_TIME: nil
 value of $LANG: nil
 value of $XMODIFIERS: nil
 locale-coding-system: utf-8-unix
 default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
 tooltip-mode: t
 mouse-wheel-mode: t
 tool-bar-mode: t
 menu-bar-mode: t
 file-name-shadow-mode: t
 global-font-lock-mode: t
 font-lock-mode: t
 blink-cursor-mode: t
 auto-composition-mode: t
 auto-encryption-mode: t
 auto-compression-mode: t
 line-number-mode: t
 transient-mark-mode: t

Recent input:
f i x SPC <backspace> - a r g u m e n t SPC o f SPC 
2 SPC o r SPC g r e a t e r SPC w i l l SPC a l l o 
w y <backspace> SPC SPC y o u SPC t o SPC m o v e SPC 
p a s t <C-left> <C-left> <C-left> <C-left> <backspace> 
C-e . <C-up> C-x C-e <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <down> <down> <down> 
<down> <down> <C-down> X E <backspace> <backspace> 
C-x C-e <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <down> <down> 
<down> <down> <up> <up> <up> <up> <up> <up> <up> <up> 
<down> <down> <down> <down> <down> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <down> <down> C-3 <C-up> 
<down> <down> <down> C-3 <C-up> <down> <down> <down> 
C-2 <C-up> <down> <down> <down> <down> <C-up> <down> 
<down> <down> <down> <up> C-e C-2 <C-up> <down> <down> 
<down> C-e C-2 <C-up> <down> <down> <down> <down> <up> 
C-2 <C-up> <down-mouse-1> <mouse-1> <down-mouse-1> 
<mouse-movement> <mouse-movement> <drag-mouse-1> C-w 
<C-right> <C-right> . C-k <backspace> , SPC e v e n 
<C-left> <C-left> <C-left> <C-left> <C-left> ( <backspace> 
<C-right> <C-right> <C-right> <C-right> <C-tab> <C-up> 
<C-tab> <up> <down> C-x C-e <up> <up> <up> <down> C-2 
<up> <up> <up> <down> C-2 <up> <up> <up> <down> C-3 
<up> <up> <up> <down> C-3 <up> <down> C-5 <up> <up> 
<up> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <C-right> <C-right> <C-right> <C-right> <C-right> 
SPC l a r e g <backspace> <backspace> g e <C-right> 
<C-right> <C-right> <C-right> C-k , SPC a n d C-l M-l 
<right> <C-right> <C-right> <C-right> , C-e C-x C-s 
M-x r e p o r <tab> <return>

Recent messages:
byte-code: End of buffer
Undo! [3 times]
Auto-saving...done
byte-code: Beginning of buffer [4 times]
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" [2 times]
byte-code: End of buffer [6 times]
Auto-saving...done
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
Saving file /Users/gvol/vcs/emacs/preview-picture-bug.el...
Wrote /Users/gvol/vcs/emacs/preview-picture-bug.el

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr filecache emacsbug message format-spec
rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail regexp-opt rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils vc-hg time-date tooltip
ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process ns multi-tty
emacs)





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#11133: 24.0.94; Cursor gets "stuck" on an indented line with wrapped overlay
  2012-03-30 14:47 bug#11133: 24.0.94; Cursor gets "stuck" on an indented line with wrapped overlay Ivan Andrus
@ 2012-03-30 16:12 ` Eli Zaretskii
  2012-03-30 16:49   ` Ivan Andrus
  2012-04-06 15:48   ` Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2012-03-30 16:12 UTC (permalink / raw)
  To: Ivan Andrus; +Cc: 11133

> From: Ivan Andrus <darthandrus@gmail.com>
> Date: Fri, 30 Mar 2012 16:47:05 +0200
> 
> Put the following (including comments) in a buffer and evaluate.
> 
> #+begin_src emacs-lisp
> ;; Note that the next line is indented
>  ;; This buffer is for notes you don't want to save, and for Lisp evaluation.;; If you want to create a file, visit that file with C-x C-f,;; then enter the text in that file's own buffer.
> 
> ;; evaluate this
> (let ((ov (make-overlay
> 	   (progn (goto-char (point-min))
> 		  (forward-line)
> 		  (back-to-indentation)
> 		  (point))
> 	   (progn (end-of-line)
> 		  (point))
> 	   nil t nil)))
>  (overlay-put ov 'display
> 	       (make-string 500 ?b)))
> 
> #+end_src
> 
> Now run `previous-line' several times and it will get stuck at the
> indentation of the bbbbb line.  If you have an extremely wide screen you
> may need to shrink the emacs window so that the bbbb line wraps.  Also
> note that running `previous-line' with a large prefix-argument will
> move past the line

More accurately, "large enough" is the number of screen lines taken by
the overlay string.  In my case, it was 7.

> This does not seem to be a problem in Emacs 22.1.1 in a terminal which
> is the only other emacs I have easy access to.

This is a bug in visual line movement.  Visual line movement was
introduced in Emacs 23, that's why you don't see this in Emacs 22.  In
Emacs 23, the cursor gets stuck similarly, so this is not a regression
wrt Emacs 23.  Disable line-move-visual with the current 24 trunk, and
the problem will go away in Emacs 24 as well.

I will take a look when I have time.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#11133: 24.0.94; Cursor gets "stuck" on an indented line with wrapped overlay
  2012-03-30 16:12 ` Eli Zaretskii
@ 2012-03-30 16:49   ` Ivan Andrus
  2012-04-06 15:48   ` Eli Zaretskii
  1 sibling, 0 replies; 6+ messages in thread
From: Ivan Andrus @ 2012-03-30 16:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 11133

On Mar 30, 2012, at 6:12 PM, Eli Zaretskii wrote:
>> From: Ivan Andrus <darthandrus@gmail.com>
>> Date: Fri, 30 Mar 2012 16:47:05 +0200
>> 
>> Put the following (including comments) in a buffer and evaluate.
>> 
>> #+begin_src emacs-lisp
>> ;; Note that the next line is indented
>> ;; This buffer is for notes you don't want to save, and for Lisp evaluation.;; If you want to create a file, visit that file with C-x C-f,;; then enter the text in that file's own buffer.
>> 
>> ;; evaluate this
>> (let ((ov (make-overlay
>> 	   (progn (goto-char (point-min))
>> 		  (forward-line)
>> 		  (back-to-indentation)
>> 		  (point))
>> 	   (progn (end-of-line)
>> 		  (point))
>> 	   nil t nil)))
>> (overlay-put ov 'display
>> 	       (make-string 500 ?b)))
>> 
>> #+end_src
>> 
>> Now run `previous-line' several times and it will get stuck at the
>> indentation of the bbbbb line.  If you have an extremely wide screen you
>> may need to shrink the emacs window so that the bbbb line wraps.  Also
>> note that running `previous-line' with a large prefix-argument will
>> move past the line
> 
> More accurately, "large enough" is the number of screen lines taken by
> the overlay string.  In my case, it was 7.
> 
>> This does not seem to be a problem in Emacs 22.1.1 in a terminal which
>> is the only other emacs I have easy access to.
> 
> This is a bug in visual line movement.  Visual line movement was
> introduced in Emacs 23, that's why you don't see this in Emacs 22.  In
> Emacs 23, the cursor gets stuck similarly, so this is not a regression
> wrt Emacs 23.  Disable line-move-visual with the current 24 trunk, and
> the problem will go away in Emacs 24 as well.
> 
> I will take a look when I have time.

That makes sense.

Thanks,
Ivan




^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#11133: 24.0.94; Cursor gets "stuck" on an indented line with wrapped overlay
  2012-03-30 16:12 ` Eli Zaretskii
  2012-03-30 16:49   ` Ivan Andrus
@ 2012-04-06 15:48   ` Eli Zaretskii
  2012-04-07  4:10     ` Stefan Monnier
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2012-04-06 15:48 UTC (permalink / raw)
  To: darthandrus; +Cc: 11133

> Date: Fri, 30 Mar 2012 19:12:10 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 11133@debbugs.gnu.org
> 
> > From: Ivan Andrus <darthandrus@gmail.com>
> > Date: Fri, 30 Mar 2012 16:47:05 +0200
> > 
> > Put the following (including comments) in a buffer and evaluate.
> > 
> > #+begin_src emacs-lisp
> > ;; Note that the next line is indented
> >  ;; This buffer is for notes you don't want to save, and for Lisp evaluation.;; If you want to create a file, visit that file with C-x C-f,;; then enter the text in that file's own buffer.
> > 
> > ;; evaluate this
> > (let ((ov (make-overlay
> > 	   (progn (goto-char (point-min))
> > 		  (forward-line)
> > 		  (back-to-indentation)
> > 		  (point))
> > 	   (progn (end-of-line)
> > 		  (point))
> > 	   nil t nil)))
> >  (overlay-put ov 'display
> > 	       (make-string 500 ?b)))
> > 
> > #+end_src
> > 
> > Now run `previous-line' several times and it will get stuck at the
> > indentation of the bbbbb line.  If you have an extremely wide screen you
> > may need to shrink the emacs window so that the bbbb line wraps.  Also
> > note that running `previous-line' with a large prefix-argument will
> > move past the line
> 
> More accurately, "large enough" is the number of screen lines taken by
> the overlay string.  In my case, it was 7.
> 
> > This does not seem to be a problem in Emacs 22.1.1 in a terminal which
> > is the only other emacs I have easy access to.
> 
> This is a bug in visual line movement.  Visual line movement was
> introduced in Emacs 23, that's why you don't see this in Emacs 22.  In
> Emacs 23, the cursor gets stuck similarly, so this is not a regression
> wrt Emacs 23.  Disable line-move-visual with the current 24 trunk, and
> the problem will go away in Emacs 24 as well.

The problem here is that vertical-motion does not consider the case of
a display string that starts at point and takes more than one screen
line (because it's long).  The patch below plumbs that hole.

Stefan and Chong, please tell me whether to install now or wait until
after the Emacs 24.1 branch is cut.

=== modified file 'src/indent.c'
--- src/indent.c	2012-01-19 07:21:25 +0000
+++ src/indent.c	2012-04-06 15:40:43 +0000
@@ -2021,6 +2021,7 @@ whether or not it is currently displayed
       EMACS_INT it_start;
       int first_x, it_overshoot_count = 0;
       int overshoot_handled = 0;
+      int disp_string_at_start_p = 0;
 
       itdata = bidi_shelve_cache ();
       SET_TEXT_POS (pt, PT, PT_BYTE);
@@ -2035,6 +2036,8 @@ whether or not it is currently displayed
 	{
 	  const char *s = SSDATA (it.string);
 	  const char *e = s + SBYTES (it.string);
+
+	  disp_string_at_start_p = it.string_from_display_prop_p;
 	  while (s < e)
 	    {
 	      if (*s++ == '\n')
@@ -2062,19 +2065,29 @@ whether or not it is currently displayed
       /* IT may move too far if truncate-lines is on and PT lies
 	 beyond the right margin.  IT may also move too far if the
 	 starting point is on a Lisp string that has embedded
-	 newlines.  In these cases, backtrack.  */
+	 newlines, or spans several screen lines.  In these cases,
+	 backtrack.  */
       if (IT_CHARPOS (it) > it_start)
 	{
-	  /* We need to backtrack also if the Lisp string contains no
-	     newlines, but there is a newline right after it.  In this
-	     case, IT overshoots if there is an after-string just
-	     before the newline.  */
-	  if (it_overshoot_count < 0
-	      && it.method == GET_FROM_BUFFER
-	      && it.c == '\n')
-	    it_overshoot_count = 1;
-	  if (it_overshoot_count > 0)
-	    move_it_by_lines (&it, -it_overshoot_count);
+	  if (it_overshoot_count < 0)
+	    {
+	      /* We need to backtrack also if the Lisp string contains
+		 no newlines, but there is a newline right after it.
+		 In this case, IT overshoots if there is an
+		 after-string just before the newline.  */
+	      if (it.method == GET_FROM_BUFFER && it.c == '\n')
+		it_overshoot_count = 1;
+	      else if (disp_string_at_start_p && it.vpos > 0)
+		{
+		  /* This is the case of a display string that spans
+		     several screen lines.  In that case, we end up at
+		     the end of the string, and it.vpos tells us how
+		     many screen lines we need to backtrack.  */
+		  it_overshoot_count = it.vpos;
+		}
+	      if (it_overshoot_count > 0)
+		move_it_by_lines (&it, -it_overshoot_count);
+	    }
 
 	  overshoot_handled = 1;
 	}






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#11133: 24.0.94; Cursor gets "stuck" on an indented line with wrapped overlay
  2012-04-06 15:48   ` Eli Zaretskii
@ 2012-04-07  4:10     ` Stefan Monnier
  2012-04-07  7:57       ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2012-04-07  4:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: darthandrus, 11133

> The problem here is that vertical-motion does not consider the case of
> a display string that starts at point and takes more than one screen
> line (because it's long).  The patch below plumbs that hole.

> Stefan and Chong, please tell me whether to install now or wait until
> after the Emacs 24.1 branch is cut.

Is it a regression w.r.t 23?  If not, please just install it on the
trunk,


        Stefan





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#11133: 24.0.94; Cursor gets "stuck" on an indented line with wrapped overlay
  2012-04-07  4:10     ` Stefan Monnier
@ 2012-04-07  7:57       ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2012-04-07  7:57 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: darthandrus, 11133-done

> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Cc: darthandrus@gmail.com, 11133@debbugs.gnu.org,
>         Chong Yidong <cyd@stupidchicken.com>
> Date: Sat, 07 Apr 2012 00:10:33 -0400
> 
> > The problem here is that vertical-motion does not consider the case of
> > a display string that starts at point and takes more than one screen
> > line (because it's long).  The patch below plumbs that hole.
> 
> > Stefan and Chong, please tell me whether to install now or wait until
> > after the Emacs 24.1 branch is cut.
> 
> Is it a regression w.r.t 23?

No.

> If not, please just install it on the trunk,

Done as trunk revision 107782.

Closing this bug.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-04-07  7:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-30 14:47 bug#11133: 24.0.94; Cursor gets "stuck" on an indented line with wrapped overlay Ivan Andrus
2012-03-30 16:12 ` Eli Zaretskii
2012-03-30 16:49   ` Ivan Andrus
2012-04-06 15:48   ` Eli Zaretskii
2012-04-07  4:10     ` Stefan Monnier
2012-04-07  7:57       ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).