Code Cleanup
The offending code is line-by-line equal to the completion highlited method, so why make it duplicated? Call that method instead. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
519f45416f
commit
3d83c48c49
@ -140,16 +140,8 @@ void TagWidget::reparse()
|
||||
|
||||
void TagWidget::completionSelected(QString completion)
|
||||
{
|
||||
QPair<int, int> pos;
|
||||
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());
|
||||
} else {
|
||||
setText(completion.append(", "));
|
||||
setCursorPosition(text().length());
|
||||
}
|
||||
emit(textChanged());
|
||||
completionHighlighted(completion);
|
||||
emit textChanged();
|
||||
}
|
||||
|
||||
void TagWidget::completionHighlighted(QString completion)
|
||||
@ -163,7 +155,6 @@ void TagWidget::completionHighlighted(QString completion)
|
||||
setText(completion.append(", "));
|
||||
setCursorPosition(text().length());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void TagWidget::setCursorPosition(int position)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user