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

Highlighting does not work in Windows #20

Open
thingmarius opened this issue Jan 6, 2017 · 4 comments
Open

Highlighting does not work in Windows #20

thingmarius opened this issue Jan 6, 2017 · 4 comments
Assignees

Comments

@thingmarius
Copy link

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.

@alfredodeza alfredodeza self-assigned this Jan 6, 2017
@alfredodeza
Copy link
Owner

Could you try if it works correctly by using fnameescape ?

@thingmarius
Copy link
Author

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 .

@alfredodeza
Copy link
Owner

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\\

@thingmarius
Copy link
Author

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.

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

2 participants