From 0b0f55e8f8875359be2d1ec169969bcf7d3121b9 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 29 Dec 2011 11:20:49 +0000 Subject: [PATCH] + fix problems with call tips window if text after dot is not a word + fix problems with history in python console git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5356 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d --- src/Gui/CallTips.cpp | 7 +++++++ src/Gui/PythonConsole.cpp | 14 +++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Gui/CallTips.cpp b/src/Gui/CallTips.cpp index 25a3ccc11..72aa941c1 100644 --- a/src/Gui/CallTips.cpp +++ b/src/Gui/CallTips.cpp @@ -156,6 +156,13 @@ void CallTipsList::validateCursor() cursor.setPosition(this->cursorPos); cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor); QString word = cursor.selectedText(); + if (!word.isEmpty()) { + // the following text might be an operator, brackets, ... + const QChar underscore = QLatin1Char('_'); + const QChar ch = word.at(0); + if (!ch.isLetterOrNumber() && ch != underscore) + word.clear(); + } if (currentPos > this->cursorPos+word.length()) { hide(); } diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index a9ce79959..cc4f66ffb 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -548,8 +548,20 @@ void PythonConsole::keyPressEvent(QKeyEvent * e) restartHistory = false; } break; - case Qt::Key_Backspace: case Qt::Key_Left: + { + if (cursor > inputLineBegin) + { TextEdit::keyPressEvent(e); } + restartHistory = false; + } break; + + case Qt::Key_Right: + { + TextEdit::keyPressEvent(e); + restartHistory = false; + } break; + + case Qt::Key_Backspace: { if (cursor > inputLineBegin) { TextEdit::keyPressEvent(e); }