mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
Merge pull request #2223 from RaiKoHoff/Hotfix_REL_5204112
Hotfix: view selection on wrapped long-lines
This commit is contained in:
commit
10c9448ff1
15
src/Edit.c
15
src/Edit.c
@ -4959,11 +4959,12 @@ void EditSetSelectionEx(DocPos iAnchorPos, DocPos iCurrentPos, DocPos vSpcAnchor
|
||||
if (vSpcCurrent > 0) {
|
||||
SciCall_SetRectangularSelectionCaretVirtualSpace(vSpcCurrent);
|
||||
}
|
||||
EditEnsureSelectionVisible();
|
||||
}
|
||||
else {
|
||||
SciCall_SetSel(iAnchorPos, iCurrentPos); // scrolls into view
|
||||
SciCall_ChooseCaretX();
|
||||
}
|
||||
EditNormalizeView(Sci_GetCurrentLineNumber()); // normalize view
|
||||
}
|
||||
UpdateToolbar();
|
||||
UpdateStatusbar(false);
|
||||
@ -5006,15 +5007,12 @@ void EditNormalizeView(const DocLn iDocLine)
|
||||
//
|
||||
void EditEnsureSelectionVisible()
|
||||
{
|
||||
// Ensure that the first and last lines of a selection are always unfolded
|
||||
DocLn const iCurrentLine = SciCall_LineFromPosition(SciCall_GetCurrentPos());
|
||||
DocLn const iAnchorLine = SciCall_LineFromPosition(SciCall_GetAnchor());
|
||||
|
||||
// Ensure that the first and last lines of a selection are always unfolded
|
||||
// This needs to be done *before* the SCI_SETSEL message
|
||||
SciCall_EnsureVisible(iAnchorLine);
|
||||
if (iAnchorLine != iCurrentLine) { SciCall_EnsureVisible(iCurrentLine); }
|
||||
|
||||
Sci_ScrollToCurrentLine(); // normalize view
|
||||
Sci_ScrollToLine(iCurrentLine);
|
||||
Sci_ScrollChooseCaret();
|
||||
}
|
||||
|
||||
|
||||
@ -6810,7 +6808,8 @@ void EditSelectionMultiSelectAll()
|
||||
if (iMainAnchor > iMainCaret) {
|
||||
SciCall_SwapMainAnchorCaret();
|
||||
}
|
||||
EditNormalizeView(Sci_GetCurrentLineNumber()); // normalize view
|
||||
//~EditNormalizeView(Sci_GetCurrentLineNumber());
|
||||
EditEnsureSelectionVisible();
|
||||
|
||||
SciCall_SetTargetRange(saveTargetBeg, saveTargetEnd); //restore
|
||||
|
||||
|
||||
@ -4817,7 +4817,8 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
case IDM_EDIT_SELTONEXT:
|
||||
{
|
||||
SciCall_RotateSelection();
|
||||
EditNormalizeView(Sci_GetCurrentLineNumber());
|
||||
//~EditNormalizeView(Sci_GetCurrentLineNumber());
|
||||
EditEnsureSelectionVisible();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -4830,7 +4831,8 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
DocPosU const iNewMain = SciCall_GetSelections() - 1;
|
||||
SciCall_SetMainSelection(iNewMain);
|
||||
}
|
||||
EditNormalizeView(Sci_GetCurrentLineNumber()); // normalize view
|
||||
//~EditNormalizeView(Sci_GetCurrentLineNumber());
|
||||
EditEnsureSelectionVisible();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -5264,7 +5266,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
FileWatching.AutoReloadTimeout = Settings2.AutoReloadTimeout;
|
||||
UndoRedoRecordingStart();
|
||||
SciCall_SetEndAtLastLine(!Settings.ScrollPastEOF);
|
||||
EditNormalizeView(Sci_GetCurrentLineNumber()); // normalize view
|
||||
EditNormalizeView(Sci_GetCurrentLineNumber());
|
||||
}
|
||||
|
||||
InstallFileWatching(Globals.CurrentFile); // force
|
||||
@ -9527,8 +9529,7 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload,
|
||||
// set historic caret/selection pos
|
||||
else if ((iCaretPos >= 0) && (iAnchorPos >= 0))
|
||||
{
|
||||
SciCall_SetSel(iAnchorPos, iCaretPos); // scroll into view
|
||||
EditNormalizeView(Sci_GetCurrentLineNumber());
|
||||
EditSetSelectionEx(iAnchorPos, iCaretPos, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user