jcsirot / anki-simple-furigana

Anki add-on providing support for adding or removing furigana on Japanese text
GNU General Public License v3.0
11 stars 5 forks source link

fix selection for ~2.1.40 and above #14

Open olslash opened 2 years ago

olslash commented 2 years ago

seems to work as expected now

cc @shuugo @mario-kromer @jcsirot

meguminnet commented 2 years ago

Tested working on my side as well!.

There's an issue though. the hotkey is not working because Ctrl+G is doing a collision with an Anki hotkey. I propose . and . for both generate and delete. Also minor styling fixes:

https://github.com/jcsirot/anki-simple-furigana/blob/437e1b69576bcac9d15d00db488a5298faf68400/src/__init__.py#L69-L72

        editor.addButton(None, "generateRuby", lambda ed=editor: doIt(ed, generateRuby), 
            tip=_(u"Automatically generate furigana (Ctrl+.)"), keys=_(u"Ctrl+."), label=_(u"Generate readings")),
        editor.addButton(None, "deleteRuby", lambda ed=editor: doIt(ed, deleteRuby), 
            tip=_(u"Mass delete furigana (Ctrl+,)"), keys=_(u"Ctrl+,"), label=_(u"Delete readings"))
olslash commented 2 years ago

makes sense to me

I looked through the source and didn't find any obvious conflicts with those, though there doesn't seem to be any system for coordinating hotkeys between different plugins so an issue could still exist in some cases.

but short of making a menu to allow customizing the keybinds, this seems like a good solution

I can copy/paste your fix into this changeset tonight unless you want to make a separate PR for it

meguminnet commented 2 years ago

I'm fine with doing it on the same PR, as to not create possible merge conflicts, makes everything clearer too.