Allow inserting tabs at the start of the REPL input

* If there is no non-whitespace input, we shouldn't try to autocomplete
This commit is contained in:
baldurk
2026-08-27 12:43:22 +01:00
parent 928cfcd80a
commit 72db77ae7c
+11 -3
View File
@@ -2229,9 +2229,17 @@ void PythonShell::interactive_keypress(QKeyEvent *event)
{
// manually trigger a completion with tab
case Qt::Key_Tab:
m_InteractiveCompleter->activated(
m_InteractiveCompleter->popup()->selectionModel()->currentIndex());
m_InteractiveCompleter->popup()->hide();
// allow prefixed tabs to be inserted
if(ui->lineInput->text().trimmed().isEmpty())
{
ui->lineInput->insert(lit("\t"));
}
else
{
m_InteractiveCompleter->activated(
m_InteractiveCompleter->popup()->selectionModel()->currentIndex());
m_InteractiveCompleter->popup()->hide();
}
return;
// if a completion is in progress ignore any events the completer will process
case Qt::Key_Return: