vim-pandoc / vim-pandoc-syntax

pandoc markdown syntax, to be installed alongside vim-pandoc
MIT License
424 stars 61 forks source link

Quotation marks aren't properly highlighted in list items #114

Closed rafaeln closed 9 years ago

rafaeln commented 9 years ago

You can see that in the screenshot below.

screenshot from 2015-01-12 10 17 24

fmoralesc commented 9 years ago

Thanks. Just fixed in master.

rafaeln commented 9 years ago

It is still not working perfectly. Quotes are only properly highlighted in non-initial paragraphs of list items. If the paragraph begins with the quotes, though, they aren't highlighted, and it also breaks formatting for any further paragraphs. Interestingly, highlighting also doesn't work for italics if a paragraph begins with it, and this will also break highlighting in further paragraphs. See the screenshot below.

screenshot from 2015-01-12 11 13 10

fmoralesc commented 9 years ago

It seems that I made an oversight about unordered list items, should be fixed now.

captura de pantalla de 2015-01-12 15 33 43

rafaeln commented 9 years ago

Hum, I've just pulled commit e63f7350b25d3b59e8b67c08ef9e76c61ec14b77 and it doesn't seem to solve the issue for me. Can you confirm this is the commit that is supposed to fix it so that I can proceed to test this in a cleaner environment?

screenshot from 2015-01-12 11 40 18

fmoralesc commented 9 years ago

Indeed, that is the commit. Lines 451-452 of syntax/pandoc.vim should be:

call s:WithConceal("quotes", 'syn match pandocBeginQuote /"\</  containedin=pandocEmphasis,pandocStrong,pandocListItem,pandocListItemContinuation,pandocUListItem display', 'conceal cchar=“')
call s:WithConceal("quotes", 'syn match pandocEndQuote /\(\>[[:punct:]]*\)\@<="[[:blank:][:punct:]\n]\@=/  containedin=pandocEmphasis,pandocStrong,pandocUListItem,pandocListItem,pandocListItemContinuation display', 'conceal cchar=”')
rafaeln commented 9 years ago

Hum... We am indeed using the same commit, with lines 451-452 matching what you gave above.

Even using the following minimal .vimrc, which deactivates all other plugins in my system, I still get the same result (screenshot follows)

scriptencoding utf-8
set encoding=utf-8

filetype plugin on

let g:pathogen_disabled = [ 'flappyvird-vim', 'goyo.vim', 'gundo', 'LaTeX-Box', 'python-mode', 'repmo.vim', 'seoul256.vim', 'smartpairs.vim', 'ultisnips', 'vim-abolish', 'vim-characterize', 'vim-colors-solarized', 'vim-commentary', 'vim-easy-align', 'vim-eunuch', 'vim-fugitive', 'vim-gitgutter', 'vim-markdown', 'vim-obsession', 'vim-repeat', 'vim-scriptease', 'vim-sensible', 'vim-snippets', 'vim-surround', 'vim-tmux-navigator', 'vim-unimpaired', 'vim-vinegar', 'vim-visual-star-search', 'vim-yankstack', 'Zenburn']

execute pathogen#infect()

image

fmoralesc commented 9 years ago

What is the output of

echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')

when the cursor is over the " in "quotes" (line 14) and _ in _italics_ (line 13). It should be:

 ["pandocBeginQuote"]

and

["pandocEmphasis", "Operator"]

I'm kinda clueless. What vim version are you using?

rafaeln commented 9 years ago

The output is, ['pandocCodeblock'] whether the cursor is on the " in "quotes" (line 14) or on the _ in _italics_ (line 13).

I'm using

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan  2 2014 19:39:59)
Included patches: 1-52
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by buildd@

Here are the output of that command in other positions:

image

image

image

image

image

image

image

image

image

image

image

image

image

image

fmoralesc commented 9 years ago

Thanks, I see now what the problem is. I was testing over 3 spaces on the indent, so my tests were skewed. I just pushed a partial fix. It still won't be correct when the line begins with _ though (I'm not sure why).

rafaeln commented 9 years ago

It does seem to work, though, when the line begins with _ (and I've taken this screenshot with my regular .vimrc)

image

fmoralesc commented 9 years ago

Weirdness all around, I guess. Perhaps there are further differences between our text samples. Mine was


"quotes"

 "quotes"

 * item item "quotes" *italics*

    something "quotes"

    something *italics*

    _italics_

    something "quotes"

 * second item "quotes" *italics*

    something "quotes"

    something *italics*

    "quotes"

    something _italics_
rafaeln commented 9 years ago

Weirdness all around indeed. I copy-pasted your text sample into a vim buffer and got correct highlighting throughout. My text sample goes below


"quotes"

  "quotes"

  * first item "quotes" _italics_

    something "quotes"

    something _italics_

    _italics_

    something "quotes"

  * first item "quotes" _italics_

    something "quotes"

    something _italics_

    "quotes"

    something _italics_
fmoralesc commented 9 years ago

It seems to work fine in both cases now for me. I guess I had some invalid syntax rule cached, or something like that. I'll close the issue before it jinxes itself.