diff --git a/application.py b/application.py index c378ca7..327c356 100755 --- a/application.py +++ b/application.py @@ -2,7 +2,7 @@ import curses, curses.ascii, getpass, os, re, string, sys, termios, time import traceback from subprocess import Popen, PIPE, STDOUT -from collections import defaultdict +#from collections import defaultdict import buffer, bufferlist, color, completer, keyinput, method, minibuffer, mode import util, window @@ -43,7 +43,8 @@ class Application(object): # initialize some basic stuff # a highlighted_range contains three things: (window, start_p, end_p) - self.state = defaultdict(lambda: {}) + #self.state = defaultdict(lambda: {}) + self.state = {} self.config = {} self.highlighted_ranges = [] self.mini_active = False diff --git a/context.py b/context.py index f5f5516..8580079 100644 --- a/context.py +++ b/context.py @@ -6,11 +6,13 @@ class Context(object): self.namelines = None def region_added(self, p, newlines): - self.adjust_name_map(p, len(newlines) - 1) - self.rebuild_name_map(p.y, p.y + len(newlines)) + if self.names: + self.adjust_name_map(p, len(newlines) - 1) + self.rebuild_name_map(p.y, p.y + len(newlines)) def region_removed(self, p1, p2): - self.adjust_name_map(p2, p1.y - p2.y) - self.rebuild_name_map(p1.y, p1.y + 1) + if self.names: + self.adjust_name_map(p2, p1.y - p2.y) + self.rebuild_name_map(p1.y, p1.y + 1) def adjust_name_map(self, p, delta): if delta == 0: diff --git a/mode/perl.py b/mode/perl.py index 27c5586..1b1dbdd 100644 --- a/mode/perl.py +++ b/mode/perl.py @@ -541,7 +541,7 @@ class PerlContext(context.Context): if t.name in m.opentokens and t.string in m.opentags: stack.append(t.string) elif t.name in m.closetokens and t.string in m.closetags: - if stack[-1] == m.closetags[t.string]: + if stack and stack[-1] == m.closetags[t.string]: stack.pop(-1) if t.string == '}' and not stack: curr = None @@ -703,6 +703,7 @@ class Perl(mode.Fundamental): def get_inc(self): a = self.window.application + a.state.setdefault('perl', {}) if 'inc' not in a.state['perl']: perllib = a.config.get('perl.lib') if perllib: