aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-09-10 09:46:10 +0200
committerMattias Andrée <maandree@operamail.com>2013-09-10 09:46:10 +0200
commit069dfafa9026a2da8c47c9eacddcc00407e08f88 (patch)
tree1310b41c50aff7e7cad86d2ae5fcf2d3b0179fb9
parentremove debug exception (diff)
downloadpytagomacs-069dfafa9026a2da8c47c9eacddcc00407e08f88.tar.gz
pytagomacs-069dfafa9026a2da8c47c9eacddcc00407e08f88.tar.bz2
pytagomacs-069dfafa9026a2da8c47c9eacddcc00407e08f88.tar.xz
default field entry to empty string
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--src/editor.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/editor.py b/src/editor.py
index 7e02b27..a64a63f 100644
--- a/src/editor.py
+++ b/src/editor.py
@@ -140,7 +140,8 @@ class TextArea():
self.fields, self.datamap, self.left, self.top, self.width, self.height = fields, datamap, left, top, width - 1, height
self.innerleft = len(max(self.fields, key = len)) + 3
self.killring = Killring()
- self.lines = [TextArea.Line(self, self.fields[y], self.datamap[self.fields[y]], y) for y in range(len(self.fields))]
+ data = lambda field : datamap[field] if field in datamap else ''
+ self.lines = [TextArea.Line(self, self.fields[y], data(self.fields[y]), y) for y in range(len(self.fields))]
self.areawidth = self.width - self.innerleft - self.left + 1
self.y, self.x, self.offx, self.mark = 0, 0, 0, None
self.last_alert, self.last_status, self.alerted = None, None, False
@@ -624,7 +625,7 @@ old_stty = Popen('stty --save'.split(' '), stdout = PIPE).communicate()[0]
old_stty = old_stty.decode('utf-8', 'error')[:-1]
Popen('stty -icanon -echo -isig -ixon -ixoff'.split(' '), stdout = PIPE).communicate()
try:
- TextArea(['alpha', 'beta'], {'alpha' : 'a', 'beta' : 'be'}, 1, 1, 20, 4).run(phonysaver, phonypreredraw, phonypostredraw)
+ TextArea(['alpha', 'beta'], {}, 1, 1, 20, 4).run(phonysaver, phonypreredraw, phonypostredraw)
finally:
print('\033[H\033[2J', end = '')
sys.stdout.flush()