Skip to content

Commit

Permalink
Merge pull request #777 from mattrose/776-fix-logger
Browse files Browse the repository at this point in the history
Alter get_text_range call based on VTE version
  • Loading branch information
mattrose authored Jun 20, 2023
2 parents e0592ea + 1a4921b commit b7e91b1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions terminatorlib/plugins/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import os
import sys
from gi.repository import Gtk
from gi.repository import Gtk,Vte
import terminatorlib.plugin as plugin
from terminatorlib.translation import _

Expand All @@ -19,6 +19,7 @@ class Logger(plugin.MenuItem):
dialog_action = Gtk.FileChooserAction.SAVE
dialog_buttons = (_("_Cancel"), Gtk.ResponseType.CANCEL,
_("_Save"), Gtk.ResponseType.OK)
vte_version = Vte.get_minor_version()

def __init__(self):
plugin.MenuItem.__init__(self)
Expand All @@ -40,8 +41,11 @@ def callback(self, menuitems, menu, terminal):

def write_content(self, terminal, row_start, col_start, row_end, col_end):
""" Final function to write a file """
content = terminal.get_text_range(row_start, col_start, row_end, col_end,
if self.vte_version < 72:
content = terminal.get_text_range(row_start, col_start, row_end, col_end,
lambda *a: True)
else:
content = terminal.get_text_range_format(Vte.Format.TEXT,row_start, col_start, row_end, col_end)
content = content[0]
fd = self.loggers[terminal]["fd"]
# Don't write the last char which is always '\n'
Expand Down

0 comments on commit b7e91b1

Please sign in to comment.