bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#66942: move-to-column behavior when newlines have a display property


From: Eli Zaretskii
Subject: bug#66942: move-to-column behavior when newlines have a display property
Date: Sun, 05 Nov 2023 19:47:27 +0200

> From: JD Smith <jdtsmith@gmail.com>
> Date: Sun, 5 Nov 2023 12:18:12 -0500
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > ...unless someone comes with an idea for how to handle these situations in 
> > a sensible way (and I thought long and hard about it, but couldn't find 
> > such ideas), this will remain a limitation of move-to-column, and one of 
> > the complications introduced by display strings with embedded newlines in 
> > general.
> 
> Would it not make more sense to place the cursor _before_ the first character 
> with a `\n` in its replacing-display property, if move-to-column attempts to 
> move past it?  It is true that neither that position nor a position on a 
> subsequent line is “correct”, but the former at least preserves the expected 
> move-to-column semantics of “stay on this line”.  

"Stay on this line" has one meaning when the text is displayed in some
window and move-to-column is used for positioning the cursors, and
another meaning when move-to-column is used as part of a Lisp program
where move-to-column is used to move point (where "this line" is
generally the line of buffer text).

In addition, what you suggest will cause the behavior to change
drastically when a newline is added to the display property.

Moreover, did you also consider what should current-column return in
those cases?  These two must work in sync, as much as possible.

And finally, when neither behavior is 100% correct, I think we should
generally prefer the behavior we had for some time, because any
changes in that could break someone's code.  Whereas if someone wants
the behavior you describe, they can have that for the price of
relatively simple changes in their Lisp programs.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]