coveragepy.vim icon indicating copy to clipboard operation
coveragepy.vim copied to clipboard

Highlighting does not work in Windows

Open thingmarius opened this issue 9 years ago • 4 comments

Highlighting fails in windows because the file system paths contain backslashes. When you match the path from g:coveragepy_session_map against the absolute path of the current buffer, it will always return 0 because of the way backslashes behave in regex patterns. To fix this, I changed the pattern like this: let path_pattern = '\M' . substitute(path, '\\', '\\\\', 'g') Doubling the backslashes will make the pattern work as expected. I only tested on Windows, but I don't see any reason why it wouldn't work on *nix systems as well.

thingmarius avatar Jan 06 '17 13:01 thingmarius

Could you try if it works correctly by using fnameescape ?

alfredodeza avatar Jan 06 '17 15:01 alfredodeza

I tried but it does not work, fnameescape does not escape backslashes. I had to do it explicitly w/ escape, and I also enabled very nomagic mode in the path pattern. See the pull request #21 .

thingmarius avatar Jan 12 '17 10:01 thingmarius

Could you provide of examples of what you are seeing as inputs, how those don't get escaped and what is the correct outcome for those inputs? I do see that fnameescape() correctly escapes backslashes, but I guess my example is not what you are seeing:

echo  fnameescape('\some\path\')
\\some\\path\\

alfredodeza avatar Jan 12 '17 12:01 alfredodeza

Here is the output that I got from fnameescape:

echo fnameescape('\some\path\')
\some\path\

and from isfname:

echo &isfname
@,48-57,/,\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=

Let me know if you need anything else.

thingmarius avatar Jan 13 '17 07:01 thingmarius