@@ -9030,19 +9030,33 @@ HBITMAP Notepad_plus::generateSolidColourMenuItemIcon(COLORREF colour)
90309030 return hNewBitmap;
90319031}
90329032
9033-
9034- void Notepad_plus::clearChangesHistory ()
9033+ void Notepad_plus::clearChangesHistory (int iView)
90359034{
9036- Sci_Position pos = (Sci_Position)::SendMessage (_pEditView->getHSelf (), SCI_GETCURRENTPOS, 0 , 0 );
9037- int chFlags = (int )::SendMessage (_pEditView->getHSelf (), SCI_GETCHANGEHISTORY, 0 , 0 );
9035+ // use current view by default
9036+ ScintillaEditView* pViewToChange = _pEditView;
9037+ ScintillaEditView* pAnotherView = _pNonEditView;
9038+
9039+ if (iView == MAIN_VIEW)
9040+ {
9041+ pViewToChange = &_mainEditView;
9042+ pAnotherView = &_subEditView;
9043+ }
9044+ else if (iView == SUB_VIEW)
9045+ {
9046+ pViewToChange = &_subEditView;
9047+ pAnotherView = &_mainEditView;
9048+ }
9049+
9050+ Sci_Position pos = static_cast <Sci_Position>(::SendMessage (pViewToChange->getHSelf (), SCI_GETCURRENTPOS, 0 , 0 ));
9051+ int chFlags = static_cast <int >(::SendMessage (pViewToChange->getHSelf (), SCI_GETCHANGEHISTORY, 0 , 0 ));
90389052
9039- _pEditView ->execute (SCI_EMPTYUNDOBUFFER);
9040- _pEditView ->execute (SCI_SETCHANGEHISTORY, SC_CHANGE_HISTORY_DISABLED);
9041- _pEditView ->execute (SCI_SETCHANGEHISTORY, chFlags);
9042- _pEditView ->execute (SCI_GOTOPOS, pos);
9053+ pViewToChange ->execute (SCI_EMPTYUNDOBUFFER);
9054+ pViewToChange ->execute (SCI_SETCHANGEHISTORY, SC_CHANGE_HISTORY_DISABLED);
9055+ pViewToChange ->execute (SCI_SETCHANGEHISTORY, chFlags);
9056+ pViewToChange ->execute (SCI_GOTOPOS, pos);
90439057
90449058 checkUndoState ();
9045- _pNonEditView ->redraw (); // Prevent cloned document visual glichy on another view
9059+ pAnotherView ->redraw (); // Prevent cloned document visual glitch on another view
90469060}
90479061
90489062// Based on https://github.com/notepad-plus-plus/notepad-plus-plus/issues/12248#issuecomment-1258561261.
0 commit comments