unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: JD Smith <jdtsmith@gmail.com>
Cc: 66942@debbugs.gnu.org
Subject: bug#66942: move-to-column behavior when newlines have a display property
Date: Sun, 05 Nov 2023 19:47:27 +0200	[thread overview]
Message-ID: <83y1fc2its.fsf@gnu.org> (raw)
In-Reply-To: <D1BB9185-3789-4546-8248-6AAABF1D9AFF@gmail.com> (message from JD Smith on Sun, 5 Nov 2023 12:18:12 -0500)

> 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	other threads:[~2023-11-05 17:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-04 22:14 bug#66942: move-to-column behavior when newlines have a display property Sebastian Wålinder
2023-11-05  5:59 ` Eli Zaretskii
2023-11-05 17:18 ` JD Smith
2023-11-05 17:47   ` Eli Zaretskii [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83y1fc2its.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=66942@debbugs.gnu.org \
    --cc=jdtsmith@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).