vimwiki-backup / vimwiki

Automatically exported from code.google.com/p/vimwiki
1 stars 1 forks source link

Incorrect link highlighting while jumping different wikies back and forth #325

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. setup 2 wikies, first with maxhi=1, second with maxhi=0
2. add some nonexistent links to wiki2 (it should be highlighted there)
3. close and open vim
4. <leader>ww to open first wiki
5. 2<leader>ww to open second wiki
6. <leader>ww to open first wiki again
7. 2<leader>ww to open second wiki again

What is the expected output? What do you see instead?
All links in the second wiki should be highlighted as existent because of 
maxhi=0. But they are highlighted as non-existent...

Stuart, looks like caching bug here.

Original issue reported on code.google.com by habamax on 25 May 2012 at 4:29

GoogleCodeExporter commented 9 years ago
Hmm ... It works perfectly for me! 

I created two links in each wiki but did not create the corresponding files:

[[CamelCase]]
[[CamelCase2]]

And here's the vimrc file that I used.  I put it in my repo, beside the src/, 
and then ran 'vim -n -u vimrc'

-----------
" There options are required by vimwiki.
set nocompatible
filetype plugin on
syntax on

set encoding=utf-8

" Load only system and vimwiki's scripts.
set runtimepath=src,$VIMRUNTIME

" Build help tags.
" helptags src/doc

" Use directories within 'test' for storing wiki and html.
let wiki1 = {}
let wiki1.path = getcwd().'/wiki-maxhi1'
let wiki1.path_html = getcwd().'/html-maxhi1'
let wiki1.template_path = getcwd().'/tests'
let wiki1.template_default = 'empty'
let wiki1.template_ext = '.tpl'
let wiki1.maxhi = 1
"
let wiki0 = {}
let wiki0.path = getcwd().'/wiki-maxhi0'
let wiki0.path_html = getcwd().'/html-maxhi0'
let wiki0.template_path = getcwd().'/tests'
let wiki0.template_default = 'empty'
let wiki0.template_ext = '.tpl'
let wiki0.maxhi = 0
"
let g:vimwiki_list = [wiki1, wiki0]

let g:vimwiki_camel_case = 0
"let g:vimwiki_debug = 2
-----------

Original comment by stu.andrews on 25 May 2012 at 2:06

GoogleCodeExporter commented 9 years ago
Yes indeed!

Let me check my settings...

Original comment by habamax on 25 May 2012 at 2:22

GoogleCodeExporter commented 9 years ago
Found it!

add

set hidden

to your vimrc...

Original comment by habamax on 25 May 2012 at 2:32

GoogleCodeExporter commented 9 years ago
The problem is in base#validate_wiki_options.

Remove from that function:
let g:vimwiki_current_idx = a:idx
...
and
...
call vimwiki#base#cache_wiki_state()

end this issue is solved.

But I am not sure if this fix doesn't introduce other bugs.

Original comment by habamax on 25 May 2012 at 3:34

GoogleCodeExporter commented 9 years ago
A bit of caching stuff was commented out. Now it works for me with 'hidden'

Original comment by habamax on 25 May 2012 at 3:53

GoogleCodeExporter commented 9 years ago
Yup, removing the caching like that removes some important initialization in 
validate_wiki_options().

The good news is that I have reproduced this bug.  I am suspicious of  
b:current_syntax ...

Original comment by stu.andrews on 25 May 2012 at 6:38

GoogleCodeExporter commented 9 years ago
Fixed with r52730b90da91 and "caching" restored.  I'll clean up some of my 
debugging stmts later ... it's worth taking a look to see what's going on with 
events.

Original comment by stu.andrews on 25 May 2012 at 10:19

GoogleCodeExporter commented 9 years ago
I was in late evening traffic jam when I read your message about 
b:current_syntax. But the problem was in combination of events and the way 
g:vimwiki_current_idx is changed. It was clearly seen from syntax/vimwiki.vim 
that g:vimwiki_current_idx is wrong there by the time VimwikiGet('maxhi') is 
checked...

Sorry I couldn't write earlier.

Original comment by habamax on 26 May 2012 at 9:17

GoogleCodeExporter commented 9 years ago
make additional setup for your wiki0 (second wiki):
let wiki0.syntax='markdown'

1. now do the steps from initial post
2. try to normalize [[CamelCase]] link with '+'

it is normalized to [[CamelCase|CamelCase]]...

Wikilink separator is not reset to correct one

Original comment by habamax on 26 May 2012 at 9:28

GoogleCodeExporter commented 9 years ago
I assume you're trying the generic-links branch ... b/c I am getting 
[[CamelCase][CamelCase]] with the default  from late last night r40f3bd8145b8

The generic-links branch is in flux at the moment ... and remember not to code 
and drive.

Original comment by stu.andrews on 26 May 2012 at 1:08

GoogleCodeExporter commented 9 years ago
nope, I use default branch.

Maybe I wasn't specific enough with the steps...

Original comment by habamax on 26 May 2012 at 5:19

GoogleCodeExporter commented 9 years ago
hmm, now I cannot reproduce it... :)

Original comment by habamax on 26 May 2012 at 5:22

GoogleCodeExporter commented 9 years ago

Original comment by habamax on 28 May 2012 at 6:05