diff options
author | Wade Brainerd <wadetb@gmail.com> | 2009-10-22 01:17:56 (GMT) |
---|---|---|
committer | Wade Brainerd <wadetb@gmail.com> | 2009-10-22 01:17:56 (GMT) |
commit | 1f4b1d8a800a46328abd056c0ffa417c2fde735f (patch) | |
tree | 22c00b1c756f82e9794cbdc92d1a7ec6218a89bd | |
parent | 0e688b0b61bdb0dbb73fa3b02074849053614933 (diff) |
Fix Backspace in lessons.
-rw-r--r-- | lessonscreen.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lessonscreen.py b/lessonscreen.py index b488df7..8a9e4cc 100644 --- a/lessonscreen.py +++ b/lessonscreen.py @@ -357,8 +357,12 @@ class LessonScreen(gtk.VBox): # Pass events on to the keyboard. self.keyboard.key_press_release_cb(widget, event) - # Ignore events which don't produce a character. - if not event.string: + # Extract information about the key pressed. + key = event.string + key_name = gtk.gdk.keyval_name(event.keyval) + + # Ignore events which don't produce a character, except backspace. + if not (key_name == 'BackSpace' or key): return True # Ignore either press or release events, depending on mode. @@ -371,10 +375,6 @@ class LessonScreen(gtk.VBox): if event.state & (gtk.gdk.CONTROL_MASK | gtk.gdk.MOD1_MASK): return True - # Extract information about the key pressed. - key = event.string - key_name = gtk.gdk.keyval_name(event.keyval) - # Convert Return keys to paragraph symbols. if key_name == 'Return': key = PARAGRAPH_CODE @@ -402,7 +402,7 @@ class LessonScreen(gtk.VBox): self.start_timer() # Handle backspace by deleting text and optionally moving up lines. - if key_name == 'BackSpace': + if key_name == 'BackSpace': # Move to previous line if at the end of the current one. if self.char_idx == 0 and self.line_idx > 0: self.line_idx -= 1 |