Skip to content

Commit 5b40449

Browse files
committed
Invalidate suggestion when the user has type all of them out
1 parent 66ccada commit 5b40449

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Core/Sources/Service/Workspace.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,17 @@ final class Filespace {
8080
}
8181

8282
let editingLine = lines[cursorPosition.line].dropLast(1) // dropping \n
83-
let suggestionFirstLine = presentingSuggestion?.text.split(separator: "\n").first ?? ""
83+
let suggestionLines = presentingSuggestion?.text.split(separator: "\n") ?? []
84+
let suggestionFirstLine = suggestionLines.first ?? ""
8485
if !suggestionFirstLine.hasPrefix(editingLine) {
8586
reset()
8687
return false
8788
}
89+
90+
if editingLine == suggestionFirstLine, suggestionLines.count <= 1 {
91+
reset()
92+
return false
93+
}
8894

8995
if editingLine.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
9096
reset()

0 commit comments

Comments
 (0)