mate-desktop / mate-terminal

The MATE Terminal Emulator
http://www.mate-desktop.org
GNU General Public License v3.0
135 stars 73 forks source link

Set Title dialog box appears when double-clicking in "tui" apps #444

Closed mjd-tech closed 9 months ago

mjd-tech commented 9 months ago

Expected behaviour

Dialog should only appear when double-clicking a tab

Actual behaviour

When running "tui" apps such as vim, neovim, htop, midnight commander, etc. the dialog appears when double-clicking in the terminal window.

Steps to reproduce the behaviour

Launch mate-terminal. run vim. Double-click anywhere inside the window.

MATE general version

1.26.1

Package version

1.27.1

Linux Distribution

Manjaro

Link to bugreport of your Distribution (requirement)

I attempted to do this but failed

lukefromdc commented 9 months ago

I wasn't able to duplicate this with visudo (based on vim) or with nano. I don't have vim itself installed as I prefer nano for such tasks

mjd-tech commented 9 months ago

You're right. Not a problem with nano or less (the pager). I've noticed it with: htop, fzf, mc (midnight commander), gdu, vim, neovim, dialog. Maybe these use a different ncurses library or something. These support mouse, nano and less do not. When I use Tilix instead of Mate-terminal, everything works as expected. Mate-terminal was working fine until the "double-click tab to set title" feature was added.

lukefromdc commented 9 months ago

I don't have anything installed by default that triggers this. Presumably some of the other devs here do

mjd-tech commented 9 months ago

Thanks for looking at this.

Just to make sure this isn't a Manjaro/Arch problem, I did the following:

Same issues as on Manjaro, so it's not a distro issue.

I took a look at xfce4-terminal's terminal-window.c at line 1196, it looks like they are checking to make sure you actually double clicked on a tab.

Whereas in mate-terminal's terminal-window.c, line 2994 it just acts on a double click event.

Perhaps if we add xfce's check, it fixes the problem. Unfortunately I don't know how to do this.

Here's the snippet from xfce4-terminal

        /* check if the user double-clicked on the label */
          label = gtk_notebook_get_tab_label (notebook, GTK_WIDGET (window->priv->active));
          if (terminal_window_notebook_event_in_allocation (x, y, label))
            {
              terminal_window_action_set_title (window);
              return TRUE;
            }
        }
lukefromdc commented 9 months ago

Looks like the general algorithm here is to ensure the click was in the tab space before opening the dialog

lukefromdc commented 9 months ago

Installed htop, issue confirmed here

lukefromdc commented 9 months ago

Try https://github.com/mate-desktop/mate-terminal/pull/446

mjd-tech commented 9 months ago

I like your idea of just removing this feature.

The user can already set the title three ways:

  1. clicking "Terminal...Set Title" in the main menu bar.
  2. right-clicking on the tab and choose "Set Title"
  3. create a profile with the desired title

I think if mate-terminal is going to borrow an idea from xfce4-terminal, it should be adding "Open file manager here" to the "File" menu.

lukefromdc commented 9 months ago

We have a better and simpler fix in https://github.com/mate-desktop/mate-terminal/pull/446 now, thanks to @cwendling I will leave the choice betweeen reverting the prior offending commit and this fix to the rest of the team

lukefromdc commented 9 months ago

https://github.com/mate-desktop/mate-terminal/pull/446 is merged, so closing as the fix will automatically be in the next 1.27 point release