Edgewall Software
Modify

Opened 18 years ago

Closed 17 years ago

Last modified 17 years ago

#2764 closed enhancement (fixed)

[PATCH] Arbitrary line highlight in html preview

Reported by: Tim Hatch <trac@…> Owned by: Christian Boos
Priority: normal Milestone: 0.11
Component: version control/browser Version: devel
Severity: minor Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I'd like the ability to mark some lines of an html preview to draw someone's attention, using a specially-constructed url. I first noted this feature in cvsblame.cgi in use by the Mozilla project, and thus used its syntax as a model (example).

I'm attaching a diff against trunk in a second.

Attachments (3)

mimeview-annotate-marks2.diff (5.5 KB ) - added by Tim Hatch <trac@…> 18 years ago.
Diff from r2905 to add line highlighting to browser html preview
mimeview-annotate-marked-lines.diff (8.4 KB ) - added by Christian Boos 18 years ago.
Previous patch extended with support for source: #line source support
mimeview-annotate-marks4.diff (8.3 KB ) - added by Tim Hatch <trac@…> 18 years ago.
Alternate syntax for specifying marks - source:/path/to/file@rev#L(20-25)19

Download all attachments as: .zip

Change History (8)

by Tim Hatch <trac@…>, 18 years ago

Diff from r2905 to add line highlighting to browser html preview

by Christian Boos, 18 years ago

Previous patch extended with support for source: #line source support

comment:1 by Christian Boos, 18 years ago

Milestone: 0.10
Owner: changed from Jonas Borgström to Christian Boos
Severity: normalminor
Status: newassigned

Interesting. However, I think we should not advertise direct manipulation of the URLs, but instead interface such features with the WikiFormatting. For example, we can adapt the Wiki syntax for specifying line numbers so that it support ranges:
attachment:ticket:2764:mimeview-annotate-marked-lines.diff

by Tim Hatch <trac@…>, 18 years ago

Alternate syntax for specifying marks - source:/path/to/file@rev#L(20-25)19

comment:2 by Tim Hatch <trac@…>, 18 years ago

That sounds good. Take this url - how should it be specified using the wiki syntax, where the line and first mark are different?

Although I dislike the added complication, but I would favor splitting up the hashref itself and the lines to mark, like source:/path/to/file@2#L(20-22,38,46-50)19. This does not change the existing #L19 syntax, where your patch does (instead of just going to the line, it also marks it).

The marks4 patch uses this alternate syntax.

If the line and marks are jumbled together, I suggest making the line = max(0, Ranges(marks).pairs[0][0]-1), since that is sorted, and it's easier to read the preview with one line of context above the start of marks.

comment:3 by Christian Boos, 18 years ago

Milestone: 0.100.11

Could be done along side the blame support, in 0.11

comment:4 by Christian Boos, 17 years ago

Resolution: fixed
Status: assignedclosed

Implemented in r4077.

I needed the Ranges code, so I've checked in the patch ;)

Some adaptations:

  • the path link syntax is backward compatible, and the line anchor is only an anchor (i.e. it's not marked if not part of the range)
  • the ranges are specified in a separate "argument", after the revision, before the optional anchor, e.g.
    source:/path/to/file@2:20-22,38,46-50#L19
    
  • as for the anchor, when specifying line ranges to be marked, the revision is mandatory (as it usually makes no sense to refer to a specific line number in any revision; if that's nevertheless the intent, one can specify an "empty" revision)

Thanks again for the patch!

comment:5 by Christian Boos, 17 years ago

r4075 that is

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


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