Re: Diff viewer vs. control-L
Bill Fenner wrote: We've been having trouble with the diff viewer highlighting the wrong part of the file (e.g., it highlights 6 lines as being added, but those 6 lines are 12 lines above the lines that were actually added). I finally root-caused this to embedded control characters inside comments. This source, for better or for worse, has comments like /* ^L */ where ^L is literally a control-L. In vi with :number set, this appears as: 889 890 /* ^L */ 891 In the reviewboard diff viewer, this appears as: 889 890 /* 891 */ 892 ..snip My 2 cents, having anything on the same "line" after a FormFeed is kinda hard to grok. I have an old code base (presumably like yours) that has FF (CTRL-L, 0x0c, etc.) characters all over. Reviewboard (and pygments) haven't had any problems BUT the use of ^L in our the code has been consistently followed by a new line (most of these are not in comments but that is a by-the-by). Options appear to be: 1. "fix" your code base, e.g. write a small python script to replace all '\x0c' occurrences with '\x0c\n' and just submit the updated code. Kinda dirty and a pain if you have multiple branches 2. modify pygments 3. modify Reviewboard For #2 and #3 this would be something like convert all '\x0c' occurrences with '^L' so that the display shows something. You may want to mail the pygments mailing list and see what they say about displaying ^L. I'd suggest generating an ascii table with each character taking one line (with some padding) and see what pygments does for all the characters from 0-127, there may be other control characters that an alternate visual replacement would make sense for (e.g. BEL). Chris -- Want to help the Review Board project? Donate today at http://www.reviewboard.org/donate/ Happy user? Let us know at http://www.reviewboard.org/users/ -~--~~~~--~~--~--~--- To unsubscribe from this group, send email to reviewboard+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/reviewboard?hl=en
Diff viewer vs. control-L
We've been having trouble with the diff viewer highlighting the wrong part of the file (e.g., it highlights 6 lines as being added, but those 6 lines are 12 lines above the lines that were actually added). I finally root-caused this to embedded control characters inside comments. This source, for better or for worse, has comments like /* ^L */ where ^L is literally a control-L. In vi with :number set, this appears as: 889 890 /* ^L */ 891 In the reviewboard diff viewer, this appears as: 889 890 /* 891 */ 892 so for every /* ^L */ comment, reviewboard's idea of the line number gets skewed by one, leading to the wrong view of what lines have changed. It looks like it's pygments that's doing this: >>> data="/* ^L */\n" >>> print pygments.highlight(data, lexer, HtmlFormatter()).splitlines() [u'/* ', u' */', u''] I poked through the pygments documentation but couldn't find documentation on this feature. Does anyone more familiar with pygments know if there is a way to configure it to avoid this behavior? Perhaps I could work around this by adding a pygments filter to convert ^L to actual characters (or do this in apply_pygments())? Thanks, Bill -- Want to help the Review Board project? Donate today at http://www.reviewboard.org/donate/ Happy user? Let us know at http://www.reviewboard.org/users/ -~--~~~~--~~--~--~--- To unsubscribe from this group, send email to reviewboard+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/reviewboard?hl=en