Multiple conceal matches/regions get collapsed into a single character.
I'm not sure if this is intended, but it is certainly confusing. It also prevents at least one example in the documentation from working sensibly: e.g., from :help :syn-cchar syntax match Entity "&" conceal cchar=& But, if you also define: syntax match Entity "<" conceal cchar=< A line with: &< collapses to: & Whereas: <& collapses to: < In the 'Greek characters in TeX' case (see vim-use), the Greek chars and superscripts, etc. are defined like: syntax match texGreek '\\alpha\>' contained conceal cchar=α syntax match texGreek '\\beta\>' contained conceal cchar=β ...etc... syntax match texSuperscript '\^2' contained conceal cchar=² ...etc... So: $\alpha^2$ $\alpha\beta$ $\alpha^2\beta$ all collapse to: $α$ Personally, I think the behavior should be to collapse grouped on cchar/null. Using an example that has some corner cases: e.g. syntax match a /a/ conceal syntax match a /b/ cchar= conceal syntax match a /c/ conceal cchar=C syntax match a /d/ conceal Then: "abcd" collapses to: " C " (/a/ and /b/ are grouped using default 'listchars' where their cchar's both equate to cchar=' '. /d/ is not grouped with /c/, even though it doesn't define a cchar, because 'C' != ' '.) And speaking of corner cases, is there a way to get cchar=' ' or some other syntax to be recognized as an explicit cchar of <space>? It seems odd that 'cchar= ' is whitespace-sensitive. -- Best, Ben -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php |
On 10/07/10 20:18, Benjamin R. Haskell wrote:
> Multiple conceal matches/regions get collapsed into a single character. > I'm not sure if this is intended, but it is certainly confusing. It > also prevents at least one example in the documentation from working > sensibly: > > e.g., from :help :syn-cchar > > syntax match Entity "&" conceal cchar=& > > But, if you also define: > > syntax match Entity "<" conceal cchar=< > > A line with: > > &< > collapses to: > & > > Whereas: > <& > collapses to: > < > > In the 'Greek characters in TeX' case (see vim-use), the Greek chars and > superscripts, etc. are defined like: > > syntax match texGreek '\\alpha\>' contained conceal cchar=α > syntax match texGreek '\\beta\>' contained conceal cchar=β > ...etc... > syntax match texSuperscript '\^2' contained conceal cchar=² > ...etc... > > So: > > $\alpha^2$ > $\alpha\beta$ > $\alpha^2\beta$ > > all collapse to: > > $α$ > > Personally, I think the behavior should be to collapse grouped on > cchar/null. Using an example that has some corner cases: > > e.g. > syntax match a /a/ conceal > syntax match a /b/ cchar= conceal > syntax match a /c/ conceal cchar=C > syntax match a /d/ conceal > > Then: > "abcd" > collapses to: > " C" > > (/a/ and /b/ are grouped using default 'listchars' where their cchar's > both equate to cchar=' '. /d/ is not grouped with /c/, even though it > doesn't define a cchar, because 'C' != ' '.) > > And speaking of corner cases, is there a way to get cchar=' ' or some > other syntax to be recognized as an explicit cchar of<space>? It seems > odd that 'cchar= ' is whitespace-sensitive. > Have you tried 'cchar=\ ' (without the quotes)? (I haven't). Best regards, Tony. -- There is no time like the pleasant. -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php |
On Sat, 10 Jul 2010, Tony Mechelynck wrote:
> On 10/07/10 20:18, Benjamin R. Haskell wrote: > > [...] Using an example that has some corner cases: > > > > e.g. > > syntax match a /a/ conceal > > syntax match a /b/ cchar= conceal > > syntax match a /c/ conceal cchar=C > > syntax match a /d/ conceal > > > > [...] And speaking of corner cases, is there a way to get cchar=' ' > > or some other syntax to be recognized as an explicit cchar > > of <space>? It seems odd that 'cchar= ' is whitespace-sensitive. > > > > Have you tried 'cchar=\ ' (without the quotes)? (I haven't). Yep, that was my first attempt. The backslash is interpreted as the cchar. -- Best, Ben -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php |
In reply to this post by Benjamin R. Haskell-8
On Jul 10, 1:18 pm, "Benjamin R. Haskell" <[hidden email]> wrote: > Multiple conceal matches/regions get collapsed into a single character. > I'm not sure if this is intended, but it is certainly confusing. I think it is intended, for use cases like multiple invisible markers to provide syntax highlighting to otherwise plain text (e.g. TxtFormat, AnsiiEsc). However, I think we should allow other use cases such as Greek characters in Tex, which could be VERY useful and probably not that much harder to implement. > > Personally, I think the behavior should be to collapse grouped on > cchar/null. Using an example that has some corner cases: > > e.g. > syntax match a /a/ conceal > syntax match a /b/ cchar= conceal > syntax match a /c/ conceal cchar=C > syntax match a /d/ conceal > > Then: > "abcd" > collapses to: > " C " > I think this would still cause problems, for example if you need to type two of the same Greek letter in a row in Tex, or two entities in a row in html or xml. I would instead propose something like: syntax concealcollapse on/off and maybe a "concealcollapse" syntax keyword for individual rules. Setting concealcollapse on or adding concealcollapse to a syntax rule would mean that the concealed text for groups defined with concealcollapse will collapse into any preceding adjacent concealed region. I was thinking the default should be to do the collapsing, since conceal is really about hiding stuff, not replacing it. So, maybe a better name would be in order to allow this. -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php |
From: Ben Fritz [mailto:[hidden email]]
>On Jul 10, 1:18 pm, "Benjamin R. Haskell" <[hidden email]> wrote: >> Multiple conceal matches/regions get collapsed into a single character. >> I'm not sure if this is intended, but it is certainly confusing. >I think it is intended, for use cases like multiple invisible markers >to provide syntax highlighting to otherwise plain text (e.g. >TxtFormat, AnsiiEsc). However, I think we should allow other use cases >such as Greek characters in Tex, which could be VERY useful and >probably not that much harder to implement. It is a little harder than you might initially think, because conceal lets syntax highlighting do most of the dirty work for it - so as it stands, a succession of single to-be-replaced characters is presented to the engine as a single region of "concealed text". But now that conceal is officially in the tree, it becomes more possible to propose changes to the syntax highlighting code that might facilitate your TeX usage example. Vince -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php |
Free forum by Nabble | Edit this page |