From 6f6736833e7b97c122ee3df86662d9bc2d0533b9 Mon Sep 17 00:00:00 2001 From: moculus Date: Sat, 3 May 2008 19:03:26 +0000 Subject: [PATCH] fixed some hex/help bugs --HG-- branch : pmacs2 --- method/help.py | 17 ++++++++--------- mode/hex.py | 21 +++++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/method/help.py b/method/help.py index 72d1a6b..5d28a85 100644 --- a/method/help.py +++ b/method/help.py @@ -21,8 +21,10 @@ class ShowBindingsBuffer(Method): name_len = len('ACTION') for seq in w.mode.bindings: name = w.mode.bindings[seq] - if name.startswith('insert-string-'): - # we aren't going to show all the generic keypress actions + # we aren't going to show all the generic keypress actions + if 'insert-string-' in name: + continue + elif 'overwrite-char-' in name: continue # determine this for formatting seq_len = max(seq_len, len(seq)) @@ -62,9 +64,9 @@ class ShowFunctionsBuffer(Method): pairs = [] for name in app.methods: # we aren't going to show all the generic keypress actions - if name.startswith('insert-string-'): + if 'insert-string-' in name: continue - elif name.startswith('overwrite-char-'): + elif 'overwrite-char-' in name: continue # determine this for formatting name_len = max(name_len, len(name)) @@ -137,11 +139,8 @@ class WhichCommand(Method): '''Display which command is run for a given key-sequence''' def _execute(self, w, **vargs): self.old_window = w - w.application.open_mini_buffer('Enter a key sequence to be explained: ', - lambda x: None, - self, - None, - 'which') + s = 'Enter a key sequence to be explained: ' + w.application.open_mini_buffer(s, lambda x: None, self, None, 'which') class AboutPmacs(Method): '''print some information about pmacs''' diff --git a/mode/hex.py b/mode/hex.py index e07ed0f..df774ef 100644 --- a/mode/hex.py +++ b/mode/hex.py @@ -118,23 +118,23 @@ class HexOverwriteChar(Method): end = w.buffer.get_buffer_end() while w.cursor_char().isspace() and w.cursor < end: w.forward() -class HexOverwriteSpace(HexOverwriteChar): +class HexOverwriteCharSpace(HexOverwriteChar): def __init__(self): - self.name = 'hex-overwrite-space' + self.name = 'hex-overwrite-char-space' self.args = [] self.help = "Overwrite SPACE into the current hex buffer." self.char = ' ' self.part1, self.part2 = '%02x' % ord(self.char) -class HexOverwriteTab(HexOverwriteChar): +class HexOverwriteCharTab(HexOverwriteChar): def __init__(self): - self.name = 'hex-overwrite-tab' + self.name = 'hex-overwrite-char-tab' self.args = [] self.help = "Overwrite TAB into the current hex buffer." self.char = '\t' self.part1, self.part2 = '%02x' % ord(self.char) -class HexOverwriteNewline(HexOverwriteChar): +class HexOverwriteCharNewline(HexOverwriteChar): def __init__(self): - self.name = 'hex-overwrite-newline' + self.name = 'hex-overwrite-char-newline' self.args = [] self.help = "Overwrite NEWLINE into the current hex buffer." self.char = '\n' @@ -214,7 +214,8 @@ class Hex(mode.Fundamental): actions = [HexForward, HexBackward, HexForwardWord, HexBackwardWord, HexStartOfLine, HexEndOfLine, ShowAddress, ShowX86Instruction, GotoAddress, HexSetByteOrder, HexToggleSymbolic, - HexOverwriteSpace, HexOverwriteTab, HexOverwriteNewline] + HexOverwriteCharSpace, HexOverwriteCharTab, + HexOverwriteCharNewline] def __init__(self, w): mode.Fundamental.__init__(self, w) self.bindings = {} @@ -302,9 +303,9 @@ class Hex(mode.Fundamental): # create all the insert actions for the basic text input for c in string.letters + string.digits + string.punctuation: self.add_action_and_bindings(HexOverwriteChar(c), (c,)) - self.add_bindings('hex-overwrite-space', ('SPACE',)) - self.add_bindings('hex-overwrite-tab', ('TAB',)) - self.add_bindings('hex-overwrite-newline', ('RETURN',)) + self.add_bindings('hex-overwrite-char-space', ('SPACE',)) + self.add_bindings('hex-overwrite-char-tab', ('TAB',)) + self.add_bindings('hex-overwrite-char-newline', ('RETURN',)) self.symbolic_edit = False