Skip to content

Commit

Permalink
Ensure caret is still visible after DPI changed, zoomed or word wrap …
Browse files Browse the repository at this point in the history
…mode changed, fix issue #49.
  • Loading branch information
zufuliu committed Jun 24, 2020
1 parent 9ecca2e commit 28aa9c2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Notepad2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1990,7 +1990,6 @@ void RecreateBars(HWND hwnd, HINSTANCE hInstance) {
void MsgDPIChanged(HWND hwnd, WPARAM wParam, LPARAM lParam) {
g_uCurrentDPI = HIWORD(wParam);
const RECT* const rc = (RECT *)lParam;
const Sci_Position pos = SciCall_GetCurrentPos();

// recreate toolbar and statusbar
RecreateBars(hwnd, g_hInstance);
Expand All @@ -2003,8 +2002,7 @@ void MsgDPIChanged(HWND hwnd, WPARAM wParam, LPARAM lParam) {
UpdateLineNumberWidth();
UpdateBookmarkMarginWidth();
UpdateFoldMarginWidth();

SciCall_GotoPos(pos);
EditEnsureSelectionVisible();
UpdateToolbar();
UpdateStatusbar();
}
Expand Down Expand Up @@ -2251,6 +2249,7 @@ void MsgNotifyZoom(void) {
UpdateLineNumberWidth();
UpdateBookmarkMarginWidth();
UpdateFoldMarginWidth();
EditEnsureSelectionVisible();
UpdateStatusbar();
}

Expand Down Expand Up @@ -3900,6 +3899,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) {
fWordWrap = !fWordWrap;
SciCall_SetWrapMode(fWordWrap? iWordWrapMode : SC_WRAP_NONE);
fWordWrapG = fWordWrap;
EditEnsureSelectionVisible();
UpdateToolbar();
break;

Expand All @@ -3908,9 +3908,10 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) {
SciCall_SetWrapMode(fWordWrap? iWordWrapMode : SC_WRAP_NONE);
SciCall_SetMarginOptions(bWordWrapSelectSubLine ? SC_MARGINOPTION_SUBLINESELECT : SC_MARGINOPTION_NONE);
fWordWrapG = fWordWrap;
UpdateToolbar();
SetWrapIndentMode();
SetWrapVisualFlags();
EditEnsureSelectionVisible();
UpdateToolbar();
}
break;

Expand Down

0 comments on commit 28aa9c2

Please sign in to comment.