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:
parent
ec2ea7ec3a
commit
5b497b5655
@ -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());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user