Skip to content

Commit f915ba5

Browse files
committed
BUG: preserve whitespace in console completion
Erasing whitespace doesn't make very much sense for any language, but especially not for python. Fixes commontk#751
1 parent dc3ac0d commit f915ba5

File tree

1 file changed

+2
-32
lines changed

1 file changed

+2
-32
lines changed

Libs/Widgets/ctkConsole.cpp

+2-32
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
All rights reserved.
2626
2727
ParaView is a free software; you can redistribute it and/or modify it
28-
under the terms of the ParaView license version 1.2.
28+
under the terms of the ParaView license version 1.2.
2929
3030
See http://www.paraview.org/paraview/project/license.html for the full ParaView license.
3131
A copy of this license can be obtained by contacting
@@ -457,7 +457,7 @@ void ctkConsolePrivate::keyPressEvent(QKeyEvent* e)
457457
return;
458458
}
459459

460-
// There seems to be no QKeySequence for backspace, therefore the key
460+
// There seems to be no QKeySequence for backspace, therefore the key
461461
// has to be recognized directly (the same way as it is done in the parent class)
462462
if (e->key() == Qt::Key_Backspace && !(e->modifiers() & ~Qt::ShiftModifier))
463463
{
@@ -690,36 +690,6 @@ void ctkConsolePrivate::updateCompleter()
690690
commandText.remove('\r'); // not recongnize by python
691691
//commandText.replace(QRegExp("\\s*$"), ""); // Remove trailing spaces ---- DOESN'T WORK ----
692692

693-
// Remove useless spaces
694-
bool betweenSingleQuotes = false;
695-
bool betweenDoubleQuotes = false;
696-
if (commandText.contains(" "))
697-
{
698-
// For each char
699-
for (int i=0; i<commandText.size();i++)
700-
{
701-
// Verify if you are between betweenDoubleQuotes:" " or betweenSingleQuotes:' '
702-
QChar c = commandText.at(i);
703-
if (c == '\'' && !betweenDoubleQuotes)
704-
{
705-
betweenSingleQuotes = !betweenSingleQuotes;
706-
}
707-
if (c == '"' && !betweenSingleQuotes)
708-
{
709-
betweenDoubleQuotes = !betweenDoubleQuotes;
710-
}
711-
// If we are not between quote: Erase spaces
712-
if (!betweenSingleQuotes && !betweenDoubleQuotes)
713-
{
714-
if (c == ' ')
715-
{
716-
commandText.remove(i,1);
717-
i--; // because we removed a char
718-
}
719-
}
720-
}
721-
}
722-
723693
// Save current positions: Since some implementation of
724694
// updateCompletionModel (e.g python) can display messages
725695
// while building the completion model, it is important to save

0 commit comments

Comments
 (0)