From 748def5467674c0652f222830358211b2799839e Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Wed, 10 Jul 2024 21:15:39 +0200 Subject: 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 --- ChangeLog | 1 + dpi/vsource.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07c20e84..63cb5dce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 + * Copyright 2024 Rodrigo Arias Mallo * * 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, - "%d%s", - (line & 1) ? "r1" : "r2", line, + "%d%s", + (line & 1) ? "r1" : "r2", line, line, line, (line == 1 || (line % 10) == 0) ? " " : ""); a_Dpip_dsh_write_str(sh, 0, line_str); old_line = line; -- cgit v1.2.3