peterbjorgensen / sved

Synctex support for Vim and Evince through DBus
37 stars 10 forks source link

Filenames with some special characters results in a bug with forward synchronization #8

Closed MeisterLLD closed 5 years ago

MeisterLLD commented 5 years ago

Characters like ( or , are not shell escaped which then creates a bug in the vim command : SVED_Sync() tries a first forward sync, but then we're stuck in Vim command in a special character loop/bug. Sorry, I can't explain properly, but I link some screenshots : https://imgur.com/a/4fVkjVU

  1. I call SVED_Sync() in my file containing a comma in its filename. Evince is launched (but no forward sync is done)
  2. I pressed F4 (my shortcut for SVED_Sync()) : result ends up in a special character being inserted in the shell
  3. And so on... (I tried F1 (compile) at some point).

To exit the loop I have to press CTRL+C twice.

Source of the problem : in tex_evinceSync.vim, line end-5 there is indeed a shellescape(l:pdffile) but shellescape() escapes only some characters, but not parenthesis () nor comma , .

What I tried : add some substitute() operations to l:pdffile but ended up in "evince cannot find file". I'm not good enough for that, but the solution should just be to add some other escapes somewhere...

MeisterLLD commented 5 years ago

Works perfectly, thanks !

peterbjorgensen commented 5 years ago

Thanks for reporting the issue. For the record, the problem is not due to shell escapes. It is caused because when we tell Evince to open a file it is given as a URL and it has to be escaped correctly. It was caused because python urllib.parse.quote replaces too many special characters in the URL, which meant Evince could not find it. I think I have found the correct list of safe characters now.

MeisterLLD commented 5 years ago

I see. Thanks for the quick fix and the info. I had a similar problem for compilation with latex-suite, but it was due to fnameescape() only escaping a few characters, but not parentheses or commas (I added manual substitutes in compile.vim) so I thought the issue was similar.