mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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
1 changed files with 2 additions and 11 deletions
|
@ -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…
Add table
Reference in a new issue