Open iSeeU816 opened 3 years ago
Thanks, I can reproduce it. Maybe this is a problem of posframe
position function when scrolling is involved. As a temporary workaround you could include the word into the prompt so you at least know which word is queried for:
(defun frog-menu-flyspell-correct (candidates word)
"Run `frog-menu-read' for the given CANDIDATES.
List of CANDIDATES is given by flyspell for the WORD.
Return selected word to use as a replacement or a tuple
of (command . word) to be used by `flyspell-do-correct'."
(let* ((corrects (if flyspell-sort-corrections
(sort candidates 'string<)
candidates))
(actions `(("C-s" "Save word" (save . ,word))
("C-a" "Accept (session)" (session . ,word))
("C-b" "Accept (buffer)" (buffer . ,word))
("C-c" "Skip" (skip . ,word))))
(prompt (format "Word: [%s], Dictionary: [%s]"
word
(or ispell-local-dictionary
ispell-dictionary
"default")))
(res (frog-menu-read prompt corrects actions)))
(unless res
(error "Quit"))
res))
Alternatively you could also use the side window type which does not has this problem:
(setq frog-menu-type-function
(lambda () 'avy-side-window))
You're welcome.
Maybe, but I'm afraid I've no idea. I could file an issue in Posframe tracker but I don't know any technical details of the package.
Thanks for the improvement of the function, I thought about having the word with
the UI to help knowing what word to correct. A little mixed up in the function
regarding the order that %s
was assigned to; I mean word
will have
dictionary output, and vice versa.
Alternatively you could also use the side window type which does not has this problem:
I have created a function to handle this, but your way is much better, thanks.
A little mixed up in the function regarding the order that %s was assigned to; I mean word will have dictionary output, and vice versa.
Thanks, edited the example!
Hello,
While I'm testing this package I fall into a bug causing the line where the misspelled word to be covered with Posframe UI; that makes choosing the proper word hard as its context is hidden.
The bug
Here are the steps to reproduce this bug:
Place source code of these libraries into
test
directory:flyspell-correct.el
.frog-menu.el
.avy.el
.posframe.el
.Launch Emacs.
C-x b
and typefoo.txt
to create a dump buffer and then hitRET
(return/enter).Enable Flyspell mode
M-x flyspell-mode RET
.Type this in
foo.txt
buffer:Fro
<note_1>
make sure it's empty. As for<note_2>
keep hitting return or enter to make the text in line two disappear from the buffer's view.In
<cursor_position>
, callM-x flyspell-correct-wrapper
.Notice how the line (2nd line where the text is) is covered with Posframe UI.
Notes
avy-side-window
is acting normal, which is what I'm using now.scroll-margin
variable when it set to something else than zero, but it's not.Thank you for this package. Before this, I had to type
save
in Minibuffer as I couldn't assign a command to type that for me in defaultflyspell-correct
interface using Embark package. Anyway, now all good with a simple keybindingC-s
!Software info