sql mode gets comments... also annoying drawing fix

--HG--
branch : pmacs2
This commit is contained in:
moculus 2009-02-14 03:14:38 +00:00
parent be3990d7d7
commit 19e6f2daef
4 changed files with 21 additions and 5 deletions

View File

@ -834,15 +834,25 @@ class Application(object):
lines = w.buffer.lines lines = w.buffer.lines
count = w.mode.header count = w.mode.header
swidth = slot.width - lm - rm swidth = slot.width - lm - rm
k = (x + swidth - 1) // swidth
modename = w.mode.name() modename = w.mode.name()
lit = w.mode.name() in w.buffer.highlights lit = w.mode.name() in w.buffer.highlights
ended = False ended = False
# figure out which "physical line" is the first to be shown. note that
# the cursor shouldn't be in the last column unless it's the end of a
# line.
k = x // swidth
if x < lines[y] and x == swidth:
k += 1
while count < slot.height: while count < slot.height:
if lit: if lit:
rlines = w.render_line_lit(y, swidth) rlines = w.render_line_lit(y, swidth)
else: else:
rlines = w.render_line_raw(y, swidth) rlines = w.render_line_raw(y, swidth)
if w.first.y > 0:
msg = '(%r + %r - 1) // %r == %r, %r' % (x, swidth, swidth, k, rlines[k:])
#raise Exception(msg)
for j in range(k, len(rlines)): for j in range(k, len(rlines)):
if lm: if lm:
lcont = j > 0 lcont = j > 0

View File

@ -419,6 +419,7 @@ class Fundamental(Handler):
'perc': self._get_perc(), 'perc': self._get_perc(),
'indent': self._get_indent(), 'indent': self._get_indent(),
'cursor': '(%d,%d)' % (c.y + 1, c.x + 1), 'cursor': '(%d,%d)' % (c.y + 1, c.x + 1),
'first': '(%d,%d)' % (w.first.y + 1, w.first.x + 1),
'mark': self._get_mark(), 'mark': self._get_mark(),
} }
return d return d

View File

@ -603,7 +603,7 @@ class Python(mode.Fundamental):
'python.lib': '.', 'python.lib': '.',
} }
lconfig = { lconfig = {
'ignore-suffix': ['.pyc'], 'ignore-suffix': ['.pyc', '.pyo'],
} }
actions = [PythonCommentRegion, PythonUncommentRegion, actions = [PythonCommentRegion, PythonUncommentRegion,
PythonInitNames, PythonListNames, PythonGotoName, PythonInitNames, PythonListNames, PythonGotoName,
@ -616,15 +616,14 @@ class Python(mode.Fundamental):
"pythonclass": PythonClassCompleter(None), "pythonclass": PythonClassCompleter(None),
} }
#format = "%(flag)s %(bname)-18s (%(mname)s) %(indent)s %(cursor)s/%(mark)s %(perc)s [%(name)s]" format = "%(flag)s %(bname)-18s (%(mname)s) %(indent)s %(cursor)s/%(mark)s %(perc)s [%(name)s]"
format = "%(flag)s %(bname)-18s (%(mname)s) %(indent)s %(cursor)s/%(first)s %(perc)s [%(name)s]"
header_size = 3 header_size = 3
def get_status_names(self): def get_status_names(self):
names = mode.Fundamental.get_status_names(self) names = mode.Fundamental.get_status_names(self)
c = self.window.logical_cursor() c = self.window.logical_cursor()
names['name'] = self.context.get_line_name(c.y) names['name'] = self.context.get_line_name(c.y)
names['first'] = self.window.first.xy() #names['first'] = self.window.first.xy()
return names return names
# xyz # xyz

View File

@ -1,6 +1,7 @@
import mode, tab import mode, tab
from lex import Grammar, PatternRule, NocasePatternRule, RegionRule, NocaseRegionRule from lex import Grammar, PatternRule, NocasePatternRule, RegionRule, NocaseRegionRule
from mode.python import StringGrammar1, StringGrammar2 from mode.python import StringGrammar1, StringGrammar2
from method import CommentRegion, UncommentRegion
class PlPgSqlGrammar(Grammar): class PlPgSqlGrammar(Grammar):
rules = [ rules = [
@ -69,6 +70,11 @@ class SqlGrammar(Grammar):
PatternRule(r'eol', r'\n'), PatternRule(r'eol', r'\n'),
] ]
class SqlCommentRegion(CommentRegion):
commentc = '--'
class SqlUncommentRegion(UncommentRegion):
commentc = '--'
class SqlTabber(tab.StackTabber): class SqlTabber(tab.StackTabber):
wst = ('null', 'eol',) wst = ('null', 'eol',)
def is_base(self, y): def is_base(self, y):