koehlma / pygtkspellcheck

A simple but quite powerful spellchecking library for GTK written in pure Python.
GNU General Public License v3.0
23 stars 9 forks source link

Spelling menu access on mobile #52

Closed cheywood closed 1 year ago

cheywood commented 1 year ago

Hey Maximilian,

On touch devices the TextView traditional context menu isn't currently accessible meaning the Gtk Spellcheck functionality is also not accessible. I just had a play around this morning with adding a Popover which gets populated with the spellcheck items and displayed on longpress on touch devices.

It roughly does what's on the box; it's broadly possible to use the spelling menu on touch devices. It doesn't however work for the word under the cursor, presumably due to touch-specific controls provided by Gtk.

I'm wondering whether there might be value in providing this functionality in Gtk Spellcheck as disabled by default behaviour? While it is imperfect it's my impression that any spelling solution working with Gtk 4 on mobile will be, until the point that spelling is brought into Gtk itself.

You can see my app space proof of concept changes here.

If you're interested I can work up an MR.

There are obviously good reasons to not include it though, that's up to you. In that case I wonder if eg. additions to the API may be possible to avoid the more ugly things I'm doing in client space (eg. updating Spellcheck's mark and calling the protected method).

koehlma commented 1 year ago

How about making the _populate_menu method public and adding a move_click_mark method for moving the mark? At least, then one does not have to rely on implementation details. ;)

cheywood commented 1 year ago

Great thanks, something like what's in the MR?

Some linting's still failing relating to something you've flagged with a TODO

koehlma commented 1 year ago

Looks good!

Those lints keep getting more strict. 😅

cheywood commented 1 year ago

Excellent stuff, thanks Maximilian!