summaryrefslogtreecommitdiffstats
path: root/qt-ui/tagwidget.cpp
diff options
context:
space:
mode:
authorGravatar Gehad <gehadelrobey@gmail.com>2014-04-23 10:06:45 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-04-23 07:22:03 -0700
commite088067ef12f5e2032f6b742ef103c582283f84a (patch)
tree68621ad1b2e57b9a2c26d571c4d00a834f09a0c5 /qt-ui/tagwidget.cpp
parentd4617803691c3193fb0a898fa39b0688379e17cd (diff)
downloadsubsurface-e088067ef12f5e2032f6b742ef103c582283f84a.tar.gz
Fix a minor bug in the tags widget.
Using the auto-completer while the tags widget is 'empty', always picked the first choice. Write some letters and remove them in an empty tags widget, the complete list of tags will appear - now if you try to choose any tag with the keyboard arrows it will choose the first one. also if you tried choosing it by mouse it will be inserted twice. This is fixed by removing the unneeded else part. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/tagwidget.cpp')
-rw-r--r--qt-ui/tagwidget.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/qt-ui/tagwidget.cpp b/qt-ui/tagwidget.cpp
index fbebe3f35..dfeeac537 100644
--- a/qt-ui/tagwidget.cpp
+++ b/qt-ui/tagwidget.cpp
@@ -146,13 +146,8 @@ void TagWidget::completionSelected(const QString& completion)
void TagWidget::completionHighlighted(const QString& completion)
{
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());
- } else {
- setText(completion + QString(", "));
- setCursorPosition(text().length());
- }
+ setText(text().remove(pos.first, pos.second - pos.first).insert(pos.first, completion));
+ setCursorPosition(pos.first + completion.length());
}
void TagWidget::setCursorPosition(int position)