From 9546e85ab963cb4e87be0fae9a8f6055be12f3d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Fri, 18 Oct 2024 15:01:11 -0400
Subject: [PATCH] Be more aggressive about setting mouse modes.

When starting, turn off all mouse modes, then turn on the ones we
need instead of relying on the console object to do anything in
particular.

On exit, explicitly turn off the two modes we had enabled before
changing the console setting.

Maybe this will fix the SyncTERM bug 153
---
 xtrn/minesweeper/minesweeper.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xtrn/minesweeper/minesweeper.js b/xtrn/minesweeper/minesweeper.js
index 0dd6ac31d7..2e42bb73ba 100644
--- a/xtrn/minesweeper/minesweeper.js
+++ b/xtrn/minesweeper/minesweeper.js
@@ -1245,8 +1245,8 @@ function detect_graphics()
 	console.ctrlkey_passthru = tmpckpt;
 	if (graph) {
 		console.mouse_mode = false;
-		console.write("\x1b[?1003;1006h");
-		js.on_exit("console.mouse_mode = orig_mouse; user.misc = orig_misc; console.autoterm = orig_autoterm;");
+		console.write("\x1b[?9;1000;1001;1002;1004;1005;1007;1015;1016l\x1b[?1003;1006h");
+		js.on_exit("console.write('\x1b[?1003;1006l;'); console.mouse_mode = orig_mouse; user.misc = orig_misc; console.autoterm = orig_autoterm;");
 	}
 }
 
-- 
GitLab