#include "LyX.h"
#include "LyXRC.h"
#include "Paragraph.h"
+#include "qt_helpers.h"
#include "version.h"
#include "support/lassert.h"
+#include "support/lstrings.h"
#include "support/debug.h"
#include <QApplication>
// get icon from cache
QPixmap scaled;
QString const name = ":" + toqstr(list_->icon(index.row()));
+ if (name == ":")
+ return scaled;
if (!QPixmapCache::find("completion" + name, scaled)) {
// load icon from disk
QPixmap p = QPixmap(name);
docstring postfix = qstring_to_ucs4(completion.mid(prefix.length()));
// shorten it if necessary
- if (lyxrc.completion_inline_dots != -1
- && postfix.size() > unsigned(lyxrc.completion_inline_dots))
- postfix = postfix.substr(0, lyxrc.completion_inline_dots - 1) + "...";
+ if (lyxrc.completion_inline_dots != -1)
+ support::truncateWithEllipsis(postfix,
+ unsigned(lyxrc.completion_inline_dots));
// set inline completion at cursor position
size_t uniqueTo = max(longestUniqueCompletion().size(), prefix.size());
i = n;
else
i = l;
- LASSERT(i <= n, /**/);
+ // we can try to recover
+ LASSERT(i <= n, i = 0);
}
// select the first if none was found