Edgewall Software
Modify

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:

Description

The TortoiseSVN diff view has the option to show whitespace and tab characters. It would be useful to have an option to do the same in the Trac file and diff views.

Attachments (2)

TsvnDiffView.png (21.2 KB ) - added by Ryan J Ollos 11 years ago.
whitespace-chars-on-ie11-ja.png (46.1 KB ) - added by Jun Omae 10 years ago.

Download all attachments as: .zip

Change History (19)

by Ryan J Ollos, 11 years ago

Attachment: TsvnDiffView.png added

comment:1 by Ryan J Ollos, 11 years ago

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.

comment:2 by Jun Omae, 11 years ago

Cc: Jun Omae 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.

comment:3 by Ryan J Ollos, 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 added lineno 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 Ryan J Ollos, 10 years ago

Milestone: next-major-releases1.1.3
Owner: set to Ryan J Ollos
Status: newassigned

comment:5 by Christian Boos, 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.

in reply to:  5 comment:6 by Ryan J Ollos, 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.

in reply to:  2 ; comment:7 by Ryan J Ollos, 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 Jun Omae, 10 years ago

in reply to:  7 comment:8 by Jun Omae, 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 Ryan J Ollos, 10 years ago

Keywords: pygments added

comment:10 by Ryan J Ollos, 10 years ago

Milestone: 1.1.31.1.4

in reply to:  3 comment:11 by Ryan J Ollos, 10 years ago

Replying to rjollos:

  • 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.

Here is some inspiration.

comment:12 by Ryan J Ollos, 10 years ago

Milestone: 1.1.41.1.5

Narrowing focus for 1.1.4.

comment:13 by Ryan J Ollos, 10 years ago

Milestone: 1.1.51.2

comment:14 by Ryan J Ollos, 10 years ago

Milestone: 1.21.1.6

Milestone renamed

comment:15 by Ryan J Ollos, 10 years ago

Milestone: 1.1.6next-dev-1.1.x
Owner: Ryan J Ollos removed
Status: assignednew

comment:16 by Ryan J Ollos, 9 years ago

Milestone: next-dev-1.1.xnext-major-releases

comment:17 by anonymous, 9 years ago

+1 for visible whitespace and newlines! (If possible also indicate Windows newlines CR/LF etc.)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.