FakeVim: Fix searching in visual mode and with commands

Search in visual mode should select text up to matched position.

Using commands should work with search movement; e.g. 'd2/needle<CR>'.
Commands should be also properly canceled if search movement fails.

Change-Id: Ic695dccaf3f36ccae2f2b1a93f888d5ba9805a78
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
hluk
2013-09-15 16:19:05 +02:00
committed by hjk
parent 8c7a9a51ec
commit a636a933d0
3 changed files with 87 additions and 43 deletions

View File

@@ -122,7 +122,6 @@ class MiniBuffer : public QStackedWidget
public:
MiniBuffer() : m_label(new QLabel(this)), m_edit(new QLineEdit(this)), m_eventFilter(0)
{
m_edit->installEventFilter(this);
connect(m_edit, SIGNAL(textEdited(QString)), SLOT(changed()));
connect(m_edit, SIGNAL(cursorPositionChanged(int,int)), SLOT(changed()));
connect(m_edit, SIGNAL(selectionChanged()), SLOT(changed()));
@@ -206,18 +205,6 @@ private slots:
emit edited(m_edit->text(), cursorPos, anchorPos);
}
bool eventFilter(QObject *ob, QEvent *ev)
{
// cancel editing on escape
if (m_eventFilter != 0 && ob == m_edit && ev->type() == QEvent::ShortcutOverride
&& static_cast<QKeyEvent*>(ev)->key() == Qt::Key_Escape) {
emit edited(QString(), -1, -1);
ev->accept();
return true;
}
return false;
}
private:
QLabel *m_label;
QLineEdit *m_edit;