GNU bug report logs -
#54488
29.0.50; move-to-column/overlay-related regression in latest master, perhaps 28?
Previous Next
Full log
View this message in rfc822 format
> From: João Távora <joaotavora <at> gmail.com>
> Date: Tue, 22 Mar 2022 16:06:48 +0000
> Cc: Dmitry Gutov <dgutov <at> yandex.ru>, 54488 <at> debbugs.gnu.org
>
> I don't understand how (point) can return a value outside of the
> narrowed region, unless it runs with the narrowing temporarily
> disabled. Can you show me the code with that call to 'point' again?
> I don't think I see it in your OP.
>
> It's the snippet below. but the indentation probably botched it.
> I inlined a function in that snippet so you can see the move-to-column
> and the (point) in the same function (normally they live in different
> functions).
>
> > (defun eglot-move-to-lsp-abiding-column (column)
> > "Move to COLUMN abiding by the LSP spec."
> > (save-restriction
> > (cl-loop
> > with lbp = (line-beginning-position)
> > initially
> > (narrow-to-region lbp (line-end-position))
> > (move-to-column column)
> > for diff = (- column
> > (/ (- (length (encode-coding-region (or lbp (line-beginning-position))
> > (point) 'utf-16 t)) ;; <===== THAT (point)
> > 2)
> > 2))
> > until (zerop diff)
> > do (condition-case eob-err
> > (forward-char (/ (if (> diff 0) (1+ diff) (1- diff)) 2))
> > (end-of-buffer (cl-return eob-err))))))
I don't see how this could cause the problem you describe, but please
note that encode-coding-region generally changes the text in the
region, so maybe what you consider to be outside the restriction
isn't?
Anyway, do you have an example of text in which this function causes
point to return such problematic values?
> Why do you have to use move-to-column instead of forward-char?
>
> I don't remember! Is it exactly equivalent if you're standing in the beginning of the line?
Yes, if you have only text in the buffer (no images etc.).
This bug report was last modified 3 years and 84 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.