summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-03-19 16:30:13 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-20 09:48:19 -0700
commit5b497b5655664a214aed191587bce0b4814ae18c (patch)
treed23fc4c9c707492e19c16a8fc655cf7fccfd8c6e
parentec2ea7ec3ad0cb7cc504aad19f8620329c5ff8b2 (diff)
downloadsubsurface-5b497b5655664a214aed191587bce0b4814ae18c.tar.gz
Don't create then set, do both at the same time.
When we create, then set the value of a variable, we are wasting cycles and making the code more verbose. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/tagwidget.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/qt-ui/tagwidget.cpp b/qt-ui/tagwidget.cpp
index 821089c15..891b66425 100644
--- a/qt-ui/tagwidget.cpp
+++ b/qt-ui/tagwidget.cpp
@@ -145,8 +145,7 @@ void TagWidget::completionSelected(const QString& completion)
void TagWidget::completionHighlighted(const QString& completion)
{
- QPair<int, int> pos;
- pos = getCursorTagPosition();
+ QPair<int, int> pos = getCursorTagPosition();
if (pos.first >= 0 && pos.second > 0) {
setText(text().remove(pos.first, pos.second - pos.first).insert(pos.first, completion));
setCursorPosition(pos.first + completion.length());