Skip to content

Commit f69433c

Browse files
committed
Fix one line applying
This needs Qt Creator 17.0.1, which adds Shift+Tab as shortcut for applying the top line.
1 parent 37789b2 commit f69433c

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

llamaplugin.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -556,10 +556,20 @@ void LlamaPlugin::processCompletionResponse(const QString &response)
556556
}
557557

558558
if (can_accept) {
559-
TextEditor::TextSuggestion::Data data;
560-
data.range.begin = Utils::Text::Position::fromCursor(cursor);
561-
data.range.end = Utils::Text::Position::fromCursor(cursor);
562-
data.position = Utils::Text::Position::fromCursor(cursor);
559+
TextSuggestion::Data data;
560+
Text::Position currentPos = Text::Position::fromCursor(cursor);
561+
562+
data.range.begin = currentPos;
563+
data.range.end = currentPos;
564+
data.position = currentPos;
565+
566+
data.range.begin.column -= pos_x;
567+
int separator = content_str.indexOf("\n");
568+
data.range.end.column = pos_x
569+
+ (separator != -1 ? content_str.size() - separator - 1
570+
: content_str.size());
571+
572+
// Workaround for QTCREATORBUG-33303
563573
data.position.column -= pos_x;
564574
data.text = cursor.block().text() + content_str;
565575

0 commit comments

Comments
 (0)