- // We remove the second window from the view
- wxWindow *removedWindow = m_windowTwo;
- m_windowTwo = (wxWindow *) NULL;
- SendUnsplitEvent(removedWindow);
- m_sashPosition = 0;
+ // Deal with possible unsplit scenarios
+ if ( new_sash_position == 0 )
+ {
+ // We remove the first window from the view
+ wxWindow *removedWindow = m_windowOne;
+ m_windowOne = m_windowTwo;
+ m_windowTwo = (wxWindow *) NULL;
+ SendUnsplitEvent(removedWindow);
+ m_sashPosition = 0;
+ }
+ else if ( new_sash_position == window_size )
+ {
+ // We remove the second window from the view
+ wxWindow *removedWindow = m_windowTwo;
+ m_windowTwo = (wxWindow *) NULL;
+ SendUnsplitEvent(removedWindow);
+ m_sashPosition = 0;
+ }
+ else
+ {
+ m_sashPosition = new_sash_position;
+ }