From f2c26d8353de0b53d72093cbe1763459428ee0e9 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Thu, 10 May 2018 20:07:53 +0800 Subject: [PATCH] VFileList: do not close current tab when opening Unknown file in single click --- src/vfilelist.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/vfilelist.cpp b/src/vfilelist.cpp index f026d2e5..df0409fd 100644 --- a/src/vfilelist.cpp +++ b/src/vfilelist.cpp @@ -685,12 +685,18 @@ void VFileList::handleItemClicked(QListWidgetItem *p_item) return; } - // Get current tab which will be closed if click timer timeouts. - VEditTab *tab = editArea->getCurrentTab(); - if (tab) { - m_fileToCloseInSingleClick = tab->getFile(); - } else { + // EditArea will open Unknown file using system's default program, in which + // case we should now close current file even after single click. + if (file->getDocType() == DocType::Unknown) { m_fileToCloseInSingleClick = NULL; + } else { + // Get current tab which will be closed if click timer timeouts. + VEditTab *tab = editArea->getCurrentTab(); + if (tab) { + m_fileToCloseInSingleClick = tab->getFile(); + } else { + m_fileToCloseInSingleClick = NULL; + } } }