Added new Option: Enable scrolling beyond last line

Closes #2034

This option configures the vertical scroll range of Scintilla.
Disable this will configure the scroll range to end at last line
(DEFAULT).
Enable this will configure the scroll range to end one page beyond the
last line.
This commit is contained in:
A-R-C-A 2016-06-30 01:31:13 +00:00 committed by Don HO
parent 9cf45dea29
commit 9fe39017cb
8 changed files with 34 additions and 1 deletions

View File

@ -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);

View File

@ -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:

View File

@ -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"));

View File

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

View File

@ -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

View File

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

View File

@ -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)

View File

@ -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