Repository: pulldown-cmark/pulldown-cmark (rust)

Issue:
[fuzz result] blank line between indented code block and paragraph doesn't loosen list
```markdown
-     test

  test2
```

---

```console
$ cmark
-     test

  test2
<ul>
<li>
<pre><code>test
</code></pre>
<p>test2</p>
</li>
</ul>
$ cargo run
   Compiling pulldown-cmark v0.10.0 (/home/michael/Development/pulldown-cmark/pulldown-cmark)
    Finished dev [unoptimized + debuginfo] target(s) in 0.76s
     Running `target/debug/pulldown-cmark`
-     test

  test2
<ul>
<li>
<pre><code>test
</code></pre>
test2</li>
</ul>
```


Pull request description:
Count a blank line at end of indented code block towards list
Fixes #850


Patch:
diff --git a/pulldown-cmark/specs/regression.txt b/pulldown-cmark/specs/regression.txt
index 410a032..1aff9f1 100644
--- a/pulldown-cmark/specs/regression.txt
+++ b/pulldown-cmark/specs/regression.txt
@@ -2424,6 +2424,73 @@ ISSUE 840
 <p><a href="test" title="&#39;">link</a></p>
 ````````````````````````````````
 
+ISSUE 850
+
+```````````````````````````````` example
+-     test
+
+  test2
+.
+<ul>
+<li>
+<pre><code>test
+</code></pre>
+<p>test2</p>
+</li>
+</ul>
+````````````````````````````````
+
+```````````````````````````````` example
+    test
+
+test2
+.
+<pre><code>test
+</code></pre>
+<p>test2</p>
+````````````````````````````````
+
+```````````````````````````````` example
+-     test
+  test2
+.
+<ul>
+<li>
+<pre><code>test
+</code></pre>
+test2</li>
+</ul>
+````````````````````````````````
+
+```````````````````````````````` example
+-     test
+- test2
+.
+<ul>
+<li>
+<pre><code>test
+</code></pre>
+</li>
+<li>test2</li>
+</ul>
+````````````````````````````````
+
+```````````````````````````````` example
+-     test
+
+- test2
+.
+<ul>
+<li>
+<pre><code>test
+</code></pre>
+</li>
+<li>
+<p>test2</p>
+</li>
+</ul>
+````````````````````````````````
+
 ISSUE 847
 
 ```````````````````````````````` example
diff --git a/pulldown-cmark/src/firstpass.rs b/pulldown-cmark/src/firstpass.rs
index 7e5e96b..8093773 100644
--- a/pulldown-cmark/src/firstpass.rs
+++ b/pulldown-cmark/src/firstpass.rs
@@ -1068,7 +1068,7 @@ impl<'a, 'b> FirstPass<'a, 'b> {
         let mut last_nonblank_child = None;
         let mut last_nonblank_ix = 0;
         let mut end_ix = 0;
-        let mut last_line_blank = false;
+        self.last_line_blank = false;
 
         let mut ix = start_ix;
         loop {
@@ -1077,7 +1077,7 @@ impl<'a, 'b> FirstPass<'a, 'b> {
             self.append_code_text(remaining_space, line_start_ix, ix);
             // TODO(spec clarification): should we synthesize newline at EOF?
 
-            if !last_line_blank {
+            if !self.last_line_blank {
                 last_nonblank_child = self.tree.cur();
                 last_nonblank_ix = ix;
                 end_ix = ix;
@@ -1100,7 +1100,7 @@ impl<'a, 'b> FirstPass<'a, 'b> {
             }
             ix = next_line_ix;
             remaining_space = line_start.remaining_space();
-            last_line_blank = scan_blank_line(&bytes[ix..]).is_some();
+            self.last_line_blank = scan_blank_line(&bytes[ix..]).is_some();
         }
 
         // Trim trailing blank lines.


Test patch:
diff --git a/pulldown-cmark/tests/suite/regression.rs b/pulldown-cmark/tests/suite/regression.rs
index 836106e..b7d37fd 100644
--- a/pulldown-cmark/tests/suite/regression.rs
+++ b/pulldown-cmark/tests/suite/regression.rs
@@ -2893,6 +2893,91 @@ fn regression_test_182() {
 
 #[test]
 fn regression_test_183() {
+    let original = r##"-     test
+
+  test2
+"##;
+    let expected = r##"<ul>
+<li>
+<pre><code>test
+</code></pre>
+<p>test2</p>
+</li>
+</ul>
+"##;
+
+    test_markdown_html(original, expected, false, false, false);
+}
+
+#[test]
+fn regression_test_184() {
+    let original = r##"    test
+
+test2
+"##;
+    let expected = r##"<pre><code>test
+</code></pre>
+<p>test2</p>
+"##;
+
+    test_markdown_html(original, expected, false, false, false);
+}
+
+#[test]
+fn regression_test_185() {
+    let original = r##"-     test
+  test2
+"##;
+    let expected = r##"<ul>
+<li>
+<pre><code>test
+</code></pre>
+test2</li>
+</ul>
+"##;
+
+    test_markdown_html(original, expected, false, false, false);
+}
+
+#[test]
+fn regression_test_186() {
+    let original = r##"-     test
+- test2
+"##;
+    let expected = r##"<ul>
+<li>
+<pre><code>test
+</code></pre>
+</li>
+<li>test2</li>
+</ul>
+"##;
+
+    test_markdown_html(original, expected, false, false, false);
+}
+
+#[test]
+fn regression_test_187() {
+    let original = r##"-     test
+
+- test2
+"##;
+    let expected = r##"<ul>
+<li>
+<pre><code>test
+</code></pre>
+</li>
+<li>
+<p>test2</p>
+</li>
+</ul>
+"##;
+
+    test_markdown_html(original, expected, false, false, false);
+}
+
+#[test]
+fn regression_test_188() {
     let original = r##"<!p>
 
 <\!p>