Skip to content

Commit

Permalink
Merge pull request #1132 from Dyalog/mac_shcs
Browse files Browse the repository at this point in the history
Add Mac shortcuts and new CLS command to close window, fix #822
  • Loading branch information
e9gille authored Sep 6, 2023
2 parents 6d38e13 + 0cf05f8 commit ac33260
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/cmds.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ D.cmds = [
['CAM','Clear all trace/stop/monitor',[]],
['CAW','Close All Windows',[]],
['CBP','Clear stops for active object',[]],
['CLS','Close window', D.mac?['Cmd+W']:[]],
['CNC','Connect', []],
['DK', 'Delete lines', []],
['DHI','Dyalog Help Index', []],
Expand Down Expand Up @@ -45,7 +46,7 @@ D.cmds = [
['OWS','Open Workspace', [D.mac?'Cmd+O':'Ctrl+O']],
['PAT','Pause all Threads', []],
['POE','Pause on Error', []],
['PRF','Show preferences', []],
['PRF','Show preferences', D.mac?['Cmd+,']:[]],
['PV' ,'Previous match', []],
['QCP','Quick Command Palette', []],
['QIT','Quit', [D.mac?'Cmd+Q':'Ctrl+Q']],
Expand Down
1 change: 1 addition & 0 deletions src/ed.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ D.Ed.prototype = {
steps = Math.abs(steps);
for (let i = 0; i < steps; i++) { D.send(cmd, { win: this.id }); }
},
CLS() { this.onClose(); },
EP(me) { this.isClosing = 1; this.FX(me); },
FX(me) {
const ed = this;
Expand Down
2 changes: 1 addition & 1 deletion src/km.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@
(h && h[x]) ? h.execCommand(x) : $.alert(`Command ${x} not implemented.`);
});
};
('CBP MA AC VAL indentOrComplete indentMoreOrAutocomplete STL TVO TVB'
('CLS CBP MA AC VAL indentOrComplete indentMoreOrAutocomplete STL TVO TVB'
+ ' TGC JBK JSC LOG WSE').split(' ').forEach(defCmd);
for (let i = 0; i < C.length; i++) {
if (C[i]) {
Expand Down
17 changes: 10 additions & 7 deletions src/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,18 @@ D.installMenu = function Menu(mx) {
x.checkBoxPref((v) => { mi.checked = !!v; });
}
const roles = {
cut: 1,
copy: 1,
paste: 1,
togglefullscreen: 1,
window: 1,
help: 1,
cut: 0,
copy: 0,
paste: 0,
togglefullscreen: 0,
window: 0,
help: 0,
hide: 0,
hideothers: 0,
showall: 'unhide',
};
const r = x[''].replace(/[& ]/g, '').toLowerCase();
if (r in roles) h.role = r;
if (r in roles) h.role = roles[r] || r;
if (x.items) {
h.submenu = new D.el.Menu();
x.items.forEach((y) => { h.submenu.append(render(y)); });
Expand Down
4 changes: 4 additions & 0 deletions src/prf.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ D.prf = {};
+ '\n -'
+ '\n Preferences... =PRF'
+ '\n - '
+ '\n Hide {mac}'
+ '\n Hide Others {mac}'
+ '\n Show All {mac}'
+ '\n - {mac}'
+ '\n &Quit =QIT'
+ '\n&File {!browser}'
+ '\n &Open... =OWS {local}'
Expand Down
1 change: 1 addition & 0 deletions src/se.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@ D.Se.prototype = {
}
se.hl();
},
CLS() {},
EP() { this.ide.focusMRUWin(); },
ER() { this.exec(0); },
TC() { this.exec(1); },
Expand Down

0 comments on commit ac33260

Please sign in to comment.