diff options
author | nyamatongwe <unknown> | 2000-12-21 01:39:34 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2000-12-21 01:39:34 +0000 |
commit | 9cb4cca29f5535ea07f0582dad57186bae6ec474 (patch) | |
tree | 95eb8d74c91cf022023e8f0f027822fd726c0ca0 /src/Editor.cxx | |
parent | 9e91e969b5b32bbc4bfbb4b72b33514670b6439d (diff) | |
download | scintilla-mirror-9cb4cca29f5535ea07f0582dad57186bae6ec474.tar.gz |
Patch from James for SetVisiblePolicy.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r-- | src/Editor.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 6c7bda2b2..85958be8f 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -75,6 +75,9 @@ Editor::Editor() { caretPolicy = CARET_SLOP; caretSlop = 0; + visiblePolicy = VISIBLE_SLOP; + visibleSlop = 0; + searchAnchor = 0; ucWheelScrollLines = 0; @@ -3148,6 +3151,24 @@ void Editor::EnsureLineVisible(int line) { SetScrollBars(); Redraw(); } + if (visiblePolicy & VISIBLE_SLOP) { + if ((topLine > line) || ((visiblePolicy & VISIBLE_STRICT) && (topLine + visibleSlop > line))) { + SetTopLine(Platform::Clamp(line - visibleSlop, 0, MaxScrollPos())); + SetVerticalScrollPos(); + Redraw(); + } else if ((line > topLine + LinesOnScreen() - 1) || + ((visiblePolicy & VISIBLE_STRICT) && (line > topLine + LinesOnScreen() - 1 - visibleSlop))) { + SetTopLine(Platform::Clamp(line - LinesOnScreen() + 1 + visibleSlop, 0, MaxScrollPos())); + SetVerticalScrollPos(); + Redraw(); + } + } else { + if ((topLine > line) || (line > topLine + LinesOnScreen() - 1) || (visiblePolicy & VISIBLE_STRICT)) { + SetTopLine(Platform::Clamp(line - LinesOnScreen() / 2 + 1, 0, MaxScrollPos())); + SetVerticalScrollPos(); + Redraw(); + } + } } static bool ValidMargin(unsigned long wParam) { @@ -4180,6 +4201,11 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) { caretSlop = lParam; break; + case SCI_SETVISIBLEPOLICY: + visiblePolicy = wParam; + visibleSlop = lParam; + break; + case SCI_LINESONSCREEN: return LinesOnScreen(); |