bug-fix: save wrong geometry state in single panel view

This commit is contained in:
Le Tan 2017-07-21 22:09:40 +08:00
parent 365c0ce91f
commit 226263f77c
4 changed files with 15 additions and 1 deletions

View File

@ -1311,7 +1311,10 @@ bool VVim::handleKeyPressEvent(int key, int modifiers, int *p_autoIndentPos)
case Qt::Key_Escape:
{
// Clear selection and enter normal mode.
clearSelection();
bool ret = clearSelection();
if (!ret && checkMode(VimMode::Normal)) {
emit m_editor->requestCloseFindReplaceDialog();
}
setMode(VimMode::Normal);
break;

View File

@ -154,6 +154,9 @@ signals:
// Selection changed by mouse.
void selectionChangedByMouse(bool p_hasSelection);
// Request the edit tab to close find and replace dialog.
void requestCloseFindReplaceDialog();
public slots:
virtual void highlightCurrentLine();

View File

@ -1538,6 +1538,10 @@ void VMainWindow::closeEvent(QCloseEvent *event)
void VMainWindow::saveStateAndGeometry()
{
// In one panel view, it will save the wrong state that the directory tree
// panel has a width of zero.
twoPanelView();
vconfig.setMainWindowGeometry(saveGeometry());
vconfig.setMainWindowState(saveState());
vconfig.setToolsDockChecked(toolDock->isVisible());

View File

@ -323,6 +323,10 @@ void VMdTab::setupMarkdownEditor()
this, &VEditTab::statusMessage);
connect(m_editor, &VEdit::vimStatusUpdated,
this, &VEditTab::vimStatusUpdated);
connect(m_editor, &VEdit::requestCloseFindReplaceDialog,
this, [this](){
this->m_editArea->getFindReplaceDialog()->closeDialog();
});
m_editor->reloadFile();
m_stacks->addWidget(m_editor);