diff --git a/BUGS b/BUGS index 1a67d01..86501d7 100644 --- a/BUGS +++ b/BUGS @@ -1,7 +1,7 @@ === OUSTANDING BUGS === 2008/06/25: - * when the "first" point is on a wrapping line bad things happen. + * occasionally when the "first" point is wrapped things get confused. * the "last visible" calculation doesn't handle long lines correctly. this affects page-up/page-down/etc. diff --git a/mode/perl.py b/mode/perl.py index 08957cd..e47243b 100644 --- a/mode/perl.py +++ b/mode/perl.py @@ -179,7 +179,7 @@ class PerlTabber2(StackTabber2): close_tokens = {'delimiter': {'}': '{', ')': '(', ']': '['}} end_at_eof = False end_at_tokens = {'delimiter': {';': 1}} - nocontinue_tokens = {'delimiter': {';': 1, ',': 1}, + nocontinue_tokens = {'delimiter': {';': 1, ',': 1, '}': 1}, 'heredoc.end': 1, 'evaldoc.end': 1, 'pod.end': 1} start_free_tokens = {'string.start': 1, 'pod.start': 1, 'heredoc.start': 1, 'evaldoc.start': 1} diff --git a/tab.py b/tab.py index 1a6a123..05c9878 100644 --- a/tab.py +++ b/tab.py @@ -374,6 +374,18 @@ class StackTabber2(Tabber): if i == 0: self._save_curr_level() + # add implicit continuation XYZYXYZY + name, s = t.fqname(), t.string + top = self._peek() + if (i + start == end and + (not top or top.name in self.scope_tokens.get(top.type_, {}))): + d = self.nocontinue_tokens.get(name) + if d is None or d != 1 and s not in d: + if s == '}': + raise Exception, "foog: %r %r %r" % (s not in d, s, d) + self._append_unless('continue', name, self._get_next_level()) + #XYZYZYXYXY + def _is_open_token(self, t): return (t.name == 'delimiter' and t.string in self.open_tokens['delimiter']) @@ -407,10 +419,6 @@ class StackTabber2(Tabber): self._pop('macro') return - #d = self.end_at_tokens.get(name, {}) - #if d: - # raise Exception, (name, s, d, d.get(s), d[s]) - # remove implicit continuation if self.end_at_eof and i + start == end: self._pop_while('continue', 'control') @@ -419,7 +427,7 @@ class StackTabber2(Tabber): # add implicit continuation top = self._peek() - if i + start == end and top and top.name in self.scope_tokens.get(top.type_, {}): + if i + start == end and (top and top.name in self.scope_tokens.get(top.type_, {}) or not top): if self.continue_tokens: if s in self.continue_tokens.get(name, {}): self._append_unless('continue', name, self._get_next_level())