parent
6eb083ff35
commit
90a955e2bf
|
@ -842,16 +842,19 @@ class Application(object):
|
||||||
# the cursor shouldn't be in the last column unless it's the end of a
|
# the cursor shouldn't be in the last column unless it's the end of a
|
||||||
# line.
|
# line.
|
||||||
k = x // swidth
|
k = x // swidth
|
||||||
if x < lines[y] and x == swidth:
|
#if x < len(lines[y]) and x == swidth - 1:
|
||||||
k += 1
|
# 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:
|
if w.first.y == 65:
|
||||||
msg = '(%r + %r - 1) // %r == %r, %r' % (x, swidth, swidth, k, rlines[k:])
|
rlines2 = [[z.string for z in l] for l in rlines]
|
||||||
|
msg = '%r // %r == %r [%r] (%r)' % (x, swidth, k,
|
||||||
|
len(lines[y]),
|
||||||
|
rlines2)
|
||||||
#raise Exception(msg)
|
#raise Exception(msg)
|
||||||
for j in range(k, len(rlines)):
|
for j in range(k, len(rlines)):
|
||||||
if lm:
|
if lm:
|
||||||
|
|
|
@ -405,6 +405,7 @@ class Fundamental(Handler):
|
||||||
return '%d%s' % (b.indentlvl, t)
|
return '%d%s' % (b.indentlvl, t)
|
||||||
def _get_mark(self):
|
def _get_mark(self):
|
||||||
w = self.window
|
w = self.window
|
||||||
|
return '(%d,%d)' % (w.first.y + 1, w.first.x + 1),
|
||||||
if w.mark:
|
if w.mark:
|
||||||
return '(%d,%d)' % (w.mark.y + 1, w.mark.x + 1)
|
return '(%d,%d)' % (w.mark.y + 1, w.mark.x + 1)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -46,6 +46,12 @@ class FunctionGrammar(Grammar):
|
||||||
PatternRule(r'eol', r'\n'),
|
PatternRule(r'eol', r'\n'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
class BitStringGrammar(Grammar):
|
||||||
|
rules = [PatternRule(r'data', r'[01]+')]
|
||||||
|
|
||||||
|
class HexStringGrammar(Grammar):
|
||||||
|
rules = [NocasePatternRule(r'data', r'[0-9a-f]+')]
|
||||||
|
|
||||||
class SqlGrammar(Grammar):
|
class SqlGrammar(Grammar):
|
||||||
rules = [
|
rules = [
|
||||||
PatternRule(r'spaces', r' +'),
|
PatternRule(r'spaces', r' +'),
|
||||||
|
@ -63,6 +69,8 @@ class SqlGrammar(Grammar):
|
||||||
NocasePatternRule(r'pseudokeyword', r'(?:returns|language|right join|left join|inner join|outer join|join|where|unknown|null|true|false|into|values|as|from|order by|asc|desc|limit|distinct|cascade|using|on)(?![A-Za-z0-9_])'),
|
NocasePatternRule(r'pseudokeyword', r'(?:returns|language|right join|left join|inner join|outer join|join|where|unknown|null|true|false|into|values|as|from|order by|asc|desc|limit|distinct|cascade|using|on)(?![A-Za-z0-9_])'),
|
||||||
NocasePatternRule(r'sql_type', r'(?:void|row|serial|varchar|float|integer|int|text|timestamptz|timestamp|datetz|date|timetz|time|boolean|bool)(?![A-Za-z0-9_])'),
|
NocasePatternRule(r'sql_type', r'(?:void|row|serial|varchar|float|integer|int|text|timestamptz|timestamp|datetz|date|timetz|time|boolean|bool)(?![A-Za-z0-9_])'),
|
||||||
PatternRule(r'sql_builtin', r'(?:nextval|current_timestamp|current_time|current_date)(?![A-Za-z0-9_])'),
|
PatternRule(r'sql_builtin', r'(?:nextval|current_timestamp|current_time|current_date)(?![A-Za-z0-9_])'),
|
||||||
|
RegionRule(r'string', "B'", BitStringGrammar, "'"),
|
||||||
|
RegionRule(r'string', "X'", HexStringGrammar, "'"),
|
||||||
RegionRule(r'string', "'", StringGrammar1, "'"),
|
RegionRule(r'string', "'", StringGrammar1, "'"),
|
||||||
RegionRule(r'sql_quoted', '"', StringGrammar2, '"'),
|
RegionRule(r'sql_quoted', '"', StringGrammar2, '"'),
|
||||||
PatternRule(r'sql_bareword', r'[A-Za-z0-9_]+'),
|
PatternRule(r'sql_bareword', r'[A-Za-z0-9_]+'),
|
||||||
|
|
|
@ -239,7 +239,7 @@ class Window(object):
|
||||||
# (x2, y2) = self.last_visible_coords()
|
# (x2, y2) = self.last_visible_coords()
|
||||||
# if y2 < y or x2 < x:
|
# if y2 < y or x2 < x:
|
||||||
# x, y = x2, y2
|
# x, y = x2, y2
|
||||||
self.first = Point(x - (x % self.width), y)
|
self.first = Point(x, y)
|
||||||
self.redraw()
|
self.redraw()
|
||||||
def lower_view(self):
|
def lower_view(self):
|
||||||
(x, y) = self.logical_cursor().xy()
|
(x, y) = self.logical_cursor().xy()
|
||||||
|
@ -478,6 +478,7 @@ class Window(object):
|
||||||
else:
|
else:
|
||||||
x -= 1
|
x -= 1
|
||||||
counter = 0
|
counter = 0
|
||||||
|
# 3 means last line we see + one blank line of context
|
||||||
while counter < self.height - 3:
|
while counter < self.height - 3:
|
||||||
if x > self.width:
|
if x > self.width:
|
||||||
x -= self.width
|
x -= self.width
|
||||||
|
|
Loading…
Reference in New Issue