Repository: zellij-org/zellij (language: rust)

Issue:
Weird mousescroll issue with Kitty
**Basic information**

`zellij --version`: zellij 0.31.3
`stty size`:38 176
`uname -av`: Darwin 21.6.0 Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000 arm64
`kitty --version`: kitty 0.26.2 created by Kovid Goyal

**Further information**

When doesn't have anything to scroll and I scroll it, it starts to add some texts:

```
66;18;29M66;18;29M66;18;29M67;18;29M67;18;29M66;18;29M66;18;29M66;18;29M67;18;29M67;18;29M66;18;29M66;18;29M66;18;29M67;18;29M67;18;29M67;18;29M66;18;29M67;18;29M66;18;29M
67;18;29M66;18;29M66;18;29M66;18;29M67;18;29M67;18;29M67;18;29M66;18;29M
```

I guess it happens scrolling to sides like left / right. Using Alacritty and Iterm2 it works. 


Discussion / hints:
Just to be clear, it works properly with alacritty or iterm2 + zellij?
Hi @tlinford,

Yes, it works:

```
zellij + alacritty = no issues
zellij + Iterm2 = no issues
zellij + Terminal = no issues
zellij + Kitty = has this issue
Just Kitty = no issues
```


And I confirmed it, it only happens doing side scrolling like on `Macbook Trackpad` and `shift + mousewheel`.

I was using `Macbook Trackpad` when I saw it. It is almost impossible to scroll using it because it constantly triggers side scrolling.
Similar issue of these weird escape sequences on kitty when side scrolling.
No such issue with other terminals (or just kitty without zellij) as @danillos mentioned above.
![unknown](https://user-images.githubusercontent.com/57829219/195945402-98b43ab2-7aa7-467f-b9cc-3213b7152c0b.png)

Same or similar issue occurs on Windows Terminal (the new one, not cmd). Zellij 0.32.0 is running through an SSH session in an Ubuntu 20 environment. I have not been able to consistently reproduce the issue through specific scrolling motion, however it happens often (every ~10 seconds) when scrolling through the history. This is on a regular Logitech mouse and no sideways scrolling.
Had another look at this, looks like `termwiz` does not support these horizontal scroll events yet.
I'll open an issue there, hopefully it won't be too hard to get this working!
Just a note, I initially thought I could not reproduce this, but apparently `fish` simply disregards these sequences and they were not showing up.
This issue also occurs when using with the dev version of Alacritty since https://github.com/alacritty/alacritty/pull/6625 being merged.
> This issue also occurs when using with the dev version of Alacritty since [alacritty/alacritty#6625](https://github.com/alacritty/alacritty/pull/6625) being merged.

Thanks for the info!
The fix we needed to solve this got merged in termwiz so we should be able to get this solved for the next release.

Fix patch:
diff --git a/Cargo.lock b/Cargo.lock
index 58456fb419..e782d47764 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -253,6 +253,12 @@ version = "0.13.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
 
+[[package]]
+name = "base64"
+version = "0.21.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"
+
 [[package]]
 name = "bitflags"
 version = "1.3.2"
@@ -2942,12 +2948,12 @@ dependencies = [
 
 [[package]]
 name = "termwiz"
-version = "0.19.0"
+version = "0.20.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1c18a622b077791579bcf2a631c29d552fedba6816701296dbe465ad01845fda"
+checksum = "9509a978a10fcbace4991deae486ae10885e0f4c2c465123e08c9714a90648fa"
 dependencies = [
  "anyhow",
- "base64",
+ "base64 0.21.0",
  "bitflags",
  "filedescriptor",
  "finl_unicode",
@@ -4023,7 +4029,7 @@ dependencies = [
  "ansi_term",
  "arrayvec 0.7.2",
  "async-trait",
- "base64",
+ "base64 0.13.0",
  "byteorder",
  "cassowary",
  "chrono",
diff --git a/zellij-utils/Cargo.toml b/zellij-utils/Cargo.toml
index cc18c8f805..32caa39105 100644
--- a/zellij-utils/Cargo.toml
+++ b/zellij-utils/Cargo.toml
@@ -40,7 +40,7 @@ kdl = { version = "4.5.0", features = ["span"] }
 
 #[cfg(not(target_family = "wasm"))]
 [target.'cfg(not(target_family = "wasm"))'.dependencies]
-termwiz = "0.19.0"
+termwiz = "0.20.0"
 log4rs = "1.2.0"
 signal-hook = "0.3"
 interprocess = "1.1.1"


Test patch: