* current-column and display (space :align-to) properties
@ 2006-01-10 1:24 Michael Mauger
2006-01-10 15:33 ` Stefan Monnier
2006-01-11 0:49 ` Richard M. Stallman
0 siblings, 2 replies; 6+ messages in thread
From: Michael Mauger @ 2006-01-10 1:24 UTC (permalink / raw)
I'm not sure if this is a bug or a feature...
Along the lines of a question that arose a couple of weeks ago re: counting
before and after properties when calculating current-column, should the
space :align-to and :width properties be reflected in current-column?
For example, in *scratch*, try the following:
(progn
(insert "["
(propertize "01"
'display '(space :align-to 10))
"]XX\n")
(insert "["
(propertize "0123456789012"
'display '(space :align-to 5))
"]YY\n")
) `C-j'
You should see something like the following in *scratch*:
[ ]XX
[ ]YY
nil
If you place the cursor on the second of the two XXs (actually point is between
the two XXs), the current-column is 5 (the two square brackets, the two
characters in the propertized string and the first X.)
If you place the cursor on the second of the two YYs, the current-column is 16
(the two square brackets, the twelve characters in the propertized string and
the first Y.)
Even stranger, if you again place the cursor between the two XXs and hit `C-n',
the cursor will go to before the closing bracket on the second line in an
effort to preserve the column position.
Is this desired behavior? Should current-column look at the display property
to determine how to calculate the column position?
-- Michael
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: current-column and display (space :align-to) properties
2006-01-10 1:24 current-column and display (space :align-to) properties Michael Mauger
@ 2006-01-10 15:33 ` Stefan Monnier
2006-01-11 0:49 ` Richard M. Stallman
1 sibling, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2006-01-10 15:33 UTC (permalink / raw)
Cc: emacs-devel
> Is this desired behavior?
No.
> Should current-column look at the display property to determine how to
> calculate the column position?
Yes. It should also return a float value reflecting the real display size
(just like :align-to can be fractional, or if you use proportional fonts,
...).
IIRC someone had started working on that, but I haven't heard any news
from it.
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: current-column and display (space :align-to) properties
2006-01-10 1:24 current-column and display (space :align-to) properties Michael Mauger
2006-01-10 15:33 ` Stefan Monnier
@ 2006-01-11 0:49 ` Richard M. Stallman
2006-01-11 16:57 ` Michael Mauger
1 sibling, 1 reply; 6+ messages in thread
From: Richard M. Stallman @ 2006-01-11 0:49 UTC (permalink / raw)
Cc: emacs-devel
Along the lines of a question that arose a couple of weeks ago re: counting
before and after properties when calculating current-column, should the
space :align-to and :width properties be reflected in current-column?
I think this is part of the to-do item to write a version
of current-column that takes account of pixel widths.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: current-column and display (space :align-to) properties
2006-01-11 0:49 ` Richard M. Stallman
@ 2006-01-11 16:57 ` Michael Mauger
2006-01-12 8:41 ` Kim F. Storm
2006-01-12 15:10 ` Richard M. Stallman
0 siblings, 2 replies; 6+ messages in thread
From: Michael Mauger @ 2006-01-11 16:57 UTC (permalink / raw)
Richard M. Stallman writes:
>
> Along the lines of a question that arose a couple of weeks ago re:
counting
> before and after properties when calculating current-column, should the
> space :align-to and :width properties be reflected in current-column?
>
> I think this is part of the to-do item to write a version
> of current-column that takes account of pixel widths.
>
Actually, on Dec 22nd, during a discussion with Drew titled "current-column and
invisible text", you said:
> I think that is a bug. I see two possible meaningful ways to handle
> an overlay before-string: either ignore it, or count its contents.
> The latter seems more correct.
>
> Would someone like to look at this bug, and ack?
I think a basic solution to this (report integer column number with no
accounting for font widths) is needed now (before the release) since many of
the display properties are new and cause inconsistent behavior in some basic
functions.
I've looked at the code, and understand where the changes are needed, but am
not very comfortable with Emacs internals. I'll take a look and see if I can
puzzle my way thru but my time for it is limited.
-- Michael
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: current-column and display (space :align-to) properties
2006-01-11 16:57 ` Michael Mauger
@ 2006-01-12 8:41 ` Kim F. Storm
2006-01-12 15:10 ` Richard M. Stallman
1 sibling, 0 replies; 6+ messages in thread
From: Kim F. Storm @ 2006-01-12 8:41 UTC (permalink / raw)
Cc: emacs-devel
Michael Mauger <mmaug@yahoo.com> writes:
> I think a basic solution to this (report integer column number with no
> accounting for font widths) is needed now (before the release) since many of
> the display properties are new and cause inconsistent behavior in some basic
> functions.
The mentioned display properties are not new (they were introduced in
21.1), so the problem is not new either.
> I've looked at the code, and understand where the changes are needed, but am
> not very comfortable with Emacs internals. I'll take a look and see if I can
> puzzle my way thru but my time for it is limited.
If you manage to fix current-column (actually current_column_1),
please remember to fix move-to-column in a similar way!
My best guess is that it must be fixed in a way which calls redisplay
internally to calculate the proper column. Otherwise, there are just
too many things which can go wrong -- e.g. newlines with display
properties, etc.
Try this:
(insert "["
(propertize "01\n23"
'display '(space :align-to 10))
"]ZZ\n")
A good test would be
M-: (move-to-column (current-column))
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: current-column and display (space :align-to) properties
2006-01-11 16:57 ` Michael Mauger
2006-01-12 8:41 ` Kim F. Storm
@ 2006-01-12 15:10 ` Richard M. Stallman
1 sibling, 0 replies; 6+ messages in thread
From: Richard M. Stallman @ 2006-01-12 15:10 UTC (permalink / raw)
Cc: emacs-devel
I think a basic solution to this (report integer column number with no
accounting for font widths) is needed now (before the release) since many of
the display properties are new and cause inconsistent behavior in some basic
functions.
I think that failing to handle :align-to is less clearly a bug than
failing to handle a before-string. But it is a matter of judgment.
Both are clearly flaws.
I think they are more or less part of a bigger flaw which is really
the lack of a feature. So we want to fix this, but not necessarily
now.
I've looked at the code, and understand where the changes are
needed, but am not very comfortable with Emacs internals. I'll
take a look and see if I can puzzle my way thru but my time for it
is limited.
Would someone who knows this code better like to help Michael?
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-01-12 15:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-10 1:24 current-column and display (space :align-to) properties Michael Mauger
2006-01-10 15:33 ` Stefan Monnier
2006-01-11 0:49 ` Richard M. Stallman
2006-01-11 16:57 ` Michael Mauger
2006-01-12 8:41 ` Kim F. Storm
2006-01-12 15:10 ` Richard M. Stallman
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).