Skip to content

Commit 635c70e

Browse files
committed
Keep col on first line if only one line is selected
1 parent 8692e74 commit 635c70e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Core/Sources/Service/SuggestionCommandHandler/WindowBaseCommandHandler.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,10 @@ struct WindowBaseCommandHandler: SuggestionCommandHandler {
353353
guard var selection = editor.selections.last,
354354
selection.start != selection.end
355355
else { return ("", .cursor(editor.cursorPosition)) }
356-
// always start from char 0 so that it can keep the indentation.
357-
selection.start = .init(line: selection.start.line, character: 0)
356+
if selection.start.line != selection.end.line {
357+
// when there are multiple lines start from char 0 so that it can keep the indentation.
358+
selection.start = .init(line: selection.start.line, character: 0)
359+
}
358360
return (
359361
editor.selectedCode(in: selection),
360362
.init(

0 commit comments

Comments
 (0)