Opened 11 years ago
Last modified 9 years ago
#11619 new enhancement
Option to show whitespace and tab characters in file and diff view
Reported by: | Ryan J Ollos | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | next-major-releases |
Component: | version control/browser | Version: | |
Severity: | normal | Keywords: | pygments |
Cc: | Jun Omae | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Attachments (2)
Change History (19)
by , 11 years ago
Attachment: | TsvnDiffView.png added |
---|
comment:1 by , 11 years ago
follow-up: 7 comment:2 by , 11 years ago
Cc: | added |
---|
MIDDLE DOT (U+00B7) and PILCROW SIGN (U+00B6) are defined as ambiguous characters, according to UAX #11: East Asian Width. Then, the characters are treated and rendered as double-width for 1 character in CJK environments.
>>> from unicodedata import east_asian_width >>> east_asian_width(u'\u00b7') 'A' >>> east_asian_width(u'\u00bb') 'N' >>> east_asian_width(u'\u00b6') 'A' >>>
We should use single-width characters rather than the default if the filter is used.
follow-up: 11 comment:3 by , 11 years ago
I'll have a patch ready soon that includes the suggestions from comment:2. Some early thoughts:
- We'll need to add options to a form in the source browser for:
- Visible whitespace
- Visible new lines
Presumably the options should only be present when Pygments is installed.
- Code blocks could have keyword arguments
whitespace=visible
,newlines=visible
(similarly, we recently addedlineno
keyword arguments in #10834). - The Changeset view doesn't appear to use PygmentsRenderer. I've long considered this to be a drawback and wondered whether we can use syntax highlighting in the changeset view, perhaps with lighter colors for the added/deleted highlighting.
comment:4 by , 10 years ago
Milestone: | next-major-releases → 1.1.3 |
---|---|
Owner: | set to |
Status: | new → assigned |
follow-up: 6 comment:5 by , 10 years ago
I think using Pygments in the changeset view is going to be challenging. You'd need to render both the full old and full new versions, and then retrieve the appropriate lines. Otherwise, lacking the appropriate context, the chances that things will get wrongly highlighted are high.
comment:6 by , 10 years ago
Replying to cboos:
I think using Pygments in the changeset view is going to be challenging. You'd need to render both the full old and full new versions, and then retrieve the appropriate lines. Otherwise, lacking the appropriate context, the chances that things will get wrongly highlighted are high.
We should maybe try it then for just the case Show the changes in full context.
follow-up: 8 comment:7 by , 10 years ago
Replying to jomae:
We should use single-width characters rather than the default if the filter is used.
Do you have a suggestion for which characters to use?
by , 10 years ago
Attachment: | whitespace-chars-on-ie11-ja.png added |
---|
comment:8 by , 10 years ago
Do you have a suggestion for which characters to use?
Sorry for confusing about it. I tried the default characters in pre
element with Internet Explorer 11 on Japanese Environment. These characters seems to be no problems even ambiguous characters. I consider that using default characters lead no problems. See whitespace-chars-on-ie11-ja.png and demo-1.0/ticket/3726.
comment:9 by , 10 years ago
Keywords: | pygments added |
---|
comment:10 by , 10 years ago
Milestone: | 1.1.3 → 1.1.4 |
---|
comment:11 by , 10 years ago
comment:13 by , 10 years ago
Milestone: | 1.1.5 → 1.2 |
---|
comment:15 by , 10 years ago
Milestone: | 1.1.6 → next-dev-1.1.x |
---|---|
Owner: | removed |
Status: | assigned → new |
comment:16 by , 9 years ago
Milestone: | next-dev-1.1.x → next-major-releases |
---|
comment:17 by , 9 years ago
+1 for visible whitespace and newlines! (If possible also indicate Windows newlines CR/LF etc.)
pygments.filters.VisibleWhitespaceFilter provides a whitespace annotation similar to TortoiseSVN's diff viewer.
Possible TODO In
setup.py
, the minimum Pygments version would need to be bumped from 0.6 to 0.8.