GNU bug report logs -
#11094
Wrong cursor positioning with display+invisible
Previous Next
Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>
Date: Mon, 26 Mar 2012 04:40:01 UTC
Severity: normal
Found in version 24.0.94
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
Message #32 received at 11094 <at> debbugs.gnu.org (full text, mbox):
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: 11094 <at> debbugs.gnu.org
> Date: Tue, 03 Apr 2012 09:37:08 -0400
>
> >> emacs -Q
> >> (put-text-property (point-min) (+ 2 (point-min)) 'invisible t)
> >> (put-text-property (+ 2 (point-min)) (+ 4 (point-min)) 'display "<>")
> >> (goto-char (point-min))
> >> where I'd expect the cursor to be drawn to the left of "<>" rather than
> >> to the right.
> > Isn't this an issue with point adjustments?
>
> No: the (goto-char (point-min)) really moves to (point-min) for me, as
> can be verified with M-: (point).
>
> > If I set global-disable-point-adjustment non-nil, I get the cursor
> > where you want it.
>
> It makes no difference for me: point as at BOB, but the cursor is drawn
> after the "<>".
The patch below solves this problem. Do you think it is safe enough
for the release branch?
=== modified file 'src/xdisp.c'
--- src/xdisp.c 2012-03-31 19:30:53 +0000
+++ src/xdisp.c 2012-04-07 11:58:19 +0000
@@ -14042,15 +14042,18 @@ set_cursor_from_row (struct window *w, s
|| pos <= tem)
{
/* If the string from which this glyph came is
- found in the buffer at point, then we've
- found the glyph we've been looking for. If
- it comes from an overlay (tem == 0), and it
- has the `cursor' property on one of its
+ found in the buffer at point, or at position
+ that is closer to point than pos_after, then
+ we've found the glyph we've been looking for.
+ If it comes from an overlay (tem == 0), and
+ it has the `cursor' property on one of its
glyphs, record that glyph as a candidate for
displaying the cursor. (As in the
unidirectional version, we will display the
cursor on the last candidate we find.) */
- if (tem == 0 || tem == pt_old)
+ if (tem == 0
+ || tem == pt_old
+ || (tem - pt_old > 0 && tem < pos_after))
{
/* The glyphs from this string could have
been reordered. Find the one with the
@@ -14088,7 +14091,8 @@ set_cursor_from_row (struct window *w, s
}
}
- if (tem == pt_old)
+ if (tem == pt_old
+ || (tem - pt_old > 0 && tem < pos_after))
goto compute_x;
}
if (tem)
This bug report was last modified 13 years and 103 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.