Plugin to toggle "Caret after end" option

Plugins for SynWrite and CudaText...
Post Reply
vidovan
Posts: 7
Joined: 05.12.2023 16:32

Plugin to toggle "Caret after end" option

Post by vidovan »

Hello, is there a way to make a command for switching the option caret_after_end, to add it into menu or bind it to a hotkey?
I am changing it in the user.json now... maybe there is another way to do it?
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: Caret after end

Post by main Alexey »

It can be binded to a hotkey, if new small plugin is made. Then bind hotkey to this plugin.
plugin code must just toggle PROP_CARET_VIRTUAL via ed.set_prop().
call "Plugins / Make plugin".
fill code file with this:

Code: Select all

from cudatext import *

class Command:
    
    def run(self):
        op = ed.get_prop(PROP_CARET_VIRTUAL, '')
        ed.set_prop(PROP_CARET_VIRTUAL, not op)
vidovan
Posts: 7
Joined: 05.12.2023 16:32

Re: Caret after end

Post by vidovan »

Thank you, this works.
One question though, I put it it into menu, but is it possible to get a check box to the menu item?
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: Caret after end

Post by main Alexey »

Auto change of checkmark is not possible; only this is possible: plugin finds the custom menu item in top menu using menu_proc(), and changes the checkmark.
vidovan
Posts: 7
Joined: 05.12.2023 16:32

Re: Plugin to toggle "Caret after end" option

Post by vidovan »

Ok, I'll look into it... thank you.
Post Reply