[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#21207: 25.0.50; Cursor position behaves unpredictably on the 'displa
From: |
Artur Malabarba |
Subject: |
bug#21207: 25.0.50; Cursor position behaves unpredictably on the 'display text property |
Date: |
Fri, 7 Aug 2015 16:07:27 +0100 |
1. Type `single line' into an empty buffer, and place the cursor at the space.
2. Hit M-: and evaluate the following snippet
(add-text-properties (point) (1+ (point)) '(display "\n"))
3. When the space in the middle gets "turned" into a newline, the
cursor is left where it was (at the fake end of the first line, right
after the word `single').
4. Now follow the same steps on a new buffer, but evalate this instead:
(add-text-properties (point) (1+ (point)) '(display "\n------"))
5. This time, the cursor will be moved down to the start of the second
"fake" line (right before the `-----'). Furthermore, it is impossible
to place it at the position we had in item 3, it just jumps straight
from the first `e' to the first `-', skipping the actual newline char.
If I can place the cursor on the newline in the first scenario, why
can't I do so in the second?
Is there a way around this?
I tried adding a '(cursor t) property to the "\n" substring, but
nothing changed.
Cheers,
Artur