[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [ktexteditor] src/vimode: Move some more Search-related stuff into SearchMode.
From: Simon St James <kdedevel () etotheipiplusone ! com>
Date: 2016-06-17 8:18:10
Message-ID: E1bDoyg-0002ZN-4e () scm ! kde ! org
[Download RAW message or body]
Git commit 9da7bd9879de2fe797dd42b8906b175b6883e8b2 by Simon St James.
Committed on 17/06/2016 at 08:14.
Pushed by sstjames into branch 'master'.
Move some more Search-related stuff into SearchMode.
M +18 -12 src/vimode/emulatedcommandbar.cpp
M +4 -3 src/vimode/emulatedcommandbar.h
http://commits.kde.org/ktexteditor/9da7bd9879de2fe797dd42b8906b175b6883e8b2
diff --git a/src/vimode/emulatedcommandbar.cpp b/src/vimode/emulatedcommandbar.cpp
index 63012f0..7f9a9fa 100644
--- a/src/vimode/emulatedcommandbar.cpp
+++ b/src/vimode/emulatedcommandbar.cpp
@@ -451,7 +451,7 @@ bool EmulatedCommandBar::completerHandledKeypress ( const \
QKeyEvent* keyEvent ) if (m_mode == Command) {
completionStartParams = \
m_commandMode->completionInvoked(CompletionInvocation::ExtraContext); } else {
- completionStartParams = activateSearchHistoryCompletion();
+ completionStartParams = \
m_searchMode->completionInvoked(CompletionInvocation::ExtraContext); }
startCompletion(completionStartParams);
if (m_currentCompletionType != None) {
@@ -473,7 +473,7 @@ bool EmulatedCommandBar::completerHandledKeypress ( const \
QKeyEvent* keyEvent ) if (m_mode == Command) {
completionStartParams = \
m_commandMode->completionInvoked(CompletionInvocation::NormalContext); } else {
- completionStartParams = activateSearchHistoryCompletion();
+ completionStartParams = \
m_searchMode->completionInvoked(CompletionInvocation::NormalContext); }
startCompletion(completionStartParams);
setCompletionIndex(m_completer->completionCount() - 1);
@@ -637,16 +637,6 @@ void EmulatedCommandBar::replaceWordBeforeCursorWith(const \
QString &newWord) m_edit->setCursorPosition(wordBeforeCursorStart + \
newWord.length()); }
-EmulatedCommandBar::CompletionStartParams \
EmulatedCommandBar::activateSearchHistoryCompletion()
-{
- m_currentCompletionType = SearchHistory;
- CompletionStartParams completionStartParams;
- completionStartParams.completions = \
reversed(m_viInputModeManager->globalState()->searchHistory()->items());
- completionStartParams.shouldStart = true;
- completionStartParams.wordStartPos = 0;
- return completionStartParams;
-}
-
EmulatedCommandBar::CompletionStartParams \
EmulatedCommandBar::activateWordFromDocumentCompletion() {
m_currentCompletionType = WordFromDocument;
@@ -1130,6 +1120,22 @@ void EmulatedCommandBar::SearchMode::deactivate(bool \
wasAborted)
}
+EmulatedCommandBar::CompletionStartParams \
EmulatedCommandBar::SearchMode::completionInvoked ( \
EmulatedCommandBar::CompletionInvocation invocationType ) +{
+ Q_UNUSED(invocationType);
+ return activateSearchHistoryCompletion();
+}
+
+EmulatedCommandBar::CompletionStartParams \
EmulatedCommandBar::SearchMode::activateSearchHistoryCompletion() +{
+ setCompletionMode(KateVi::EmulatedCommandBar::SearchHistory);
+ CompletionStartParams completionStartParams;
+ completionStartParams.completions = \
reversed(m_viInputModeManager->globalState()->searchHistory()->items()); + \
completionStartParams.shouldStart = true; + completionStartParams.wordStartPos = \
0; + return completionStartParams;
+}
+
void EmulatedCommandBar::SearchMode::setBarBackground ( \
EmulatedCommandBar::SearchMode::BarBackgroundStatus status ) {
QPalette barBackground(m_edit->palette());
diff --git a/src/vimode/emulatedcommandbar.h b/src/vimode/emulatedcommandbar.h
index 3927530..e712506 100644
--- a/src/vimode/emulatedcommandbar.h
+++ b/src/vimode/emulatedcommandbar.h
@@ -157,6 +157,8 @@ private:
QLabel *m_interactiveSedReplaceLabel;
};
+ enum class CompletionInvocation { ExtraContext, NormalContext }; // TODO - make \
member of upcoming Completer class. +
class SearchMode : public ActiveMode
{
public:
@@ -169,6 +171,7 @@ private:
void setViInputModeManager(InputModeManager *viInputModeManager);
virtual bool handleKeyPress ( const QKeyEvent* keyEvent );
void editTextChanged(const QString &newText);
+ CompletionStartParams completionInvoked(CompletionInvocation \
invocationType); void deactivate(bool wasAborted);
bool isSendingSyntheticSearchCompletedKeypress() const
{
@@ -182,13 +185,12 @@ private:
SearchDirection m_searchDirection;
KTextEditor::Cursor m_startingCursorPos;
KateVi::Searcher::SearchParams m_currentSearchParams;
+ CompletionStartParams activateSearchHistoryCompletion();
enum BarBackgroundStatus { Normal, MatchFound, NoMatchFound };
void setBarBackground(BarBackgroundStatus status);
bool m_isSendingSyntheticSearchCompletedKeypress = false;
};
- enum class CompletionInvocation { ExtraContext, NormalContext }; // TODO - make \
member of upcoming Completer class.
-
class CommandMode : public ActiveMode
{
public:
@@ -271,7 +273,6 @@ private:
int wordBeforeCursorBegin();
void replaceWordBeforeCursorWith(const QString &newWord);
- CompletionStartParams activateSearchHistoryCompletion();
CompletionStartParams activateWordFromDocumentCompletion();
void startCompletion(const CompletionStartParams& completionStartParams);
void deactivateCompletion();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic