diff --git a/gramps/gui/widgets/monitoredwidgets.py b/gramps/gui/widgets/monitoredwidgets.py index 00d970377..ed58cf11f 100644 --- a/gramps/gui/widgets/monitoredwidgets.py +++ b/gramps/gui/widgets/monitoredwidgets.py @@ -64,8 +64,6 @@ from gramps.gen.errors import ValidationError _RETURN = Gdk.keyval_from_name("Return") _KP_ENTER = Gdk.keyval_from_name("KP_Enter") -# table for skipping illegal control chars -INVISIBLE = dict.fromkeys(list(range(32))) #------------------------------------------------------------------------- # @@ -141,14 +139,10 @@ class MonitoredEntry: self.obj.connect(signal, callback, *data) def _on_quit(self, obj, event): - text = obj.get_text().translate(INVISIBLE).strip() - self.set_val(text) - obj.set_text(text) + self.set_val(obj.get_text().strip()) def _on_change(self, obj): - new_text = obj.get_text().translate(INVISIBLE) - self.set_val(new_text) - obj.set_text(new_text) + self.set_val(obj.get_text()) if self.changed: self.changed(obj) diff --git a/gramps/gui/widgets/undoableentry.py b/gramps/gui/widgets/undoableentry.py index 132356534..9d733d918 100644 --- a/gramps/gui/widgets/undoableentry.py +++ b/gramps/gui/widgets/undoableentry.py @@ -47,6 +47,11 @@ from gi.repository import Gtk #------------------------------------------------------------------------- from .undoablebuffer import Stack + +# table for skipping illegal control chars +INVISIBLE = dict.fromkeys(list(range(32))) + + class UndoableInsertEntry: """something that has been inserted into our Gtk.editable""" def __init__(self, text, length, position): @@ -156,6 +161,7 @@ class UndoableEntry(Gtk.Entry, Gtk.Editable): return False return True + text = text.translate(INVISIBLE) if not self.undo_in_progress: self.__empty_redo_stack() while not self.not_undoable_action: