fixed some hex/help bugs

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-05-03 19:03:26 +00:00
parent ce78a7dc44
commit 6f6736833e
2 changed files with 19 additions and 19 deletions

View File

@ -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
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'''

View File

@ -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