From 3d83c48c496388586408fc418f027b726bf8d184 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 19 Mar 2014 15:23:58 -0300 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/tagwidget.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'qt-ui/tagwidget.cpp') 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 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) -- cgit v1.2.3-70-g09d2