From 8c7dec353fca4d123e4a2693abc4a857474528b0 Mon Sep 17 00:00:00 2001 From: "Rob Swindell (on Debian Linux)" <rob@synchro.net> Date: Tue, 27 Feb 2024 23:10:14 -0800 Subject: [PATCH] Search forward/backward by subjet without "re:"/"re: " prefix The search seems to be backward by default (at least when listing a sub-board), so should look into that. But at least now you can find replies that include a "re:" prefix easily. Searching by thread should be added too. --- exec/msglist.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/exec/msglist.js b/exec/msglist.js index eee751f088..af9e309fa5 100644 --- a/exec/msglist.js +++ b/exec/msglist.js @@ -637,11 +637,26 @@ function get_msg_lines(msgbase, msg, hdr, source, hex, wrap, chop) return text; } +function prop_val(msg, prop) +{ + var val = msg[prop].toLowerCase(); + + if(prop === 'subject') { + while(val.slice(0, 3) == 're:') { + val = val.slice(3); + while(val.slice(0, 1) == ' ') + val = val.slice(1); + } + } + return val; +} + function next_msg(list, current, prop) { + const val = prop_val(list[current], prop); var next = current + 1; while(next < list.length) { - if(list[next][prop].toLowerCase() == list[current][prop].toLowerCase()) + if(prop_val(list[next], prop) == val) break; next++; } @@ -653,9 +668,10 @@ function next_msg(list, current, prop) function prev_msg(list, current, prop) { + const val = prop_val(list[current], prop); var prev = current - 1; while(prev >= 0) { - if(list[prev][prop].toLowerCase() == list[current][prop].toLowerCase()) + if(prop_val(list[prev], prop) == val) break; prev--; } -- GitLab