Perfect. Now I can switch seamlessly between viewer and editor... I find this very useful (eg with encoding problems when moving files from Windows to Linux). Well done, great feature.
EDIT: Hm... load a file, switch to hex view, switch back to text edit, add some text and try to save. Error message saying file can't be saved. I toggled read-only... no change.
class Command:
crt = None #global inited var
def method(self):
# code to restore crt
if self.crt:
ed.set_caret(*self.crt)
#code to save crt
self.crt = ed.get_carets()[0]
> the ed.cmd(cmds.cCommand_ScrollToCaretTop) call doesn't really do what it's supposed to do.
It works here- if I place 10 carets, scroll to end of big file, cmd scrolls to top caret
I've left that bit out as an exercise for the reader Of course, I have defined hexCr (as evidenced by it being referenced as Command.hexCr).
Alexey wrote:> the ed.cmd(cmds.cCommand_ScrollToCaretTop) call doesn't really do what it's supposed to do.
It works here- if I place 10 carets, scroll to end of big file, cmd scrolls to top caret
Sure, it works in the general case but it definitely does not work when switching back into text editor mode.