GavriYashar / Matlab-Editor-Plugin

Extends features for the matlab editor, Bookmarks, FileStructure, Clipboard stack
MIT License
74 stars 12 forks source link

Next/previous bookmark shortcuts not working for files opened from the last session #131

Open zifredder opened 6 years ago

zifredder commented 6 years ago

This is just a minor bug, only slightly annoying: When MATLAB is started, bookmark navigation is not working in files that are automatically opened from the last session in the editor (bookmark toggling works). Bookmark navigation works, however, in files that are opened during a session and, hence, when a file from the last session is closed and re-opened again.

In your setup instructions it is mentioned that on some systems MATLAB's bookmark-toggle shortcut needs to be disabled to make MEP's shortcut work - this applies to my system, maybe this is relevant. I'm running MATLAB R2018a 64bit on Windows 7 Professional, MEP 1.30.

GavriYashar commented 6 years ago

I'm sorry for the inconvenience. Currently I'm unable to investigate this issue further.

for myself: mde.jar

com.mathworks.mde.editor.ExecutionArrowDisplay#prevBookmark
com.mathworks.mde.editor.ExecutionArrowDisplay#nextBookmark
zifredder commented 6 years ago

In case someone else is interested, here is an okayish (it noticeably slows down MATLAB initialization) workaround. I put this snippet in my startup.m, but it only works if executed after at.mep.Start.start(<...>):

%% close and re-open all open files in editor
editorApp = com.mathworks.mlservices.MLEditorServices.getEditorApplication;
activeFile = char(editorApp.getActiveEditor.getLongName); % previously active file
filenames = arrayfun(@(obj) char(obj.getLongName),editorApp.getOpenEditors.toArray ...
    ,'UniformOutput',false);
editorApp.close; % close all
cellfun(@(fn) edit(fn),filenames); % re-open
edit(activeFile); % activate previously active file
GavriYashar commented 6 years ago

Does using the bookmark viewer to jump to bookmark make a change in the behavior? Or reopening only?

zifredder commented 6 years ago

No, jumping via the viewer works, but does not enable shortcuts.