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>
This commit is contained in:
Tomaz Canabrava 2014-03-19 16:30:13 -03:00 committed by Dirk Hohndel
parent ec2ea7ec3a
commit 5b497b5655

View file

@ -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());