unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrea Greselin <greselin.andrea@gmail.com>
To: 53773@debbugs.gnu.org
Subject: bug#53773: 27.2; Flyspell delays region overlay update when the region is overwritten
Date: Fri, 4 Feb 2022 11:00:05 +0100	[thread overview]
Message-ID: <CAJ_oJbaGhq3KB848Uc_C1Sz_JNQ6uzvmswMuQk0e_wKnY9ntWQ@mail.gmail.com> (raw)

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

Hello everyone :-)

When ‘delete-selection-mode’ and ‘transient-mark-mode’ are enabled,
there’s an active region and I type a character, the region is
immediately deactivated. In Flyspell mode, though, the unhighlighting
of the deactivated region is delayed by the function
‘flyspell-check-word-p’. The region is deactivated but the overlay is
not updated to reflect that.

If I understand correctly the delay (indicated by ‘<---’ below) is
used by Flyspell to give the user some time for typing before
highlighting a word as mispelled, but in this case it ends up
delaying also the refresh of the region overlay.

(defun flyspell-check-word-p ()
 "Return t when the word at `point' has to be checked.
The answer depends of several criteria.
Mostly we check word delimiters."
 (let ((ispell-otherchars (ispell-get-otherchars)))
   (cond
    ((<= (- (point-max) 1) (point-min))
     ;; The buffer is not filled enough.
     nil)
    ((and (and (> (current-column) 0)
(not (eq (current-column) flyspell-pre-column)))
  (save-excursion
    (backward-char 1)
    (and (looking-at (flyspell-get-not-casechars))
 (or (string= "" ispell-otherchars)
     (not (looking-at ispell-otherchars)))
 (or flyspell-consider-dash-as-word-delimiter-flag
     (not (looking-at "-"))))))
     ;; Yes because we have reached or typed a word delimiter.
     t)
    ((symbolp this-command)
     (cond
      ((get this-command 'flyspell-deplacement)
(not (eq flyspell-previous-command this-command)))
      ((get this-command 'flyspell-delayed)
;; The current command is not delayed, that
;; is that we must check the word now.
(and (not unread-command-events)
    (sit-for flyspell-delay))) ; <---
      (t t)))
    (t t))))

[-- Attachment #2: Type: text/html, Size: 2084 bytes --]

             reply	other threads:[~2022-02-04 10:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-04 10:00 Andrea Greselin [this message]
2022-08-02 16:11 ` bug#53773: 27.2; Flyspell delays region overlay update when the region is overwritten Andrea Greselin
2022-08-03 11:17   ` Lars Ingebrigtsen
2022-08-03 12:30     ` Eli Zaretskii
2022-08-04  6:16       ` Lars Ingebrigtsen

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=CAJ_oJbaGhq3KB848Uc_C1Sz_JNQ6uzvmswMuQk0e_wKnY9ntWQ@mail.gmail.com \
    --to=greselin.andrea@gmail.com \
    --cc=53773@debbugs.gnu.org \
    /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).