Andy Green on Mon, 2018/06/25 13:49:
> Just like the config allows setting css URL path,
> add a config for setting the js URL path
>
> Setting the js path to an empty string disables
> emitting the reference to it in the head section.
>
> Signed-off-by: Andy Green
> Reviewed-by: John Keeping
These warnings are coming on default Fedora 28 build and probably others using
gcc 8.1
../shared.c: In function ‘expand_macro’:
../shared.c:483:3: warning: ‘strncpy’ specified bound depends on the length of
the source argument [-Wstringop-overflow=]
strncpy(name, value, len);
This allows the user to select line ranges simply by clicking on the
line number links.
- No selected highlit line, or a range already selected, causes the
click to highlight just the clicked line as usual.
- Clicking on a second line number link when a single line was already
highlit creates
Just like the config allows setting css URL path,
add a config for setting the js URL path
Setting the js path to an empty string disables
emitting the reference to it in the head section.
Signed-off-by: Andy Green
Reviewed-by: John Keeping
---
Makefile |1 +
cgit.c |3 +++
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 along with a new
config "js" to
Browser default interpretation of the # part of the URL is
to try to match it to an element ID one time at page load.
Subsequent modifications in the URL bar are ignored, even if
you hit enter there.
This patch makes the line range highlight able to clean up
after itself and be reapplied, and
Clicking on the line numbers to control the highlight
now causes a clipboard icon to appear to the left of
the line for 5s.
Clicking this will copy the highlight URL to the
clipboard, and cause the icon to grow, blur and
fade to acknowledge the click.
After 5s the clipboard icon will fade out...
cgit_repobasename has one user also in ui-shared.c. Make it static
and remove the declaration from cgit.h.
Instead of the gnarly return pointer to now deallocated stack,
compute the valid part of the string using the incoming pointer,
then just allocate the right amount and copy it in. Drop the
These patches fix warnings blown by gcc8.1 about strncpy usage.
The first patch is the first part of v1 that got a confusing
reception the first time. But I think in the end no objection
to it.
In the second version, I follow John's suggestion and go further
refactoring the affected functions.