diff options
author | nyamatongwe <unknown> | 2002-04-14 00:29:39 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2002-04-14 00:29:39 +0000 |
commit | 736467e9bc1c6b6305d010afb7997ca80c23ed58 (patch) | |
tree | 0e56acd567a7120d5c075f69fbba9496e20929e4 /src | |
parent | c733bd4a9ada3557ea24a50ba7b218f680502556 (diff) | |
download | scintilla-mirror-736467e9bc1c6b6305d010afb7997ca80c23ed58.tar.gz |
Implemented endAtLastLine attribute which allows option of scrolling one
page below last document line.
Diffstat (limited to 'src')
-rw-r--r-- | src/Editor.cxx | 30 | ||||
-rw-r--r-- | src/Editor.h | 1 |
2 files changed, 25 insertions, 6 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index db5fe54b5..133e62b40 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -327,6 +327,7 @@ Editor::Editor() { xCaretMargin = 50; horizontalScrollBarVisible = true; scrollWidth = 2000; + endAtLastLine = true; pixmapLine = Surface::Allocate(); pixmapSelMargin = Surface::Allocate(); @@ -452,11 +453,17 @@ int Editor::LinesToScroll() { int Editor::MaxScrollPos() { //Platform::DebugPrintf("Lines %d screen = %d maxScroll = %d\n", //LinesTotal(), LinesOnScreen(), LinesTotal() - LinesOnScreen() + 1); - int retVal = cs.LinesDisplayed() - LinesOnScreen(); - if (retVal < 0) + int retVal = cs.LinesDisplayed(); + if (endAtLastLine) { + retVal -= LinesOnScreen(); + } else { + retVal--; + } + if (retVal < 0) { return 0; - else + } else { return retVal; + } } static inline bool IsControlCharacter(char ch) { @@ -2184,9 +2191,9 @@ void Editor::ReconfigureScrollBars() {} void Editor::SetScrollBars() { RefreshStyleData(); - int nMax = cs.LinesDisplayed(); - int nPage = nMax - MaxScrollPos() + 1; - bool modified = ModifyScrollBars(nMax, nPage); + int nMax = MaxScrollPos(); + int nPage = LinesOnScreen(); + bool modified = ModifyScrollBars(nMax + nPage - 1, nPage); // TODO: ensure always showing as many lines as possible // May not be, if, for example, window made larger @@ -4717,6 +4724,17 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { PLATFORM_ASSERT(lParam); return TextWidth(wParam, reinterpret_cast<char *>(lParam)); + case SCI_SETENDATLASTLINE: + PLATFORM_ASSERT((wParam == 0) || (wParam ==1)); + if (endAtLastLine != (wParam != 0)) { + endAtLastLine = wParam != 0; + SetScrollBars(); + } + break; + + case SCI_GETENDATLASTLINE: + return endAtLastLine; + case SCI_GETCOLUMN: return pdoc->GetColumn(wParam); diff --git a/src/Editor.h b/src/Editor.h index 353e4ee9f..a86008456 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -201,6 +201,7 @@ protected: // ScintillaBase subclass needs access to much of Editor int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret bool horizontalScrollBarVisible; int scrollWidth; + bool endAtLastLine; Surface *pixmapLine; Surface *pixmapSelMargin; |