From a76f05204237c291a5af69c4eaf49a02becfd8b2 Mon Sep 17 00:00:00 2001 From: Oliver Blanthorn Date: Fri, 24 Nov 2017 19:00:26 +0000 Subject: [PATCH] Add shift-tab bind for completion --- src/completions.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/completions.ts b/src/completions.ts index f8bbdec3..4fd0c68a 100644 --- a/src/completions.ts +++ b/src/completions.ts @@ -55,10 +55,14 @@ export abstract class CompletionSource { return this._state } - next(forward = true): boolean { + next(inc = 1): boolean { return false } + prev(inc = 1): boolean { + return this.next(-1*inc) + } + } // Default classes @@ -294,17 +298,16 @@ abstract class CompletionSourceFuse extends CompletionSource { /* console.log('results', result1, res2) */ } - next(forward=true){ + next(inc=1){ if (this.state != "hidden"){ let visopts = this.options.filter((o) => o.state != "hidden") let currind = visopts.findIndex((o) => o.state == "focused") this.deselect() - this.select(visopts[currind + 1]) + this.select(visopts[currind + inc]) return true } else return false } - prev = () => this.next(false) } // }}}