From bb75e40bca7a6d81eb4070a7b67950119dc4b8b5 Mon Sep 17 00:00:00 2001
From: Neil
Date: Wed, 25 Aug 2021 08:21:33 +1000
Subject: Allow SCI_HIDELINES to hide the first line or all lines.
---
doc/ScintillaDoc.html | 5 ++---
doc/ScintillaHistory.html | 3 +++
src/ContractionState.cxx | 2 +-
src/Editor.cxx | 3 +--
test/unit/testContractionState.cxx | 15 +++++++++++++++
5 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index e39ff9d30..5dfd16585 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -128,7 +128,7 @@
Scintilla Documentation
- Last edited 30 July 2021 NH
+ Last edited 25 August 2021 NH
Scintilla 5 has moved the lexers from Scintilla into a new
Lexilla project.
@@ -7113,8 +7113,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
visible and 0 if it is not visible.
SCI_GETALLLINESVISIBLE returns 1 if all lines are visible and 0
if some lines are hidden.
- These messages have no effect on fold levels or fold
- flags. The first line can not be hidden.
+ These messages have no effect on fold levels or fold flags.
SCI_SETFOLDLEVEL(line line, int level)
SCI_GETFOLDLEVEL(line line) → int
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index f404bed0b..98251fde9 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -591,6 +591,9 @@
Feature #841.
+ Allow SCI_HIDELINES to hide the first line or all lines which can be useful for filtered views.
+
+
Fix display of fold lines when wrapped so they are only drawn once per line, not on each subline.
diff --git a/src/ContractionState.cxx b/src/ContractionState.cxx
index 199b3cb78..68724ebab 100644
--- a/src/ContractionState.cxx
+++ b/src/ContractionState.cxx
@@ -197,7 +197,7 @@ Sci::Line ContractionState::DocFromDisplay(Sci::Line lineDisplay) const no
if (OneToOne()) {
return lineDisplay;
} else {
- if (lineDisplay <= 0) {
+ if (lineDisplay < 0) {
return 0;
}
if (lineDisplay > LinesDisplayed()) {
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 341165776..1fed61e36 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -7409,8 +7409,7 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) {
break;
case Message::HideLines:
- if (wParam > 0)
- pcs->SetVisible(LineFromUPtr(wParam), lParam, false);
+ pcs->SetVisible(LineFromUPtr(wParam), lParam, false);
SetScrollBars();
Redraw();
break;
diff --git a/test/unit/testContractionState.cxx b/test/unit/testContractionState.cxx
index 64f300a87..30d5454f9 100644
--- a/test/unit/testContractionState.cxx
+++ b/test/unit/testContractionState.cxx
@@ -107,6 +107,7 @@ TEST_CASE("ContractionState") {
REQUIRE(true == pcs->GetVisible(0));
REQUIRE(false == pcs->GetVisible(1));
REQUIRE(true == pcs->HiddenLines());
+ REQUIRE(1 == pcs->LinesDisplayed());
pcs->SetVisible(1, 1, true);
for (int l=0;l<2;l++) {
@@ -115,6 +116,20 @@ TEST_CASE("ContractionState") {
REQUIRE(false == pcs->HiddenLines());
}
+ SECTION("Hide All") {
+ pcs->InsertLines(0,1);
+ for (int l=0;l<2;l++) {
+ REQUIRE(true == pcs->GetVisible(0));
+ }
+ REQUIRE(false == pcs->HiddenLines());
+
+ pcs->SetVisible(0, 1, false);
+ REQUIRE(false == pcs->GetVisible(0));
+ REQUIRE(false == pcs->GetVisible(1));
+ REQUIRE(true == pcs->HiddenLines());
+ REQUIRE(0 == pcs->LinesDisplayed());
+ }
+
SECTION("Contracting") {
pcs->InsertLines(0,4);
for (int l=0;l<4;l++) {
--
cgit v1.2.3