From 1f4b1d8a800a46328abd056c0ffa417c2fde735f Mon Sep 17 00:00:00 2001 From: Wade Brainerd Date: Thu, 22 Oct 2009 01:17:56 +0000 Subject: Fix Backspace in lessons. --- 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 -- cgit v0.9.1