Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux: Split resize area too large #3020

Open
Sirius902 opened this issue Dec 19, 2024 · 9 comments
Open

Linux: Split resize area too large #3020

Sirius902 opened this issue Dec 19, 2024 · 9 comments
Labels

Comments

@Sirius902
Copy link

Issue

The area in which you can click and drag to resize splits is too large, it is even possible to resize the splits without the cursor showing that it may be resized. With the horizontal split configuration shown below, the offending area seems to be larger on the edge bordering the right split. In the video, you can see that I can select starting from the third character from the left on the split border but not any closer to the border.

I can only reproduce this on my Linux box, not on macOS.

split-shenanagins.mp4

Expectation

I would expect the following regardless of the OS in use, currently these expectations seem to be met on macOS but not with my Linux setup:

  • It is possible to select characters bordering splits using the mouse (difficult right now due to this issue).
  • Clicking and dragging will not resize splits unless the cursor is also changed to reflect this.
  • The area you can click and drag to resize splits is appropriately sized to the split border.

Configuration

Running on NixOS with GNOME.

ghostty built from flake with commit fa3896b.

@Sirius902 Sirius902 changed the title Split resize area too large Linux: Split resize area too large Dec 19, 2024
@mitchellh mitchellh added os/linux needs-confirmation A reproduction has been reported, but the bug hasn't been confirmed or reproduced by a maintainer. labels Dec 20, 2024
@mitchellh
Copy link
Contributor

I wonder if this will end up being a GTK issue and not ours. We're using a native GTK widget for this and as far as I know we don't define any of this, but its worth investigation.

@jcollie
Copy link
Member

jcollie commented Dec 22, 2024

Yeah, I'd say that's a "feature" of GTK. Not even sure how you'd change that without some deep GTK magic. The workaround is to use the mouse to select from right-to-left, rather than selecting from left-to-right.

@mitchellh
Copy link
Contributor

Yep, my research is that this is just GTK doing this. I think this is acceptable.

@akhilerm
Copy link

Facing the same issue. This means that sometime it is difficult to select characters and text that start at the left of the split.

@carragom
Copy link

carragom commented Feb 8, 2025

Having the same problem, reported as duplicate in #5630. Bit sad to hear this is acceptable.

@daviewales
Copy link
Contributor

daviewales commented Feb 10, 2025

It is strange to me that this is a 'GTK issue', when other GTK apps on my system don't exhibit this behaviour. (Unless it's a GTK3 vs GTK4 issue? Or a Libadwaita issue?) I have noted in a related discussion that Nemo for example has a split divider between the left sidebar and the directory view, and it works as expected. In particular, the drag surface in Nemo and the drag cursor indicator are consistent, unlike Gostty. The drag surface in Nemo is also much narrower then in Ghostty.
See: #5655 (reply in thread)

Edit: gtk-adwaita = false doesn't fix it.

@daviewales
Copy link
Contributor

daviewales commented Feb 10, 2025

Confirming that this is indeed a Gtk 4 issue:

The following minimal Gtk 3 app does not have the issue:

# https://stackoverflow.com/a/69773849

import gi

gi.require_version("Gtk", "3.0")
from gi.repository import Gtk

class App(Gtk.Window):
    """The window."""

    def __init__(self):
        super().__init__()
        self.connect("delete-event", Gtk.main_quit)

        self.set_default_size(200, 200)

        # The paned window
        self.paned = Gtk.Paned()
        self.add(self.paned)

        # Widets to put in the paned window
        self.label = Gtk.Label(label="Sidebar")
        self.paned.add1(self.label)

        self.button = Gtk.Button.new_with_label("Something else")
        self.paned.add2(self.button)

        self.show_all()

App()
Gtk.main()

Updating this minimal app to Gtk 4, the issue appears:

# https://stackoverflow.com/a/69773849
# https://github.com/Taiko2k/GTK4PythonTutorial

import gi
gi.require_version('Gtk', '4.0')
from gi.repository import Gtk

class MainWindow(Gtk.ApplicationWindow):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.set_default_size(200, 200)

        # The paned window
        self.paned = Gtk.Paned()
        self.set_child(self.paned)

        # Widets to put in the paned window
        self.label = Gtk.Label(label="Sidebar")
        self.paned.set_start_child(self.label)

        self.button = Gtk.Button.new_with_label("Something else")
        self.paned.set_end_child(self.button)

