diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 503e5a5e..d2cbd82e 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -274,6 +274,9 @@ LRESULT Notepad_plus::init(HWND hwnd) _mainEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow); _subEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow); + _mainEditView.execute(SCI_SETENDATLASTLINE, not svp1._scrollBeyondLastLine); + _subEditView.execute(SCI_SETENDATLASTLINE, not svp1._scrollBeyondLastLine); + if (svp1._doSmoothFont) { _mainEditView.execute(SCI_SETFONTQUALITY, SC_EFF_QUALITY_LCD_OPTIMIZED); diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 0d37ce15..5fc6f4c7 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -2801,6 +2801,14 @@ void Notepad_plus::command(int id) } break; + case IDM_VIEW_SCROLL_BEYOND_LASTLINE: + { + const bool endAtLastLine = not NppParameters::getInstance()->getSVP()._scrollBeyondLastLine; + _mainEditView.execute(SCI_SETENDATLASTLINE, endAtLastLine); + _subEditView.execute(SCI_SETENDATLASTLINE, endAtLastLine); + } + break; + case IDM_VIEW_EDGEBACKGROUND: case IDM_VIEW_EDGELINE: case IDM_VIEW_EDGENONE: diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 385b0fb2..1ca191e7 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -4752,6 +4752,16 @@ void NppParameters::feedScintillaParam(TiXmlNode *node) _svp._currentLineHilitingShow = false; } + // Scrolling Beyond Last Line State + nm = element->Attribute(TEXT("scrollBeyondLastLine")); + if (nm) + { + if (!lstrcmp(nm, TEXT("yes"))) + _svp._scrollBeyondLastLine = true; + else if (!lstrcmp(nm, TEXT("no"))) + _svp._scrollBeyondLastLine = false; + } + // Disable Advanced Scrolling nm = element->Attribute(TEXT("disableAdvancedScrolling")); if (nm) @@ -4975,6 +4985,7 @@ bool NppParameters::writeScintillaParams(const ScintillaViewParams & svp) (scintNode->ToElement())->SetAttribute(TEXT("lineWrapMethod"), pWrapMethodStr); (scintNode->ToElement())->SetAttribute(TEXT("currentLineHilitingShow"), svp._currentLineHilitingShow?TEXT("show"):TEXT("hide")); + (scintNode->ToElement())->SetAttribute(TEXT("scrollBeyondLastLine"), svp._scrollBeyondLastLine?TEXT("yes"):TEXT("no")); (scintNode->ToElement())->SetAttribute(TEXT("disableAdvancedScrolling"), svp._disableAdvancedScrolling?TEXT("yes"):TEXT("no")); (scintNode->ToElement())->SetAttribute(TEXT("wrapSymbolShow"), svp._wrapSymbolShow?TEXT("show"):TEXT("hide")); (scintNode->ToElement())->SetAttribute(TEXT("Wrap"), svp._doWrap?TEXT("yes"):TEXT("no")); diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 6224d852..c6bb3e94 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -837,6 +837,7 @@ struct ScintillaViewParams bool _whiteSpaceShow = false; bool _eolShow; int _borderWidth = 2; + bool _scrollBeyondLastLine = false; bool _disableAdvancedScrolling = false; bool _doSmoothFont = false; bool _showBorderEdge = true; diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index 6b0c4843..55f40dc0 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -114,7 +114,8 @@ BEGIN CONTROL "Display bookmark",IDC_CHECK_BOOKMARKMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,298,120,150,10 CONTROL "Enable current line highlighting",IDC_CHECK_CURRENTLINEHILITE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,298,133,129,10 CONTROL "Enable smooth font",IDC_CHECK_SMOOTHFONT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,298,146,129,10 - CONTROL "Disable advanced scrolling feature\r(if you have touchpad problem)",IDC_CHECK_DISABLEADVANCEDSCROLL, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,298,159,139,18 + CONTROL "Enable scrolling beyond last line",IDC_CHECK_SCROLLBEYONDLASTLINE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,298,159,139,10 + CONTROL "Disable advanced scrolling feature\r(if you have touchpad problem)",IDC_CHECK_DISABLEADVANCEDSCROLL, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,298,172,139,18 END IDD_PREFERENCE_SETTING_BOX DIALOGEX 0, 0, 455, 185 diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 1aed85c6..55cc3cef 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -573,6 +573,7 @@ void MarginsDlg::initScintParam() ::SendDlgItemMessage(_hSelf, IDC_CHECK_LINENUMBERMARGE, BM_SETCHECK, svp._lineNumberMarginShow, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_BOOKMARKMARGE, BM_SETCHECK, svp._bookMarkMarginShow, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_CURRENTLINEHILITE, BM_SETCHECK, svp._currentLineHilitingShow, 0); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_SCROLLBEYONDLASTLINE, BM_SETCHECK, svp._scrollBeyondLastLine, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_DISABLEADVANCEDSCROLL, BM_SETCHECK, svp._disableAdvancedScrolling, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_NOEDGE, BM_SETCHECK, !svp._showBorderEdge, 0); @@ -681,6 +682,11 @@ INT_PTR CALLBACK MarginsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa ::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_CURLINE_HILITING, 0); return TRUE; + case IDC_CHECK_SCROLLBEYONDLASTLINE: + svp._scrollBeyondLastLine = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_SCROLLBEYONDLASTLINE, BM_GETCHECK, 0, 0)); + ::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_SCROLL_BEYOND_LASTLINE, 0); + return TRUE; + case IDC_CHECK_DISABLEADVANCEDSCROLL: svp._disableAdvancedScrolling = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_DISABLEADVANCEDSCROLL, BM_GETCHECK, 0, 0)); return TRUE; diff --git a/PowerEditor/src/WinControls/Preference/preference_rc.h b/PowerEditor/src/WinControls/Preference/preference_rc.h index dfc23eaa..db2401bc 100644 --- a/PowerEditor/src/WinControls/Preference/preference_rc.h +++ b/PowerEditor/src/WinControls/Preference/preference_rc.h @@ -113,6 +113,7 @@ #define IDC_BORDERWIDTH_SLIDER (IDD_PREFERENCE_MARGEIN_BOX + 33) #define IDC_CHECK_DISABLEADVANCEDSCROLL (IDD_PREFERENCE_MARGEIN_BOX + 34) #define IDC_CHECK_NOEDGE (IDD_PREFERENCE_MARGEIN_BOX + 35) + #define IDC_CHECK_SCROLLBEYONDLASTLINE (IDD_PREFERENCE_MARGEIN_BOX + 36) #define IDD_PREFERENCE_DELIMITERSETTINGS_BOX 6250 //(IDD_PREFERENCE_BOX + 250) #define IDC_DELIMITERSETTINGS_GB_STATIC (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 1) diff --git a/PowerEditor/src/menuCmdID.h b/PowerEditor/src/menuCmdID.h index 07122586..b7e91a87 100644 --- a/PowerEditor/src/menuCmdID.h +++ b/PowerEditor/src/menuCmdID.h @@ -343,6 +343,8 @@ #define IDM_VIEW_TAB_MOVEFORWARD (IDM_VIEW + 98) #define IDM_VIEW_TAB_MOVEBACKWARD (IDM_VIEW + 99) + #define IDM_VIEW_SCROLL_BEYOND_LASTLINE (IDM_VIEW + 100) + #define IDM_VIEW_GOTO_ANOTHER_VIEW 10001 #define IDM_VIEW_CLONE_TO_ANOTHER_VIEW 10002 #define IDM_VIEW_GOTO_NEW_INSTANCE 10003