GNU bug report logs -
#64696
30.0.50; indent-to inherits preceding text properties, including 'invisible
Previous Next
Full log
Message #89 received at 64696 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> ⛔ Warning (emacs): Test #2:: ’word’ is inside folded heading (hidden using overlays).
>> ⛔ Warning (emacs): Moved point after first ’word’
>> ⛔ Warning (emacs): 1:: current-column = 4
>>
>> Test #2 is unexpected - we are inside invisible region, but
>> current-column reports as if everything were visible.
>
> current-column produces incorrect results when the newline before the
> current line is invisible. It always starts from the beginning of the
> current physical line, even if that is in invisible text.
Then why does test #3 produce current-column = 0?
The newline before current line is also invisible there.
> We could teach current-column about invisible newlines, see the patch
> below. But I'm not sure this is justified, nor whether it won't break
> something. The patch below also has a disadvantage that it will still
> behave as before for a buffer that is not displayed in any window; if
> we want that to be fixed as well, the changes will need to be more
> extensive. (Basically, we will need to write a non-display version of
> back_to_previous_visible_line_start.)
>
> With the patch below, Test #2 shows "current-column = 6", which is
> correct, since the cursor is shown after "* Test", with all the rest
> invisible.
This will definitely break indentation code.
Look at `indent-line-to':
(beginning-of-line 1)
(skip-chars-forward " \t")
(let ((cur-col (current-column)))
<...>
((> cur-col column) ; too far right (after tab?)
(delete-region (progn (move-to-column column t) (point))
;; The `move-to-column' call may replace
;; tabs with spaces, so we can't reuse the
;; previous start point.
(progn (beginning-of-line 1)
(skip-chars-forward " \t")
(point))))
In the Test #2 situation, if `current-column' returns 6 and we have
* Test
<point>word
(indent-line-to 3)
we will go into (> cur-col column) branch and
(delete-region <line end position> <first non-whitespace after bol>)
In other words, `indent-line-to' with delete "word".
I am pretty sure that it is not the only breakage.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
This bug report was last modified 2 years and 50 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.