branch : pmacs2
This commit is contained in:
moculus 2009-03-13 04:36:20 +00:00
parent 3db64c81f4
commit 7d91bc1a14
4 changed files with 49 additions and 4 deletions

View File

@ -939,10 +939,13 @@ class CloseTag(Method):
i = len(tokens[y]) - 1 i = len(tokens[y]) - 1
class CloseParen(CloseTag): class CloseParen(CloseTag):
'''Insert ), matching if applicable'''
mytag = ')' mytag = ')'
class CloseBrace(CloseTag): class CloseBrace(CloseTag):
'''Insert }, matching if applicable'''
mytag = '}' mytag = '}'
class CloseBracket(CloseTag): class CloseBracket(CloseTag):
'''Insert ], matching if applicable'''
mytag = ']' mytag = ']'
class RegisterSave(Method): class RegisterSave(Method):

View File

@ -4,9 +4,51 @@ from subprocess import Popen, PIPE, STDOUT
import buffer, buffer.about import buffer, buffer.about
import default, dirutil, regex, util, window import default, dirutil, regex, util, window
from point import Point from point import Point
from mode import Fundamental
from method import Method, Argument from method import Method, Argument
class ShowMode(Method):
'''Show helpful information for the current mode'''
def _execute(self, w, **vargs):
a = w.application
m = w.mode
f = Fundamental(w)
lines = ['%s mode' % m.modename, '']
seen = set()
triples = []
l1, l2 = 0, 0
for keys in m.bindings:
if f.bindings.get(keys) == m.bindings.get(keys):
continue
name = m.bindings[keys]
seen.add(name)
l1 = max(l1, len(name))
l2 = max(l2, len(keys))
triples.append([name, keys, a.methods[name].help])
for cls in m.actions:
name = cls._name()
if name in seen:
continue
triples.append([name, '', a.methods[name].help])
last = None
lines.append('Key Bindings:')
for triple in sorted(triples):
name, keys, _help = triple
if name == last:
name = ''
else:
last = name
lines.append(' %-*s %-*s %s' % (l1, name, l2, keys, _help))
lines.append('')
data = '\n'.join(lines)
w.application.data_buffer("*Mode-Help*", data, switch_to=True)
class ShowBindingsBuffer(Method): class ShowBindingsBuffer(Method):
'''Dump all keybindings for current mode into a new buffer''' '''Dump all keybindings for current mode into a new buffer'''
def _execute(self, w, **vargs): def _execute(self, w, **vargs):

View File

@ -256,12 +256,14 @@ class Fundamental(Handler):
self.add_bindings('insert-text', ('C-c i',)) self.add_bindings('insert-text', ('C-c i',))
self.add_bindings('insert-text2', ('C-c M-i',)) self.add_bindings('insert-text2', ('C-c M-i',))
self.add_bindings('insert-multiline-text', ('C-c m',)) self.add_bindings('insert-multiline-text', ('C-c m',))
self.add_bindings('increment', ('M-+',)) self.add_bindings('increment', ('M-+', 'M-='))
self.add_bindings('decrement', ('M--',)) self.add_bindings('decrement', ('M--',))
self.add_bindings('uppercase-word', ('M-u',)) self.add_bindings('uppercase-word', ('M-u',))
self.add_bindings('lowercase-word', ('M-l',)) self.add_bindings('lowercase-word', ('M-l',))
i = 31
# used for all word operations # used for all word operations
if not self.word_letters: if not self.word_letters:
self.word_letters = w.application.config['word_letters'] self.word_letters = w.application.config['word_letters']

View File

@ -10,8 +10,6 @@ class DataGrammar(Grammar):
class LineGrammar(Grammar): class LineGrammar(Grammar):
rules = [PatternRule(r'data', r'.+')] rules = [PatternRule(r'data', r'.+')]
#class StringGrammar1(Grammar):
# rules = [PatternRule(r'data', r'[^\']+')]
class StringGrammar3(Grammar): class StringGrammar3(Grammar):
rules = [PatternRule(r'data', r'[^)]+')] rules = [PatternRule(r'data', r'[^)]+')]