Skip to content
This repository was archived by the owner on Dec 17, 2024. It is now read-only.

Commit 50014a1

Browse files
committed
fixes: tab completion was pre-filling the first character when there were no partial-fill matches
Fixes #866
1 parent 244d4a6 commit 50014a1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app/plugins/ui/commands/tab-completion.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ const updateReplToReflectLongestPrefix = (prompt, matches, temporaryContainer, p
9797
let idx = 0
9898

9999
const partialComplete = idx => {
100+
// debug('partial complete', idx)
100101
const completion = completeWith(partial, matches[0].substring(0, idx))
101102
temporaryContainer.partial = temporaryContainer.partial + completion
102103
prompt.value = prompt.value + completion
@@ -107,16 +108,21 @@ const updateReplToReflectLongestPrefix = (prompt, matches, temporaryContainer, p
107108

108109
for (let jdx = 1; jdx < matches.length; jdx++) {
109110
const other = matches[jdx].charAt(idx)
110-
if (char != other) {
111+
if (char !== other) {
111112
if (idx > 0) {
112113
// then we found some common prefix
114+
// debug('partial complete midway')
113115
return partialComplete(idx)
116+
} else {
117+
// debug('no partial completion :(')
118+
return
114119
}
115120
}
116121
}
117122
}
118123

119124
if (idx > 0) {
125+
// debug('partial complete at end')
120126
partialComplete(idx)
121127
}
122128
}

0 commit comments

Comments
 (0)