aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-08-25 08:21:33 +1000
committerNeil <nyamatongwe@gmail.com>2021-08-25 08:21:33 +1000
commitbb75e40bca7a6d81eb4070a7b67950119dc4b8b5 (patch)
treec90d62fb94bbc96736a8027a0e02dd784826eb59
parentdc0398d650e75efe9641f0c48d630f2c2027281a (diff)
downloadscintilla-mirror-bb75e40bca7a6d81eb4070a7b67950119dc4b8b5.tar.gz
Allow SCI_HIDELINES to hide the first line or all lines.
-rw-r--r--doc/ScintillaDoc.html5
-rw-r--r--doc/ScintillaHistory.html3
-rw-r--r--src/ContractionState.cxx2
-rw-r--r--src/Editor.cxx3
-rw-r--r--test/unit/testContractionState.cxx15
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 @@
<h1>Scintilla Documentation</h1>
- <p>Last edited 30 July 2021 NH</p>
+ <p>Last edited 25 August 2021 NH</p>
<p style="background:#90F0C0">Scintilla 5 has moved the lexers from Scintilla into a new
<a href="Lexilla.html">Lexilla</a> project.<br />
@@ -7113,8 +7113,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
visible and 0 if it is not visible.
<code>SCI_GETALLLINESVISIBLE</code> 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.</p>
+ These messages have no effect on fold levels or fold flags.</p>
<p><b id="SCI_SETFOLDLEVEL">SCI_SETFOLDLEVEL(line line, int level)</b><br />
<b id="SCI_GETFOLDLEVEL">SCI_GETFOLDLEVEL(line line) &rarr; int</b><br />
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 @@
<a href="https://sourceforge.net/p/scintilla/feature-requests/841/">Feature #841</a>.
</li>
<li>
+ Allow SCI_HIDELINES to hide the first line or all lines which can be useful for filtered views.
+ </li>
+ <li>
Fix display of fold lines when wrapped so they are only drawn once per line, not on each subline.
</li>
<li>
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<LINE>::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++) {