Guake / guake

Drop-down terminal for GNOME
https://guake.github.io
GNU General Public License v2.0
4.41k stars 576 forks source link

Save content saves only visible screen #1958

Open filipjenicek opened 2 years ago

filipjenicek commented 2 years ago

Describe the bug The "Save content..." option in the context menu saves only the visible content of the terminal.

Expected behavior Full terminal output is saved including scrolled content.

Actual behavior On Debian 11, only the visible part is saved. AFAIK on Debian 10 all contents were saved correctly.

To Reproduce Debian 11 (Oct29) xfce4 Reproduced with debian packages 3.4.0-1, 3.8.0-1 and also with the latest src code a084a1d0d11d2306ca5447c2cfaf31db0393c798.

$ guake --support Guake Version: 3.8.2.dev4 Vte Version: 0.62.3 Vte Runtime Version: 0.62.3 -------------------------------------------------- GTK+ Version: 3.24.24 GDK Backend:
Davidy22 commented 2 years ago

Unable to reproduce, need more information, but will also note that I believe I've seen this behavior asked for before as a feature request so might be nice to preserve this as an option once we figure out what's happening here. If possible, do you also have the guake support log for the machine where this worked?

filipjenicek commented 2 years ago

You can reproduce it on Debian 11:

  1. Download https://www.linuxvmimages.com/images/debian-11/
  2. sudo apt install guake

  3. open guake, execute sudo dmesg
  4. Run the guake context menu action "save content..."
  5. The resulting file has only a few lines depending on your screen size.

It works well on Debian 10: https://www.linuxvmimages.com/images/debian-10

The key difference is the version of libvte, which is 0.62.3 on Debian 11, and 0.54.2-2 on Debian 10.

If you downgrade libvte to 0.54.2-2 (https://packages.debian.org/buster/libvte-2.91-0), it starts to work well. I suppose the guake's clipboard hack is not compatible with newer releases of libvte.

Davidy22 commented 2 years ago

Don't have a newer version of VTE in my repo, but since this is isolated to newer VTE I should be able to figure this out, can start checking documentation for now.

Davidy22 commented 2 years ago

Now have vte 0.66.2 and still not encountering this, although I am observing some kind of hang that's probably a different issue.

nyaapa commented 10 months ago

Reproes on ubuntu 22.04 w/ both stock (3.8.5) and updated from linuxuprising (3.10) guake.

➤  dpkg -l | grep vte  
ii  gir1.2-vte-2.91:amd64                      0.68.0-1                                   amd64        GObject introspection data for the VTE library
ii  libvte-2.91-0:amd64                        0.68.0-1                                   amd64        Terminal emulator widget for GTK+ 3.0 - runtime files
ii  libvte-2.91-common                         0.68.0-1                                   amd64        Terminal emulator widget for GTK+ 3.0 - common files
➤  guake --support
<details><summary>$ guake --support</summary>

Guake Version:      3.10

Vte Version:        0.68.0

Vte Runtime Version:    0.68.0

--------------------------------------------------
GTK+ Version:       3.24.33

GDK Backend:        <GdkX11.X11Display

--------------------------------------------------
Desktop Session: ubuntu

--------------------------------------------------
Display: :0

RGBA visual: True

Composited: True

* Monitor: 0 - XWAYLAND4
    * Geometry:     2560 x 1440 at 0, 0
    * Size:     600 x 340 mm²
    * Primary:      True
    * Refresh rate: 143.913 Hz
    * Subpixel layout:  unknown

is it this https://github.com/Guake/guake/blob/47312dc2481b2fa617afe79cdcfddadf60e84516/guake/dialogs.py#L145-L146 ?

https://valadoc.org/vte-2.91/Vte.Terminal.select_all.html

Selects all text within the terminal (not including the scrollback buffer).

hmm;

Slow as hell, but smth like that (using get_text_range; don't mind diff direction 🙈 )?

~ ➤  diff /usr/lib/python3/dist-packages/guake/dialogs.py guake/guake/dialogs.py
146,149c146,151
<         col, row = self.terminal.get_cursor_position()
<         scrollback = self.terminal.get_scrollback_lines()
<         content = self.terminal.get_text_range(max(0, row - scrollback), 0, row, col, lambda *a: True)
<         if not content:
---
>         self.terminal.select_all()
>         self.terminal.copy_clipboard()
>         self.terminal.unselect_all()
>         clipboard = Gtk.Clipboard.get_default(self.parent_window.get_display())
>         selection = clipboard.wait_for_text()
>         if not selection:
151,152c153
< 
<         selection = content[0].rstrip().lstrip()
---
>         selection = selection.rstrip()

(need to fix the starting row though, 0 can be beyond horizon) (updated; still can go beyond, but at least scoped; and isn't respecting clear :( )

smith-doug commented 8 months ago

Based on the above comment https://github.com/smith-doug/guake/commit/156a30ba8d2e4fcbc86bc8da186f5c59cbbc174e This seems to work, doesn't miss any text, and respects clear. I'm on Ubuntu 22.04.

At some point Vte changed the behavior of select_all. This has affected other terminals https://github.com/mate-desktop/mate-terminal/issues/372