Edgewall Software
Modify

Ticket #2764 (closed enhancement: fixed)

Opened 6 years ago

Last modified 5 years ago

[PATCH] Arbitrary line highlight in html preview

Reported by: Tim Hatch <trac@…> Owned by: cboos
Priority: normal Milestone: 0.11
Component: version control/browser Version: devel
Severity: minor Keywords:
Cc:
Release Notes:
API 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

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

Download all attachments as: .zip

Change History

Changed 6 years ago by Tim Hatch <trac@…>

Diff from r2905 to add line highlighting to browser html preview

Changed 6 years ago by cboos

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

comment:1 Changed 6 years ago by cboos

  • Milestone set to 0.10
  • Owner changed from jonas to cboos
  • Severity changed from normal to minor
  • Status changed from new to assigned

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

Changed 6 years ago by Tim Hatch <trac@…>

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

comment:2 Changed 6 years ago by Tim Hatch <trac@…>

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 Changed 6 years ago by cboos

  • Milestone changed from 0.10 to 0.11

Could be done along side the blame support, in 0.11

comment:4 Changed 5 years ago by cboos

  • Resolution set to fixed
  • Status changed from assigned to closed

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 Changed 5 years ago by cboos

r4075 that is

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from cboos. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.