From d5b7f937806f80ad2a3963b343601340461d8017 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Debian Linux)" <rob@synchro.net>
Date: Fri, 18 Oct 2024 13:10:28 -0700
Subject: [PATCH] Add mouse reporting modes not supported by SyncTERM

1001, 1004, 1005, 1007, and 1015

Add ability for the set/clear mouse reporting calls to set/clear
'all' modes with a single function call.
---
 exec/load/ansiterm_lib.js | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/exec/load/ansiterm_lib.js b/exec/load/ansiterm_lib.js
index e75096d8a3..3e57c0b183 100644
--- a/exec/load/ansiterm_lib.js
+++ b/exec/load/ansiterm_lib.js
@@ -23,9 +23,14 @@ const defs = {
 	mouse_reporting: {
 		x10_compatible:			9,
 		normal_tracking:		1000,
+		highlight_tracking:		1001,	// Not supported by SyncTERM
 		button_events:			1002,
 		any_events:				1003,
+		focus_event_tracking:	1004,	// Not supported by SyncTERM
+		utf8_extended_coord:	1005,	// Not supported by SyncTERM
 		extended_coord:			1006,	// modifies the above modes
+		alt_scroll_mode:		1007,	// Not supported by SyncTERM
+		urxvt_extended_coord:	1015,	// Not supported by SyncTERM
 	},
 
 	// SyncTerm emulation speed map
@@ -144,9 +149,20 @@ var ext_mode = {
 	restore_all:	function()	{ return "\x1b[?u"; }
 }
 
+function mouse_reporting_modes(mode)
+{
+	var list = [];
+	if(mode == 'all')
+		for(var i in defs.mouse_reporting)
+			list.push(defs.mouse_reporting[i]);
+	else
+		list.push(defs.mouse_reporting[mode]);
+	return list.join(";");
+}
+
 var mouse = {
-	set: 	function(mode)	{ return format("\x1b[?%uh", defs.mouse_reporting[mode]); },
-	clear: 	function(mode)	{ return format("\x1b[?%ul", defs.mouse_reporting[mode]); }
+	set: 	function(mode)	{ return format("\x1b[?%sh", mouse_reporting_modes(mode)); },
+	clear: 	function(mode)	{ return format("\x1b[?%sl", mouse_reporting_modes(mode)); }
 }
 
 var speed = {
-- 
GitLab