Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

override edit.selected_text (preserve/restore selection after copy) #1556

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

chdoc
Copy link
Contributor

@chdoc chdoc commented Sep 2, 2024

For quite a while, have been annoyed by homophone selection (specifically phones word) not working in emacs. I finally tracked this down to the following issue: the call to selected_text inside of user.homophones_show_selection actually clears the selection. As a consequence, "choose" appends the selected homophone to the original word, instead of replacing it.

Clearing the selection is the expected behavior when copying in emacs, but this changes selected_text to restore the selection after copying.

Note: This still requires enabling delete-selection-mode, but I would deem that acceptable when editing natural language text.

Context:

phones word:
    edit.select_word()
    user.homophones_show_selection()

choose <user.formatters> <number_small>:
    result = user.homophones_select(number_small)
    insert(user.formatted_text(result, formatters))
    user.homophones_hide()

@chdoc chdoc marked this pull request as draft September 6, 2024 12:01
@chdoc
Copy link
Contributor Author

chdoc commented Sep 6, 2024

I just realized that this by itself will not solve the issue. In fact, the change that I proposed causes issues with dictation mode. I will have to investigate this further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant