[PATCH v3 0/6] line range highlight

Andy Green andy at warmcat.com
Sun Jun 24 04:44:24 CEST 2018


The following series adds the ability to direct the browser
to highlight specific lines and ranges of lines in
/tree/, /source/, and /blame/ views, using the existing
#URLs.

As part of the implementation it adds a new cgit.js file
that is included in cgit page <head> along with a new
config "js" to specify its url, defaulting to "/cgit.js".
It can be disabled by setting the "js" config to an empty
string.

Since v2 the footprint in the C has been reduced to a few
lines; the user is able to define ranges in the browser
by clicking on the line numbers alone; and clicking on the
line numbers auto-copies the line or range URL to the
clipboard.

You can find the patches as a usable tree here

https://warmcat.com/git/cgit/log/

Examples:

https://libwebsockets.org/git/libwebsockets/tree/lib/core/private.h#n152
https://libwebsockets.org/git/libwebsockets/tree/lib/core/private.h#n39-47

---

Andy Green (6):
      config: add js
      ui-shared: line range highlight: introduce javascript
      cgit.js: line range highlight: make responsive to url changes
      cgit.js: line range highlight: improve vertical scroll logic
      line-range-highlight: onclick handler and range selection
      line-range-highlight: copy URL to clipboard on click


 Makefile     |    1 
 cgit.c       |    3 +
 cgit.css     |    7 +++
 cgit.h       |    1 
 cgit.js      |  158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 cgitrc.5.txt |    6 ++
 ui-blame.c   |    2 -
 ui-shared.c  |    5 ++
 ui-tree.c    |    2 -
 9 files changed, 183 insertions(+), 2 deletions(-)
 create mode 100644 cgit.js

--
Signature


More information about the CGit mailing list