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

Fix save content with newer Vte #2218

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions guake/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,24 @@ def __init__(self, terminal, window):
self.parent_window = window

def run(self):
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:
return
selection = selection.rstrip()
# row from get_cursor_position takes the scrollback rows into account automatically
row = self.terminal.get_cursor_position()[1]
# Get the max col, not where the cursor is, to avoid losing text at the end
col = self.terminal.get_column_count()
content = self.terminal.get_text_range(0, 0, row, col)

if content and content[0]:
selection = content[0].rstrip().lstrip()
else: # Call the original method if get_text_range fails for some reason. (Can it fail?)
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:
return
selection = selection.rstrip()

filter = Gtk.FileFilter()
filter.set_name(_("All files"))
filter.add_pattern("*")
Expand Down
6 changes: 6 additions & 0 deletions releasenotes/notes/bugfix-503a9fee8f80e714.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
release_summary: >
Fixes Save Content feature for newer versions of Vte

fixes:
- Save Content works for newer versions of Vte, fixes #1958

Loading