Skip to content

Commit

Permalink
Merge pull request #2223 from RaiKoHoff/Hotfix_REL_5204112
Browse files Browse the repository at this point in the history
Hotfix: view selection on wrapped long-lines
  • Loading branch information
RaiKoHoff authored Apr 14, 2020
2 parents fd1a2fd + 61ad759 commit 10c9448
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
15 changes: 7 additions & 8 deletions src/Edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}


Expand Down Expand Up @@ -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

Expand Down
11 changes: 6 additions & 5 deletions src/Notepad3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 10c9448

Please sign in to comment.