From b5b74e8071dace8902668363b0600d7ff52294b5 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sat, 28 Nov 2015 20:14:14 +0100 Subject: [PATCH] Add option to toggle the rewrap on resize --- doc/terminator_config.5 | 4 ++++ terminatorlib/config.py | 1 + terminatorlib/preferences.glade | 16 ++++++++++++++++ terminatorlib/prefseditor.py | 8 ++++++++ terminatorlib/terminal.py | 2 ++ 5 files changed, 31 insertions(+) diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index 56763c04..c6f736ff 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -465,6 +465,10 @@ Default value: \fBUTF-8\fR .B copy_on_selection \fR(boolean) If set to True, text selections will be automatically copied to the clipboard, in addition to being made the Primary selection. Default value: \fBFalse\fR +.TP +.B rewrap_on_resize \fR(boolean) +If True, the terminal contents are rewrapped when the terminal's width changes. Warning: This might be slow if you have a huge scrollback buffer. +Default value: \fBTrue\fR .SH layouts diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 52b34430..501f7f1b 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -240,6 +240,7 @@ DEFAULTS = { 'force_no_bell' : False, 'cycle_term_tab' : True, 'copy_on_selection' : False, + 'rewrap_on_resize' : True, 'split_to_group' : False, 'autoclean_groups' : True, 'http_proxy' : '', diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index bfe32de3..d7c63e45 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -1603,6 +1603,22 @@ 4 + + + Rewrap on resize + True + True + False + False + True + + + + False + False + 5 + + False diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index cabe27e4..46b02fed 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -421,6 +421,9 @@ class PrefsEditor: # Copy on selection widget = guiget('copy_on_selection') widget.set_active(self.config['copy_on_selection']) + # Rewrap on resize + widget = guiget('rewrap_on_resize_checkbutton') + widget.set_active(self.config['rewrap_on_resize']) # Cursor shape widget = guiget('cursor_shape_combobox') if self.config['cursor_shape'] == 'underline': @@ -696,6 +699,11 @@ class PrefsEditor: self.config['copy_on_selection'] = widget.get_active() self.config.save() + def on_rewrap_on_resize_toggled(self, widget): + """Rewrap on resize setting changed""" + self.config['rewrap_on_resize'] = widget.get_active() + self.config.save() + def on_cursor_blink_toggled(self, widget): """Cursor blink setting changed""" self.config['cursor_blink'] = widget.get_active() diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index a6a7ca44..68a1bf71 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -770,6 +770,8 @@ class Terminal(Gtk.VBox): elif self.config['scrollbar_position'] == 'right': self.reorder_child(self.vte, 0) + self.vte.set_rewrap_on_resize(self.config['rewrap_on_resize']) + self.titlebar.update() self.vte.queue_draw()