When I use '\verb|%|', TeXworks think left words as comments.
Steps to reproduce the problem:
- Input these:
\verb|#| \quad \verb|$| \quad \verb|%| \quad \verb|^| \quad \verb|&| \quad \verb|_| \quad \verb|{| \quad \verb|}| \quad \verb|~| \quad \verb|\| %| \quad \verb|^| \quad \verb|&| \quad \verb|_| \quad \verb|{| \quad \verb|}| \quad \verb|~| \quad \verb|\|gets red.
Expected output: | \quad \verb|^| \quad \verb|&| \quad \verb|_| \quad \verb|{| \quad \verb|}| \quad \verb|~| \quad \verb|\| should be looked like normal, not in red color.
Actual output: | \quad \verb|^| \quad \verb|&| \quad \verb|_| \quad \verb|{| \quad \verb|}| \quad \verb|~| \quad \verb|\| dispalys as comment's style.
TeXworks version: 0.6.1 TeXworks obtained from: TeX Live 2016 Operating system: Windows 10
Please provide any additional information below: I think TeXworks think % as a symbol of comments, although I used \verb. English is not well, sorry.
You'll see I've made a proposal here: it's not 100% ideal but does more-or-less work. The regex engine we have available doesn't support \K or backrefs (that I can find), which means we can't colour just part of a string ...
BTW, https://www.debuggex.com/r/fhyAZ-TY---MZj2w shows what I mean
The regex suffers from the fact that we can't do lazy matching, so two \verb in the same line will end up 'cross-contaminating'. Also see the awkwardness supporting \verb*.
Probably the 'ideal' with a PCRE would be \\verb\*?\K([^A-Za-z@])(?:.+?)\1 or \\verb\*?\K([^A-Za-z@])[^\1]+?\1 (both give the same result): https://www.debuggex.com/r/Jm36-6Xs44sNfm_G.