Page 1 of 1

Plugin to toggle "Caret after end" option

Posted: 14.06.2024 14:10
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?

Re: Caret after end

Posted: 14.06.2024 14:49
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)

Re: Caret after end

Posted: 14.06.2024 15:17
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?

Re: Caret after end

Posted: 14.06.2024 17:08
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.

Re: Plugin to toggle "Caret after end" option

Posted: 15.06.2024 11:43
by vidovan
Ok, I'll look into it... thank you.