diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-07-10 21:15:39 +0200 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-07-18 22:01:20 +0200 |
commit | 748def5467674c0652f222830358211b2799839e (patch) | |
tree | 39d4770dfb40a1f9b3bcfed92be39f3574a3e931 | |
parent | de11bf3bd4852832c45bd4f3f39ab4bacab3b438 (diff) |
Add anchors in line numbers for HTML source view
They allow linking to an specific line in the source code. This would be
useful to add to the bug meter view, so the user can quickly jump to the
error line in the HTML source.
Fixes: https://github.com/dillo-browser/dillo/issues/214
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | dpi/vsource.c | 5 |
2 files changed, 4 insertions, 2 deletions
@@ -15,6 +15,7 @@ dillo-3.2.0 [Not released yet] Add zoom support using Ctrl +/-/0 and the "zoom_factor" option. Fix wrong redirect by meta refresh without URL. Display JSON as plain text. + Add line number anchors in HTML source view. Patches: Rodrigo Arias Mallo dillo-3.1.1 [Jun 8, 2024] diff --git a/dpi/vsource.c b/dpi/vsource.c index 9d5694b5..3446be63 100644 --- a/dpi/vsource.c +++ b/dpi/vsource.c @@ -4,6 +4,7 @@ * This server is an example. Play with it and modify to your taste. * * Copyright 2010-2015 Jorge Arellano Cid <jcid@dillo.org> + * Copyright 2024 Rodrigo Arias Mallo <rodarima@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -134,8 +135,8 @@ void send_html_text(Dsh *sh, const char *url, int data_size) while (*p) { if (line > old_line) { snprintf(line_str, 128, - "<tr><td class='%s'>%d%s<td>", - (line & 1) ? "r1" : "r2", line, + "<tr><td class='%s' id='L%d'><a href='#L%d'>%d%s</a><td>", + (line & 1) ? "r1" : "r2", line, line, line, (line == 1 || (line % 10) == 0) ? " " : ""); a_Dpip_dsh_write_str(sh, 0, line_str); old_line = line; |