class MyApp(Gtk.Application):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.connect('activate', self.on_activate)

    def on_activate(self, app):
        self.win = MainWindow(application=app)
        self.win.present()

app = MyApp(application_id="com.example.GtkApplication")
app.run()

The issue remains if we use Adwaita:

6c6,7
< from gi.repository import Gtk
---
> gi.require_version('Adw', '1')
> from gi.repository import Gtk, Adw
25c26,27
< class MyApp(Gtk.Application):
---
>
> class MyApp(Adw.Application):

Edit: I've opened an issue with GTK: https://gitlab.gnome.org/GNOME/gtk/-/issues/7330
Edit: That was a duplicate. Here's the original GTK issue: https://gitlab.gnome.org/GNOME/gtk/-/issues/4484

daviewales added a commit to daviewales/ghostty that referenced this issue Feb 26, 2025
Improves ghostty-org#3020.

Based on recommendation from upstream Gtk issue:
https://gitlab.gnome.org/GNOME/gtk/-/issues/4484#note_2362002

Without this, it's not possible to select the first character on the
right-hand side of a split.
daviewales added a commit to daviewales/ghostty that referenced this issue Feb 26, 2025
Improves ghostty-org#3020.

Ensures that the drag handle for the pane separator never overlaps pane
content.

See recommendation in upstream Gtk issue:
https://gitlab.gnome.org/GNOME/gtk/-/issues/4484#note_2362002
daviewales added a commit to daviewales/ghostty that referenced this issue Feb 27, 2025
Improves ghostty-org#3020.

Based on recommendation from upstream Gtk issue:
https://gitlab.gnome.org/GNOME/gtk/-/issues/4484#note_2362002

Without this, it's not possible to select the first character on the
right-hand side of a split.
daviewales added a commit to daviewales/ghostty that referenced this issue Feb 27, 2025
Improves ghostty-org#3020.

Based on recommendation from upstream Gtk issue:
https://gitlab.gnome.org/GNOME/gtk/-/issues/4484#note_2362002

Without this, it's not possible to select the first character on the
right-hand side of a split.
jcollie added a commit that referenced this issue Feb 27, 2025
Improves #3020.

Based on recommendation from upstream Gtk issue:
https://gitlab.gnome.org/GNOME/gtk/-/issues/4484#note_2362002

Without this, it's not possible to select the first character on the
right-hand side of a split.
@jcollie
Copy link
Member

jcollie commented Feb 27, 2025

Keeping this open since the issue isn't 100% solved yet.

@jcollie jcollie reopened this Feb 27, 2025
@jcollie jcollie removed the needs-confirmation A reproduction has been reported, but the bug hasn't been confirmed or reproduced by a maintainer. label Feb 27, 2025
daviewales added a commit to daviewales/ghostty that referenced this issue Mar 3, 2025
Improves ghostty-org#3020.

Ensures that the drag handle for the pane separator never overlaps pane
content.

See recommendation in upstream Gtk issue:
https://gitlab.gnome.org/GNOME/gtk/-/issues/4484#note_2362002
daviewales added a commit to daviewales/ghostty that referenced this issue Mar 3, 2025
Improves ghostty-org#3020.

Ensures that the drag handle for the pane separator never overlaps pane
content.

See recommendation in upstream Gtk issue:
https://gitlab.gnome.org/GNOME/gtk/-/issues/4484#note_2362002

Also add WIP CSS to style the pane handle with a single centered 1px
line, rather than two 1px borders.
daviewales added a commit to daviewales/ghostty that referenced this issue Mar 3, 2025
Improves ghostty-org#3020.

Ensures that the drag handle for the pane separator never overlaps pane
content.

See recommendation in upstream Gtk issue:
https://gitlab.gnome.org/GNOME/gtk/-/issues/4484#note_2362002

Also add WIP CSS to style the pane handle with a single centered 1px
line, rather than two 1px borders.
@daviewales
Copy link
Contributor

I've added some partial progress to a discussion here: #6059. Suggestions welcome!

daviewales added a commit to daviewales/ghostty that referenced this issue Mar 3, 2025
Improves ghostty-org#3020.

Ensures that the drag handle for the pane separator never overlaps pane
content.

See recommendation in upstream Gtk issue:
https://gitlab.gnome.org/GNOME/gtk/-/issues/4484#note_2362002

Also add WIP CSS to style the pane handle with a single centered 1px
line, rather than two 1px borders.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants