Skip to content

Commit e90eebd

Browse files
committed
current word under cursor corrected, fix #468
1 parent f9f11c6 commit e90eebd

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/ed.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,13 @@
336336
refresh() { },
337337
cword() { // apl identifier under cursor
338338
const { me } = this;
339-
const c = me.getPosition();
340-
const s = me.model.getLineContent(c.lineNumber);
339+
const p = me.getPosition();
340+
const c = p.column - 1;
341+
const s = me.model.getLineContent(p.lineNumber);
341342
const r = '[A-Z_a-zÀ-ÖØ-Ýß-öø-üþ∆⍙Ⓐ-Ⓩ0-9]*'; // r:regex fragment used for a name
342343
return (
343-
((RegExp(`⎕?${r}$`).exec(s.slice(0, c.column)) || [])[0] || '') + // match left of cursor
344-
((RegExp(`^${r}`).exec(s.slice(c.column)) || [])[0] || '') // match right of cursor
344+
((RegExp(`⎕?${r}$`).exec(s.slice(0, c)) || [])[0] || '') + // match left of cursor
345+
((RegExp(`^${r}`).exec(s.slice(c)) || [])[0] || '') // match right of cursor
345346
).replace(/^\d+/, ''); // trim leading digits
346347
},
347348
autoCloseBrackets(x) { this.me.updateOptions({ autoClosingBrackets: x }); },

0 commit comments

Comments
 (0)