Opened 13 years ago
Last modified 7 years ago
#10284 closed enhancement
[PATCH] Fragment identifier search — at Initial Version
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | 1.0 |
Component: | general | Version: | |
Severity: | normal | Keywords: | search |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
As discussed on TracDev/PluginDevelopment, a way to deep link into pages a bit more robust to changes than specifying an anchor like #L123
would be useful.
I propose a JavaScript approach that dynamically searches and scrolls to a term specified in the fragment identifier.
cboos proposed a syntax (based on a vim-ism?) for scrolling to the first match using #/term
and to the last match using #?term
.
For example the link tags/trac-0.5/setup.py#/import would link to line 3 (import sys
), while tags/trac-0.5/setup.py#?import would link to line 8.
The attached patch implements this by extending the existing search term highlighting. (Note that this makes it available on all searchable pages, like in the source file browser or in the wiki.)
The exact syntax could be changed or extended. Maybe #term:n
for the n
th and #term:-n
for the n
th last match?
Implements
#/forward
and#?backward
fragment identifier search