parent
dc549b9579
commit
520e6e1e52
|
@ -9,7 +9,7 @@ from point2 import Point
|
||||||
# modes
|
# modes
|
||||||
# TODO: mode_c mode_nasm mode_console mode_sh mode_sql mode_javascript mode_diff mode_tt
|
# TODO: mode_c mode_nasm mode_console mode_sh mode_sql mode_javascript mode_diff mode_tt
|
||||||
import mode2
|
import mode2
|
||||||
import mode_mini, mode_search, mode_replace, mode_blame, mode_which
|
import mode_mini, mode_search, mode_replace, mode_blame, mode_which, mode_diff
|
||||||
import mode_python, mode_perl, mode_xml
|
import mode_python, mode_perl, mode_xml
|
||||||
import mode_life, mode_text, mode_mutt
|
import mode_life, mode_text, mode_mutt
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ class Application(object):
|
||||||
'blame': mode_blame.Blame,
|
'blame': mode_blame.Blame,
|
||||||
# 'c': mode_c.C,
|
# 'c': mode_c.C,
|
||||||
# 'console': mode_console.Console,
|
# 'console': mode_console.Console,
|
||||||
# 'diff': mode_diff.Diff,
|
'diff': mode_diff.Diff,
|
||||||
'fundamental': mode2.Fundamental,
|
'fundamental': mode2.Fundamental,
|
||||||
'mini': mode_mini.Mini,
|
'mini': mode_mini.Mini,
|
||||||
# 'nasm': mode_nasm.Nasm,
|
# 'nasm': mode_nasm.Nasm,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import md5, os, sets, shutil
|
import md5, os, sets, shutil
|
||||||
import aes, point, method, regex
|
import aes, point, method, regexjgejgew
|
||||||
|
|
||||||
# set this to 0 or less to have infinite undo/redo
|
# set this to 0 or less to have infinite undo/redo
|
||||||
REDO_STACK_LIMIT = 1024
|
REDO_STACK_LIMIT = 1024
|
||||||
|
|
36
mode_diff.py
36
mode_diff.py
|
@ -1,24 +1,34 @@
|
||||||
import color, method, mode, lex, lex_diff, re
|
import color, method, mode2, re
|
||||||
|
from lex2 import Grammar, PatternRule, RegionRule
|
||||||
|
|
||||||
class Diff(mode.Fundamental):
|
class MetadataGrammar(Grammar):
|
||||||
|
rules = [
|
||||||
|
PatternRule(name=r'line', pattern=r'^.*$'),
|
||||||
|
]
|
||||||
|
|
||||||
|
class DiffGrammar(Grammar):
|
||||||
|
rules = [
|
||||||
|
PatternRule(name=r'left', pattern=r"^\-.*$"),
|
||||||
|
PatternRule(name=r'right', pattern=r"^\+.*$"),
|
||||||
|
PatternRule(name=r'metadata', pattern=r'^[A-Za-z].*$'),
|
||||||
|
PatternRule(name=r'seperator', pattern=r'^={67}$'),
|
||||||
|
PatternRule(name=r'location', pattern=r"(?:^|(?<=\n))@@ [-+0-9a-z, ]* @@(?:$|\n)"),
|
||||||
|
PatternRule(name=r'common', pattern=r"(?:^|(?<=\n)).*(?:$|\n)"),
|
||||||
|
]
|
||||||
|
|
||||||
|
class Diff(mode2.Fundamental):
|
||||||
|
grammar = DiffGrammar()
|
||||||
def __init__(self, w):
|
def __init__(self, w):
|
||||||
mode.Fundamental.__init__(self, w)
|
mode2.Fundamental.__init__(self, w)
|
||||||
|
#self.add_action_and_bindings(DiffNextSection(), ('M-n', 'M-D_ARROW',))
|
||||||
self.grammar = lex_diff.DiffGrammar()
|
#self.add_action_and_bindings(DiffPreviousSection(), ('M-p', 'M-U_ARROW',))
|
||||||
self.lexer = lex.Lexer(self.grammar)
|
|
||||||
|
|
||||||
self.add_action_and_bindings(DiffNextSection(), ('M-n', 'M-D_ARROW',))
|
|
||||||
self.add_action_and_bindings(DiffPreviousSection(), ('M-p', 'M-U_ARROW',))
|
|
||||||
|
|
||||||
self.colors = {
|
self.colors = {
|
||||||
'left': color.build('red', 'default', 'bold'),
|
'left': color.build('red', 'default', 'bold'),
|
||||||
'right': color.build('blue', 'default', 'bold'),
|
'right': color.build('blue', 'default', 'bold'),
|
||||||
'seperator': color.build('magenta', 'default', 'bold'),
|
'seperator': color.build('magenta', 'default', 'bold'),
|
||||||
'cvs metadata': color.build('magenta', 'default', 'bold'),
|
'metadata': color.build('magenta', 'default', 'bold'),
|
||||||
'svn metadata': color.build('magenta', 'default', 'bold'),
|
|
||||||
'location': color.build('magenta', 'default', 'bold'),
|
'location': color.build('magenta', 'default', 'bold'),
|
||||||
}
|
}
|
||||||
|
|
||||||
def name(self):
|
def name(self):
|
||||||
return "Diff"
|
return "Diff"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue