Skip to content

Commit

Permalink
web/app: editor - vimmode auto-focus on space timeout or Finder cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
alonswartz committed Oct 30, 2024
1 parent f41132e commit ba7d34e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions web/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ export default {
handleFinderSelection(value) {
this.showFinder = false;
this.finderQuery = '';
if (value !== null) {
if (value === null) {
this.resetActiveFilename();
} else {
const note = this.notes.find(note => note.Filename === value.Filename);
if (note) {
note.Linenum = value.Linenum;
Expand Down Expand Up @@ -271,6 +273,13 @@ export default {
this.activeFilename = filename;
}
},
resetActiveFilename() {
if (this.activeFilename) {
const af = this.activeFilename;
this.activeFilename = '';
this.$nextTick(() => { this.activeFilename = af; });
}
},
async closeNote(filename, confirmIfModified = true) {
const index = this.notes.findIndex(note => note.Filename === filename);
if (index === -1) return;
Expand Down Expand Up @@ -361,7 +370,7 @@ export default {
if (event.code == leaderKey) {
this.keySequence = [leaderKey];
event.preventDefault();
timeoutId = setTimeout(() => { this.keySequence = []; }, 2000);
timeoutId = setTimeout(() => { this.keySequence = []; this.resetActiveFilename(); }, 2000);
return;
}

Expand Down

0 comments on commit ba7d34e

Please sign in to comment.