parent
ed1dd1a125
commit
d6d5e717d0
|
@ -14,6 +14,7 @@ import mode_blame, mode_diff
|
|||
import mode_c, mode_python, mode_perl, mode_nasm, mode_sh, mode_javascript, mode_sql
|
||||
import mode_xml, mode_tt
|
||||
import mode_life, mode_text, mode_mutt
|
||||
import mode_bds
|
||||
|
||||
def run(buffers, jump_to_line=None, init_mode=None):
|
||||
# save terminal state so we can restore it when the program exits
|
||||
|
@ -102,6 +103,7 @@ class Application(object):
|
|||
'javascript': mode_javascript.Javascript,
|
||||
'sql': mode_sql.Sql,
|
||||
'template': mode_tt.Template,
|
||||
'bds': mode_bds.BDS
|
||||
}
|
||||
|
||||
# these are used in this order to determine which mode to open certain
|
||||
|
@ -113,6 +115,7 @@ class Application(object):
|
|||
'.bashrc': 'sh',
|
||||
'.bash_profile': 'sh',
|
||||
'.profile': 'sh',
|
||||
'components.xml': 'bds',
|
||||
}
|
||||
self.mode_extensions = {
|
||||
'.py': 'python',
|
||||
|
@ -498,10 +501,10 @@ class Application(object):
|
|||
while count < slot.height:
|
||||
if p1.y == y and px >= x and px < x + slot.width:
|
||||
if px + slot.width > p2.x:
|
||||
self.highlight_chars(slot.offset + count, px, p2.x)
|
||||
self.highlight_chars(slot.offset + count, px - x, p2.x -x)
|
||||
break
|
||||
else:
|
||||
self.highlight_chars(slot.offset + count, px, px + slot.width)
|
||||
self.highlight_chars(slot.offset + count, px - x, px + slot.width -x-1)
|
||||
px += slot.width
|
||||
if x + slot.width >= len(w.buffer.lines[y]):
|
||||
x = 0
|
||||
|
@ -593,14 +596,13 @@ class Application(object):
|
|||
|
||||
s_offset = max(x - token.x, 0)
|
||||
x_offset = max(token.x - x, 0)
|
||||
#assert x_offset < slot.width, '%d < %d' % (x_offset, slot.width)
|
||||
assert x_offset <= slot.width, '%d <= %d' % (x_offset, slot.width)
|
||||
|
||||
c = self._get_token_color(w, token)
|
||||
s = token.string[s_offset:]
|
||||
token_done = x_offset + len(s) <= slot.width
|
||||
token_wrap = x_offset + len(s) > slot.width
|
||||
self.win.addstr(slot.offset + count, x_offset, s[:slot.width], c)
|
||||
self.win.addstr(slot.offset + count, x_offset, s[:slot.width - x_offset], c)
|
||||
|
||||
if token_wrap:
|
||||
self.win.addch(slot.offset + count, slot.width, '\\', redattr)
|
||||
|
@ -608,6 +610,8 @@ class Application(object):
|
|||
count += 1
|
||||
if token_done:
|
||||
j += 1
|
||||
if count >= slot.height:
|
||||
break
|
||||
|
||||
# we have finished this logical line of tokens
|
||||
j = 0
|
||||
|
|
|
@ -14,6 +14,7 @@ class PodGrammar(Grammar):
|
|||
|
||||
class StringGrammar(Grammar):
|
||||
rules = [
|
||||
PatternRule(name=r'octal', pattern=r'\\[0-7]{3}'),
|
||||
PatternRule(name=r'escaped', pattern=r'\\.'),
|
||||
PatternRule(name=r'deref', pattern=r"\$+[A-Za-z0-9_](?:[A-Za-z0-9_]|::)*(?:->{\$?(?:[a-zA-Z_][a-zA-Z_0-9]*|'(?:\\.|[^'\\])*'|\"(\\.|[^\\\"])*\")}|->\[\$?[0-9a-zA-Z_]+\])+"),
|
||||
PatternRule(name=r'length', pattern=r"\$#[A-Za-z0-9_](?:[A-Za-z0-9_]|::)*"),
|
||||
|
|
|
@ -20,9 +20,9 @@ class XML(mode2.Fundamental):
|
|||
grammar = XMLGrammar
|
||||
def __init__(self, w):
|
||||
mode2.Fundamental.__init__(self, w)
|
||||
self.add_bindings('close-paren', (')',))
|
||||
self.add_bindings('close-brace', ('}',))
|
||||
self.add_bindings('close-bracket', (']',))
|
||||
#self.add_bindings('close-paren', (')',))
|
||||
#self.add_bindings('close-brace', ('}',))
|
||||
#self.add_bindings('close-bracket', (']',))
|
||||
self.colors = {
|
||||
'comment': color.build('red', 'default'),
|
||||
'opentag.start': color.build('default', 'default'),
|
||||
|
|
Loading…
Reference in New Issue