Edgewall Software

Ticket #2764 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 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:

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

Change History

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

Diff from r2905 to add line highlighting to browser html preview

Changed 3 years ago by cboos

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

Changed 3 years ago by cboos

  • owner changed from jonas to cboos
  • status changed from new to assigned
  • severity changed from normal to minor
  • milestone set to 0.10

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 Download

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

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

Changed 3 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 Download 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.

Changed 3 years ago by cboos

  • milestone changed from 0.10 to 0.11

Could be done along side the blame support, in 0.11

Changed 3 years ago by cboos

  • status changed from assigned to closed
  • resolution set to fixed

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!

Changed 3 years ago by cboos

r4075 that is

Add/Change #2764 ([PATCH] Arbitrary line highlight in html preview)

Author


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


Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cboos. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.