mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-12-08 14:19:47 +01:00
Fix Monitoring in one view affects selections and position in second view
Fix #17046, close #17056
This commit is contained in:
parent
f424ec1590
commit
d3bb31b0ec
@ -9030,19 +9030,33 @@ HBITMAP Notepad_plus::generateSolidColourMenuItemIcon(COLORREF colour)
|
|||||||
return hNewBitmap;
|
return hNewBitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Notepad_plus::clearChangesHistory(int iView)
|
||||||
void Notepad_plus::clearChangesHistory()
|
|
||||||
{
|
{
|
||||||
Sci_Position pos = (Sci_Position)::SendMessage(_pEditView->getHSelf(), SCI_GETCURRENTPOS, 0, 0);
|
// use current view by default
|
||||||
int chFlags = (int)::SendMessage(_pEditView->getHSelf(), SCI_GETCHANGEHISTORY, 0, 0);
|
ScintillaEditView* pViewToChange = _pEditView;
|
||||||
|
ScintillaEditView* pAnotherView = _pNonEditView;
|
||||||
|
|
||||||
_pEditView->execute(SCI_EMPTYUNDOBUFFER);
|
if (iView == MAIN_VIEW)
|
||||||
_pEditView->execute(SCI_SETCHANGEHISTORY, SC_CHANGE_HISTORY_DISABLED);
|
{
|
||||||
_pEditView->execute(SCI_SETCHANGEHISTORY, chFlags);
|
pViewToChange = &_mainEditView;
|
||||||
_pEditView->execute(SCI_GOTOPOS, pos);
|
pAnotherView = &_subEditView;
|
||||||
|
}
|
||||||
|
else if (iView == SUB_VIEW)
|
||||||
|
{
|
||||||
|
pViewToChange = &_subEditView;
|
||||||
|
pAnotherView = &_mainEditView;
|
||||||
|
}
|
||||||
|
|
||||||
|
Sci_Position pos = static_cast<Sci_Position>(::SendMessage(pViewToChange->getHSelf(), SCI_GETCURRENTPOS, 0, 0));
|
||||||
|
int chFlags = static_cast<int>(::SendMessage(pViewToChange->getHSelf(), SCI_GETCHANGEHISTORY, 0, 0));
|
||||||
|
|
||||||
|
pViewToChange->execute(SCI_EMPTYUNDOBUFFER);
|
||||||
|
pViewToChange->execute(SCI_SETCHANGEHISTORY, SC_CHANGE_HISTORY_DISABLED);
|
||||||
|
pViewToChange->execute(SCI_SETCHANGEHISTORY, chFlags);
|
||||||
|
pViewToChange->execute(SCI_GOTOPOS, pos);
|
||||||
|
|
||||||
checkUndoState();
|
checkUndoState();
|
||||||
_pNonEditView->redraw(); // Prevent cloned document visual glichy on another view
|
pAnotherView->redraw(); // Prevent cloned document visual glitch on another view
|
||||||
}
|
}
|
||||||
|
|
||||||
// Based on https://github.com/notepad-plus-plus/notepad-plus-plus/issues/12248#issuecomment-1258561261.
|
// Based on https://github.com/notepad-plus-plus/notepad-plus-plus/issues/12248#issuecomment-1258561261.
|
||||||
|
|||||||
@ -662,7 +662,7 @@ private:
|
|||||||
|
|
||||||
HBITMAP generateSolidColourMenuItemIcon(COLORREF colour);
|
HBITMAP generateSolidColourMenuItemIcon(COLORREF colour);
|
||||||
|
|
||||||
void clearChangesHistory();
|
void clearChangesHistory(int iView);
|
||||||
void changedHistoryGoTo(int idGoTo);
|
void changedHistoryGoTo(int idGoTo);
|
||||||
|
|
||||||
HMENU createMenuFromMenu(HMENU hSourceMenu, const std::vector<int>& commandIds);
|
HMENU createMenuFromMenu(HMENU hSourceMenu, const std::vector<int>& commandIds);
|
||||||
|
|||||||
@ -1782,9 +1782,9 @@ void Notepad_plus::command(int id)
|
|||||||
changedHistoryGoTo(id);
|
changedHistoryGoTo(id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_SEARCH_CLEAR_CHANGE_HISTORY:
|
case IDM_SEARCH_CLEAR_CHANGE_HISTORY:
|
||||||
clearChangesHistory();
|
clearChangesHistory(currentView());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_LANG_USER_DLG :
|
case IDM_LANG_USER_DLG :
|
||||||
{
|
{
|
||||||
|
|||||||
@ -609,15 +609,21 @@ bool Notepad_plus::doReload(BufferID id, bool alert)
|
|||||||
_subEditView.restoreCurrentPosPreStep();
|
_subEditView.restoreCurrentPosPreStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto svp = NppParameters::getInstance().getSVP();
|
||||||
|
|
||||||
// Once reload is complete, activate buffer which will take care of
|
// Once reload is complete, activate buffer which will take care of
|
||||||
// many settings such as update status bar, clickable link etc.
|
// many settings such as update status bar, clickable link etc.
|
||||||
if ( ((currentView() == MAIN_VIEW) && mainVisible) || ((currentView() == SUB_VIEW) && subVisible))
|
if ( ((currentView() == MAIN_VIEW) && mainVisible) || ((currentView() == SUB_VIEW) && subVisible))
|
||||||
{
|
{
|
||||||
activateBuffer(id, currentView(), true);
|
activateBuffer(id, currentView(), true);
|
||||||
|
|
||||||
|
if (svp._isChangeHistoryMarginEnabled || svp._isChangeHistoryIndicatorEnabled)
|
||||||
|
clearChangesHistory(currentView());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// handle also the less usual case when the reloaded buffer is not in the current active view
|
// handle also the less usual case when the reloaded buffer is not in the current active view
|
||||||
|
|
||||||
int originalActiveView = currentView();
|
int originalActiveView = currentView();
|
||||||
BufferID originalActiveBufferID = nullptr;
|
BufferID originalActiveBufferID = nullptr;
|
||||||
if (mainVisible)
|
if (mainVisible)
|
||||||
@ -631,11 +637,10 @@ bool Notepad_plus::doReload(BufferID id, bool alert)
|
|||||||
activateBuffer(id, SUB_VIEW, true);
|
activateBuffer(id, SUB_VIEW, true);
|
||||||
}
|
}
|
||||||
activateBuffer(originalActiveBufferID, originalActiveView, true); // set back the original
|
activateBuffer(originalActiveBufferID, originalActiveView, true); // set back the original
|
||||||
}
|
|
||||||
|
|
||||||
auto svp = NppParameters::getInstance().getSVP();
|
if (svp._isChangeHistoryMarginEnabled || svp._isChangeHistoryIndicatorEnabled)
|
||||||
if (svp._isChangeHistoryMarginEnabled || svp._isChangeHistoryIndicatorEnabled)
|
clearChangesHistory(otherView());
|
||||||
clearChangesHistory();
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user