fixed super annoying long-line bug
--HG-- branch : pmacs2
This commit is contained in:
parent
bfa188627e
commit
482ef39720
2
BUGS
2
BUGS
|
@ -13,6 +13,7 @@
|
|||
|
||||
2008/06/25:
|
||||
* occasionally when the "first" point is wrapped things get confused.
|
||||
(fixed 2009/02/03)
|
||||
* the "last visible" calculation doesn't handle long lines correctly.
|
||||
this affects page-up/page-down/etc.
|
||||
|
||||
|
@ -29,6 +30,7 @@
|
|||
|
||||
2008/05/03:
|
||||
first-visible/cursor syncing with drawn window may be buggy.
|
||||
(fixed 2009/02/03)
|
||||
|
||||
2007/09/14:
|
||||
known deficiencies:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
import curses, curses.ascii, getpass, os, re, string, sys, termios, time
|
||||
import math
|
||||
import traceback
|
||||
from subprocess import Popen, PIPE, STDOUT
|
||||
|
||||
|
@ -715,6 +716,9 @@ class Application(object):
|
|||
while count < slot.height:
|
||||
if p.y == y and p.x >= x and p.x <= x + swidth:
|
||||
vy, vx = slot.y_offset + count, p.x - x + w.mode.lmargin
|
||||
if vx == swidth and p.x < len(w.buffer.lines[y]):
|
||||
vx = 0
|
||||
vy += 1
|
||||
break
|
||||
|
||||
if y >= blen or x + swidth >= len(w.buffer.lines[y]):
|
||||
|
@ -828,15 +832,16 @@ class Application(object):
|
|||
lm, rm = w.mode.lmargin, w.mode.rmargin
|
||||
lines = w.buffer.lines
|
||||
count = w.mode.header
|
||||
k = x // (slot.width - lm - rm)
|
||||
swidth = slot.width - lm - rm
|
||||
k = (x + swidth - 1) // swidth
|
||||
modename = w.mode.name()
|
||||
lit = w.mode.name() in w.buffer.highlights
|
||||
ended = False
|
||||
while count < slot.height:
|
||||
if lit:
|
||||
rlines = w.render_line_lit(y, slot.width - lm - rm)
|
||||
rlines = w.render_line_lit(y, swidth)
|
||||
else:
|
||||
rlines = w.render_line_raw(y, slot.width - lm - rm)
|
||||
rlines = w.render_line_raw(y, swidth)
|
||||
for j in range(k, len(rlines)):
|
||||
if lm:
|
||||
lcont = j > 0
|
||||
|
|
42
mode/java.py
42
mode/java.py
|
@ -37,6 +37,25 @@ class JavaGrammar(Grammar):
|
|||
PatternRule(r"eol", r"\n$"),
|
||||
]
|
||||
|
||||
|
||||
CLASS_MATCH = And(Optional(Name('spaces')),
|
||||
Matchs('keyword', ('public', 'protected', 'private')),
|
||||
Name('spaces'),
|
||||
Match('keyword', 'class'),
|
||||
Name('spaces'),
|
||||
Name('identifier'))
|
||||
CLASS_OFFSET = 1
|
||||
METHOD_MATCH = And(Optional(Name('spaces')),
|
||||
Matchs('keyword', ('public', 'protected', 'private')),
|
||||
Name('spaces'),
|
||||
Optional(And(Match('keyword', 'static'), Name('spaces'))),
|
||||
Any(),
|
||||
Name('spaces'),
|
||||
Name('identifier'),
|
||||
Optional(Name('spaces')),
|
||||
Match('delimiter', '('))
|
||||
METHOD_OFFSET = 2
|
||||
|
||||
class JavaTabber2(tab.StackTabber2):
|
||||
open_tokens = {'delimiter': {'{': '}', '(': ')', '[': ']'}}
|
||||
close_tokens = {'delimiter': {'}': '{', ')': '(', ']': '['}}
|
||||
|
@ -61,23 +80,10 @@ class JavaTabber2(tab.StackTabber2):
|
|||
'comment.data', 'comment.null', 'comment.end')
|
||||
|
||||
class JavaContext(context.Context):
|
||||
class_match = And(Optional(Name('spaces')),
|
||||
Matchs('keyword', ('public', 'protected', 'private')),
|
||||
Name('spaces'),
|
||||
Match('keyword', 'class'),
|
||||
Name('spaces'),
|
||||
Name('identifier'))
|
||||
class_offset = 1
|
||||
method_match = And(Optional(Name('spaces')),
|
||||
Matchs('keyword', ('public', 'protected', 'private')),
|
||||
Name('spaces'),
|
||||
Optional(And(Match('keyword', 'static'), Name('spaces'))),
|
||||
Any(),
|
||||
Name('spaces'),
|
||||
Name('identifier'),
|
||||
Optional(Name('spaces')),
|
||||
Match('delimiter', '('))
|
||||
method_offset = 2
|
||||
class_match = CLASS_MATCH
|
||||
class_offset = CLASS_OFFSET
|
||||
method_match = METHOD_MATCH
|
||||
method_offset = METHOD_OFFSET
|
||||
def _regen_stack(self, y):
|
||||
if y > 0 and self.namelines[y - 1][1]:
|
||||
return list(self.namelines[y - 1][1])
|
||||
|
@ -149,10 +155,12 @@ class Java(mode.Fundamental):
|
|||
}
|
||||
|
||||
format = "%(flag)s %(bname)-18s (%(mname)s) %(indent)s %(cursor)s/%(mark)s %(perc)s [%(func)s]"
|
||||
#format = "%(flag)s %(bname)-18s (%(mname)s) %(indent)s %(cursor)s/%(first)s %(perc)s [%(func)s]"
|
||||
def get_status_names(self):
|
||||
names = mode.Fundamental.get_status_names(self)
|
||||
c = self.window.logical_cursor()
|
||||
names['func'] = self.get_line_function(c.y)
|
||||
#names['first'] = self.window.first.xy()
|
||||
return names
|
||||
|
||||
def __init__(self, w):
|
||||
|
|
|
@ -545,12 +545,14 @@ class Python(mode.Fundamental):
|
|||
"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]"
|
||||
|
||||
def get_status_names(self):
|
||||
names = mode.Fundamental.get_status_names(self)
|
||||
c = self.window.logical_cursor()
|
||||
names['name'] = self.context.get_line_name(c.y)
|
||||
names['first'] = self.window.first.xy()
|
||||
return names
|
||||
|
||||
def __init__(self, w):
|
||||
|
|
Loading…
Reference in New Issue