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>
This commit is contained in:
Gehad 2014-04-23 10:06:45 +02:00 committed by Dirk Hohndel
parent d461780369
commit e088067ef1

View file

@ -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)