Get all the scrollback text in a Vte.Terminal

I’m using a Vte.Terminal (in Gtk4) and I want to copy into the clipboard all the text in the terminal, both the visible one and the text in the scrollback buffer. I found that I can use vte_terminal_get_text_range_format, but I have the problem of how to get the number of rows stored in the scrollback buffer. vte_terminal_get_row_count() returns the visible size, not the full size (also, I presume that vte_terminal_get_column_count() is enough for the column size…).

I’ve not tried it, but maybe gnome-builder/src/libide/terminal/ide-terminal-page-actions.c#L190-201 helps.

From a quick look, vte_terminal_get_row_count () in that code is supposed to cover all rows, as it’s a save all terminal content code.