Summary: | auto-completion should show only such possible endings which to access in the list would cost less keypresses than to simply type the word in | ||
---|---|---|---|
Product: | [Applications] kate | Reporter: | Wolfram R. Sieber <Wolfram.R.Sieber> |
Component: | general | Assignee: | KWrite Developers <kwrite-bugs-null> |
Status: | RESOLVED INTENTIONAL | ||
Severity: | wishlist | CC: | christoph |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Wolfram R. Sieber
2007-01-29 02:15:02 UTC
SVN commit 630056 by alund: sort the list for the popup completion don't consider matches adding less than 2 characthers for popup completion. this could be made configurable, or smarter. CCBUG: 140803 M +4 -3 docwordcompletion.cpp M +1 -1 docwordcompletion.h --- trunk/KDE/kdelibs/kate/plugins/wordcompletion/docwordcompletion.cpp #630055:630056 @@ -72,7 +72,8 @@ void DocWordCompletionModel::saveMatches( KTextEditor::View* view, const KTextEditor::Range& range) { - m_matches = allMatches( view, range ); + m_matches = allMatches( view, range, 2 ); + m_matches.sort(); } QVariant DocWordCompletionModel::data(const QModelIndex& index, int role) const @@ -114,7 +115,7 @@ // Scan throughout the entire document for possible completions, // ignoring any dublets -const QStringList DocWordCompletionModel::allMatches( KTextEditor::View *view, const KTextEditor::Range &range ) const +const QStringList DocWordCompletionModel::allMatches( KTextEditor::View *view, const KTextEditor::Range &range, int minAdditionalLength ) const { QStringList l; @@ -125,7 +126,7 @@ int i( 0 ); int pos( 0 ); KTextEditor::Document *doc = view->document(); - QRegExp re( "\\b(" + doc->text( range ) + "\\w+)" ); + QRegExp re( "\\b(" + doc->text( range ) + "\\w{" + QString::number(minAdditionalLength) + ",})" ); QString s, m; QHash<QString,int> seen; --- trunk/KDE/kdelibs/kate/plugins/wordcompletion/docwordcompletion.h #630055:630056 @@ -58,7 +58,7 @@ QVariant data(const QModelIndex& index, int role) const; virtual QModelIndex index(int row, int column, const QModelIndex& parent=QModelIndex()) const; - const QStringList allMatches( KTextEditor::View *view, const KTextEditor::Range &range ) const; + const QStringList allMatches( KTextEditor::View *view, const KTextEditor::Range &range, int minAdditionalLength = 1 ) const; private: QStringList m_matches; This should be configurable in the gui :) If I'm searching for an entry I'm not entirely sure it still should be able to show. I hope it is still available in the bidirectional search (find next/prev). Rather stupid example: was it m_search or m_searches? ;) It only affects the popup, and i will add an option for it. Anders: Thanks for considering the request. Your are great. :-) Dominik: Thanks for your support. :) The exactly same report but for KDevelop (code-completion): https://bugs.kde.org/show_bug.cgi?id=127100 I disagree: having a word show up means, you have at least typed it once, this allows e.g. to avoid typing errors, even if it would be the same number of keypresses to type it. |