Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vader swallows Given lines #211

Open
hupfdule opened this issue May 4, 2020 · 1 comment
Open

Vader swallows Given lines #211

hupfdule opened this issue May 4, 2020 · 1 comment

Comments

@hupfdule
Copy link

hupfdule commented May 4, 2020

Hi,

please have a look at the following vader file:

Given asciidoc (ATX headings);
= ATX title

== ATX heading level 1

=== ATX heading level 2

==== ATX heading level 3

===== ATX heading level 4

====== ATX heading level 5

[[someanchor1]]
=== ATX heading level 2 with preceding anchor line

.some label
== ATX heading level 1 with preceding label line


Execute (print all ATX headings):
  echom 'START'
  for l in getline(1, '$')
   echom l
  endfor
  echom 'END'


Given asciidoc (Setext headings);
Setext title
============

Setext heading level 1
----------------------

Setext heading level 2
~~~~~~~~~~~~~~~~~~~~~~

Setext heading level 3
^^^^^^^^^^^^^^^^^^^^^^

Setext heading level 4
++++++++++++++++++++++

[[someanchor1]]
Setext heading level 2 with preceding anchor line
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.some label
Setext heading level 1 with preceding label line
------------------------------------------------



Execute (print all Setext headings):
  echom 'START'
  for l in getline(1, '$')
   echom l
  endfor
  echom 'END'

When running :Vader this is the output:

START
= ATX title
== ATX heading level 1
=== ATX heading level 2
==== ATX heading level 3
===== ATX heading level 4
====== ATX heading level 5
[[someanchor1]]
=== ATX heading level 2 with preceding anchor line
.some label
END
START
Setext title
============
END

Vader obviously swallows some lines. At first it seemed to me that it does this when it encounters a line that:

  • starts with = and
  • the line before it is not empty

But if I add


== foo

== bar

to the end of the "ATX headings" Given block then only the == bar line is swallowed.

The behaviour is the same when I use a semicolon instead of a colon after the Given line and use indentation.

What is wrong here? It seems that Vader just always chokes on asciidoc syntax.

@hupfdule
Copy link
Author

hupfdule commented May 4, 2020

I could track it down to the following line:

If I comment out this line everything works as expected.

I must admit that I don't understand the purpose of this line (and the corresponding silent %d _ 4 lines above it). But apparently this is the source of the problem.

hupfdule added a commit to hupfdule/vader.vim that referenced this issue May 5, 2020
This fixes junegunn#211.

However, the consequences are unclear as is the purpose of the now
uncommented line.
hupfdule added a commit to hupfdule/vader.vim that referenced this issue May 6, 2020
This fixes junegunn#211.

However, the consequences are unclear as is the purpose of the now
uncommented line.
hupfdule added a commit to hupfdule/vader.vim that referenced this issue May 28, 2020
This fixes junegunn#211.

However, the consequences are unclear as is the purpose of the now
uncommented line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant