diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2014-03-19 15:23:58 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-03-20 09:47:43 -0700 |
commit | 3d83c48c496388586408fc418f027b726bf8d184 (patch) | |
tree | ef3bf48deb8a6111305d934bab2139476ef9d8ca /qt-ui | |
parent | 519f45416fd3d074663e232f30ead849242b2dfd (diff) | |
download | subsurface-3d83c48c496388586408fc418f027b726bf8d184.tar.gz |
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>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/tagwidget.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/qt-ui/tagwidget.cpp b/qt-ui/tagwidget.cpp index 2733a144c..4c71c5fac 100644 --- a/qt-ui/tagwidget.cpp +++ b/qt-ui/tagwidget.cpp @@ -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) |