Browse Source

bug-fix: locating to current file should not always change to two panels view

Le Tan 8 years ago
parent
commit
ce2a572211
2 changed files with 15 additions and 4 deletions
  1. 13 4
      src/vmainwindow.cpp
  2. 2 0
      src/vmainwindow.h

+ 13 - 4
src/vmainwindow.cpp

@@ -301,9 +301,7 @@ void VMainWindow::initViewToolBar(QSize p_iconSize)
                     break;
 
                 case (int)PanelViewState::CompactMode:
-                    m_panelViewState = PanelViewState::CompactMode;
-                    g_config->setEnableCompactMode(true);
-                    changePanelView(m_panelViewState);
+                    compactModeView();
                     break;
 
                 default:
@@ -1807,6 +1805,13 @@ void VMainWindow::twoPanelView()
     changePanelView(m_panelViewState);
 }
 
+void VMainWindow::compactModeView()
+{
+    m_panelViewState = PanelViewState::CompactMode;
+    g_config->setEnableCompactMode(true);
+    changePanelView(m_panelViewState);
+}
+
 void VMainWindow::toggleOnePanelView()
 {
     if (m_panelViewState == PanelViewState::TwoPanels) {
@@ -2139,7 +2144,11 @@ bool VMainWindow::locateFile(VFile *p_file)
     }
 
     // Open the directory and file panels after location.
-    twoPanelView();
+    if (m_panelViewState == PanelViewState::CompactMode) {
+        compactModeView();
+    } else {
+        twoPanelView();
+    }
 
     return ret;
 }

+ 2 - 0
src/vmainwindow.h

@@ -119,6 +119,7 @@ private slots:
     void changeHighlightTrailingSapce(bool p_checked);
     void onePanelView();
     void twoPanelView();
+    void compactModeView();
     void curEditFileInfo();
     void deleteCurNote();
     void handleCurrentDirectoryChanged(const VDirectory *p_dir);
@@ -268,6 +269,7 @@ private:
     VVimIndicator *m_vimIndicator;
     VTabIndicator *m_tabIndicator;
 
+    // SinglePanel, TwoPanels, CompactMode.
     PanelViewState m_panelViewState;
 
     // Actions