all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#45319: 28.0.50; Redisplay: `forward-char' moves backwards into invisible text
@ 2020-12-19  6:10 Michael Heerdegen
  2020-12-19  9:10 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Heerdegen @ 2020-12-19  6:10 UTC (permalink / raw)
  To: 45319; +Cc: Jonas Bernoulli

[-- Attachment #1: Type: text/plain, Size: 282 bytes --]


Hello,

I have found a strange problem I encountered in the Magit Log buffer,
but it is reproducible in any buffer in emacs -Q.  CC'ing Jonas
Bernoulli, maintainer of Magit, for information.

I insert something like this into e.g. *scratch* (looks a bit like a
Magit log buffer):


[-- Attachment #2: test.txt --]
[-- Type: text/plain, Size: 72 bytes --]

11111
  a
  b
  c
22222
  x
  y
  z
33333
  f
  g
  h
44444
  i
  j
  k

[-- Attachment #3: Type: text/plain, Size: 1562 bytes --]


Lets do this:

  (add-hook 'post-command-hook (lambda () (message "%s" (point))))

to see the value of point when we move around in the buffer.

I want to hide lines that start with whitespace, so I do this:

  (defvar my-magit-log-show-only-hash-lines-mode-keywords
    `((,(rx (and bol space (* any) eol))
       (0 (let ((beg (match-beginning 0))
                (end (1+ (match-end 0))))
            (add-text-properties beg end
                                 (list 'invisible 'my-magit-log-show-only-hash-lines))
            nil)))))

  (define-minor-mode my-magit-log-show-only-hash-lines-mode
    "..." nil nil nil
    (if (not my-magit-log-show-only-hash-lines-mode)
        (remove-from-invisibility-spec 'my-magit-log-show-only-hash-lines)
      (font-lock-add-keywords nil my-magit-log-show-only-hash-lines-mode-keywords)
      (add-to-invisibility-spec 'my-magit-log-show-only-hash-lines)))

Now enable that mode in the buffer and M-x font-lock-fontify-buffer.

When I now move around in the buffer with the arrow keys, it often
happens that when point is at the beginning of a visible line, and I hit
<right>, the echo area shows that point actually has moved backwards into
the invisible area somewhere before that line, but the cursor is placed
at the expected position.  Further movement behaves as expected from the
drawn cursor position, just the value of `point' sometimes is
inconsistent, and that can cause trouble (like incorrect section
highlighting in the Magit Log buffer).


TIA,

Michael.



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-12-20 15:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-19  6:10 bug#45319: 28.0.50; Redisplay: `forward-char' moves backwards into invisible text Michael Heerdegen
2020-12-19  9:10 ` Eli Zaretskii
2020-12-19 11:21   ` Michael Heerdegen
2020-12-19 11:26     ` Eli Zaretskii
2020-12-19 12:09       ` Michael Heerdegen
2020-12-19 12:19         ` Eli Zaretskii
2020-12-19 12:44           ` Michael Heerdegen
2020-12-19 13:05             ` Eli Zaretskii
2020-12-20  2:15               ` Michael Heerdegen
2020-12-20  3:32               ` Michael Heerdegen
2020-12-20  8:01               ` Michael Heerdegen
2020-12-20 15:38                 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.