diff --git a/src/plugins/fakevim/fakevimactions.cpp b/src/plugins/fakevim/fakevimactions.cpp
index 6b7029e7574..6e0426b04db 100644
--- a/src/plugins/fakevim/fakevimactions.cpp
+++ b/src/plugins/fakevim/fakevimactions.cpp
@@ -193,6 +193,7 @@ FakeVimSettings *theFakeVimSettings()
createAction(s, ConfigIncSearch, true, _("IncSearch"), _("is"));
createAction(s, ConfigUseCoreSearch, false, _("UseCoreSearch"), _("ucs"));
createAction(s, ConfigSmartCase, false, _("SmartCase"), _("scs"));
+ createAction(s, ConfigIgnoreCase, false, _("IgnoreCase"), _("ic"));
createAction(s, ConfigWrapScan, true, _("WrapScan"), _("ws"));
createAction(s, ConfigShowCmd, true, _("ShowCmd"), _("sc"));
createAction(s, ConfigScrollOff, 0, _("ScrollOff"), _("so"));
diff --git a/src/plugins/fakevim/fakevimactions.h b/src/plugins/fakevim/fakevimactions.h
index 0bcf9e8c054..2ff3790edfb 100644
--- a/src/plugins/fakevim/fakevimactions.h
+++ b/src/plugins/fakevim/fakevimactions.h
@@ -75,6 +75,7 @@ enum FakeVimSettingsCode
ConfigIncSearch,
ConfigUseCoreSearch,
ConfigSmartCase,
+ ConfigIgnoreCase,
ConfigWrapScan,
// indent allow backspacing over autoindent
diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp
index 4e3296c710e..e061d76e7de 100644
--- a/src/plugins/fakevim/fakevimhandler.cpp
+++ b/src/plugins/fakevim/fakevimhandler.cpp
@@ -348,7 +348,7 @@ static bool eatString(const char *prefix, QString *str)
return true;
}
-static QRegExp vimPatternToQtPattern(QString needle, bool smartcase)
+static QRegExp vimPatternToQtPattern(QString needle, bool ignoreCaseOption, bool smartCaseOption)
{
/* Transformations (Vim regexp -> QRegExp):
* \a -> [A-Za-z]
@@ -379,7 +379,9 @@ static QRegExp vimPatternToQtPattern(QString needle, bool smartcase)
* \c - set ignorecase for rest
* \C - set noignorecase for rest
*/
- bool ignorecase = smartcase && !needle.contains(QRegExp(_("[A-Z]")));
+ // FIXME: Option smartcase should be used only if search was typed by user.
+ bool ignorecase = ignoreCaseOption
+ && !(smartCaseOption && needle.contains(QRegExp(_("[A-Z]"))));
QString pattern;
pattern.reserve(2 * needle.size());
@@ -4724,7 +4726,8 @@ bool FakeVimHandler::Private::handleExSubstituteCommand(const ExCommand &cmd)
if (g.lastSubstituteFlags.contains(QLatin1Char('i')))
needle.prepend(_("\\c"));
- QRegExp pattern = vimPatternToQtPattern(needle, hasConfig(ConfigSmartCase));
+ QRegExp pattern = vimPatternToQtPattern(needle, hasConfig(ConfigIgnoreCase),
+ hasConfig(ConfigSmartCase));
QTextBlock lastBlock;
QTextBlock firstBlock;
@@ -5448,7 +5451,8 @@ void FakeVimHandler::Private::searchBalanced(bool forward, QChar needle, QChar o
QTextCursor FakeVimHandler::Private::search(const SearchData &sd, int startPos, int count,
bool showMessages)
{
- QRegExp needleExp = vimPatternToQtPattern(sd.needle, hasConfig(ConfigSmartCase));
+ QRegExp needleExp = vimPatternToQtPattern(sd.needle, hasConfig(ConfigIgnoreCase),
+ hasConfig(ConfigSmartCase));
if (!needleExp.isValid()) {
if (showMessages) {
QString error = needleExp.errorString();
diff --git a/src/plugins/fakevim/fakevimoptions.ui b/src/plugins/fakevim/fakevimoptions.ui
index 25e12a08351..48590d7f6e0 100644
--- a/src/plugins/fakevim/fakevimoptions.ui
+++ b/src/plugins/fakevim/fakevimoptions.ui
@@ -24,17 +24,45 @@
Vim Behavior
- -
-
+
-
+
- Smart tabulators
+ Keyword characters:
- -
+
-
+
+
+ Location of .vimrc:
+
+
+
+ -
+
+
+ Read .vimrc
+
+
+
+ -
- -
+
-
+
+
+ Use wrapscan
+
+
+
+ -
+
+
+ Automatic indentation
+
+
+
+ -
Qt::Vertical
@@ -57,52 +85,7 @@
- -
-
-
- Start of line
-
-
-
- -
-
-
- Smart indentation
-
-
-
- -
-
-
- Expand tabulators
-
-
-
- -
-
-
- Automatic indentation
-
-
-
- -
-
-
- Pass key sequences like Ctrl-S to Qt Creator core instead of interpreting them in FakeVim. This gives easier access to Qt Creator core functionality at the price of losing some features of FakeVim.
-
-
- Pass control key
-
-
-
- -
-
-
- Highlight search results
-
-
-
- -
+
-
-
@@ -129,14 +112,37 @@
- -
-
-
- Show partial command
-
-
+
-
+
+
-
+
+
+ 1
+
+
+ 80
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
- -
+
-
+
+
+ -
Backspace:
@@ -144,6 +150,13 @@
-
+
+
+ Shift width:
+
+
+
+ -
Vim tabstop option
@@ -153,24 +166,32 @@
- -
-
-
- -
-
+
-
+
- Shift width:
+ Use smartcase
- -
-
-
- Incremental search
-
-
+
-
+
+
-
+
+
+ Keep empty to use the default path, i.e. %USERPROFILE%\_vimrc on Windows, ~/.vimrc otherwise.
+
+
+
+ -
+
+
+ Browse...
+
+
+
+
- -
+
-
-
@@ -208,92 +229,78 @@
- -
+
-
Show position of text marks
- -
-
+
-
+
- Use smartcase
-
-
-
- -
-
-
- Use wrapscan
-
-
-
- -
-
-
-
-
-
- 1
-
-
- 80
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
- Keyword characters:
-
-
-
- -
-
-
- Location of .vimrc:
+ Smart indentation
-
-
+
+
+ Pass key sequences like Ctrl-S to Qt Creator core instead of interpreting them in FakeVim. This gives easier access to Qt Creator core functionality at the price of losing some features of FakeVim.
+
- Read .vimrc
+ Pass control key
- -
-
-
-
-
-
- Keep empty to use the default path, i.e. %USERPROFILE%\_vimrc on Windows, ~/.vimrc otherwise.
-
-
-
- -
-
-
- Browse...
-
-
-
-
+ -
+
+
+ Use ignorecase
+
+
+
+ -
+
+
+ Expand tabulators
+
+
+
+ -
+
+
+ Smart tabulators
+
+
+
+ -
+
+
+ Highlight search results
+
+
+
+ -
+
+
+ Incremental search
+
+
+
+ -
+
+
+ Show partial command
+
+
+
+ -
+
+
+ Start of line
+
+
@@ -320,10 +327,11 @@
checkBoxExpandTab
checkBoxSmartTab
checkBoxHlSearch
- checkBoxIncSearch
checkBoxShowCmd
checkBoxStartOfLine
+ checkBoxIncSearch
checkBoxUseCoreSearch
+ checkBoxIgnoreCase
checkBoxSmartCase
checkBoxWrapScan
checkBoxShowMarks
diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp
index db30a5fa83f..f85a76c6581 100644
--- a/src/plugins/fakevim/fakevimplugin.cpp
+++ b/src/plugins/fakevim/fakevimplugin.cpp
@@ -313,6 +313,8 @@ QWidget *FakeVimOptionPage::createPage(QWidget *parent)
m_ui.checkBoxUseCoreSearch);
m_group.insert(theFakeVimSetting(ConfigSmartCase),
m_ui.checkBoxSmartCase);
+ m_group.insert(theFakeVimSetting(ConfigIgnoreCase),
+ m_ui.checkBoxIgnoreCase);
m_group.insert(theFakeVimSetting(ConfigWrapScan),
m_ui.checkBoxWrapScan);
@@ -1792,9 +1794,8 @@ void FakeVimPluginPrivate::handleExCommand(bool *handled, const ExCommand &cmd)
} else if (cmd.args == _("noic") || cmd.args == _("noignorecase")) {
// :set noic
setActionChecked(Find::Constants::CASE_SENSITIVE, true);
- } else {
- *handled = false; // Let the handler see it as well.
}
+ *handled = false; // Let the handler see it as well.
} else if (cmd.matches(_("n"), _("next"))) {
// :n[ext]
switchToFile(currentFile() + cmd.count);