aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2001-02-24 07:02:36 +0000
committernyamatongwe <unknown>2001-02-24 07:02:36 +0000
commita3fd4afaf184d4b5991ec3423addeed2c42e727d (patch)
tree8a4c8f0866c1d9b0410e402b2630b706561bc783 /src
parent0dc7541bb34e597b830fc415bdf2773053c9d03d (diff)
downloadscintilla-mirror-a3fd4afaf184d4b5991ec3423addeed2c42e727d.tar.gz
Patch from Jan Hercek to fix folding by using the display line rather than
the document line when evaluating the visibility policy.
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx23
-rw-r--r--src/Editor.h2
2 files changed, 13 insertions, 12 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 0096da7a2..ecff9d496 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -3175,11 +3175,11 @@ void Editor::ToggleContraction(int line) {
// Recurse up from this line to find any folds that prevent this line from being visible
// and unfold them all.
-void Editor::EnsureLineVisible(int line) {
- if (!cs.GetVisible(line)) {
- int lineParent = pdoc->GetFoldParent(line);
+void Editor::EnsureLineVisible(int lineDoc) {
+ if (!cs.GetVisible(lineDoc)) {
+ int lineParent = pdoc->GetFoldParent(lineDoc);
if (lineParent >= 0) {
- if (line != lineParent)
+ if (lineDoc != lineParent)
EnsureLineVisible(lineParent);
if (!cs.GetExpanded(lineParent)) {
cs.SetExpanded(lineParent, 1);
@@ -3189,20 +3189,21 @@ void Editor::EnsureLineVisible(int line) {
SetScrollBars();
Redraw();
}
+ int lineDisplay = cs.DisplayFromDoc(lineDoc);
if (visiblePolicy & VISIBLE_SLOP) {
- if ((topLine > line) || ((visiblePolicy & VISIBLE_STRICT) && (topLine + visibleSlop > line))) {
- SetTopLine(Platform::Clamp(line - visibleSlop, 0, MaxScrollPos()));
+ if ((topLine > lineDisplay) || ((visiblePolicy & VISIBLE_STRICT) && (topLine + visibleSlop > lineDisplay))) {
+ SetTopLine(Platform::Clamp(lineDisplay - 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()));
+ } else if ((lineDisplay > topLine + LinesOnScreen() - 1) ||
+ ((visiblePolicy & VISIBLE_STRICT) && (lineDisplay > topLine + LinesOnScreen() - 1 - visibleSlop))) {
+ SetTopLine(Platform::Clamp(lineDisplay - 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()));
+ if ((topLine > lineDisplay) || (lineDisplay > topLine + LinesOnScreen() - 1) || (visiblePolicy & VISIBLE_STRICT)) {
+ SetTopLine(Platform::Clamp(lineDisplay - LinesOnScreen() / 2 + 1, 0, MaxScrollPos()));
SetVerticalScrollPos();
Redraw();
}
diff --git a/src/Editor.h b/src/Editor.h
index 115c21782..73d15e340 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -316,7 +316,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void Expand(int &line, bool doExpand);
void ToggleContraction(int line);
- void EnsureLineVisible(int line);
+ void EnsureLineVisible(int lineDoc);
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0;