wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.87k stars 801 forks source link

Way too easy to close accidentaly a tab using middle mouse key #2350

Closed yaslama closed 2 years ago

yaslama commented 2 years ago

What Operating System(s) are you seeing this problem on?

Linux Wayland

Which Wayland compositor or X11 Window manager(s) are you using?

Gnome/Mutter

WezTerm version

20220802-215653-1df1f166

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

I use a lot the middle mouse to paste text in the console, and if the cursor is accidentally in the tab bar, the tab is closed without any warning or confirmation. I tried the patch below but it didn't help;

diff --git a/wezterm-gui/src/termwindow/mouseevent.rs b/wezterm-gui/src/termwindow/mouseevent.rs
index 4d5f303c1..310f8a469 100644
--- a/wezterm-gui/src/termwindow/mouseevent.rs
+++ b/wezterm-gui/src/termwindow/mouseevent.rs
@@ -408,7 +408,7 @@ impl super::TermWindow {
             },
             WMEK::Press(MousePress::Middle) => match item {
                 TabBarItem::Tab { tab_idx, .. } => {
-                    self.close_tab_idx(tab_idx).ok();
+                    self.close_specific_tab(tab_idx, true);
                 }
                 TabBarItem::NewTabButton { .. } | TabBarItem::None => {}
             },

At the end, I removed the whole self.close_.. line

To Reproduce

Use a lot the middle mouse button..

Configuration

no config

Expected Behavior

No response

Logs

No response

Anything else?

The problem appeared after https://github.com/wez/wezterm/commit/d19db3c87b9412dbe25cb5e029c737de7a7f96ca

yaslama commented 2 years ago

Fixed for me by https://github.com/wez/wezterm/commit/f2f2b83899e0ea9eafa054265133cae1679ebbfc

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.