parent
c4027d9000
commit
bfe5ff5c0b
|
@ -758,17 +758,20 @@ class Application(object):
|
|||
l = self.x - 1
|
||||
s1 = self.error_string
|
||||
s2 = util.cleanse(util.padtrunc(s1, l))
|
||||
self.win.addnstr(self.y-1, 0, s2, l)
|
||||
#self.win.addnstr(self.y-1, 0, s2, l)
|
||||
self.win.addstr(self.y-1, 0, s2)
|
||||
def draw_mini_buffer(self):
|
||||
l = self.x - 1
|
||||
b = self.mini_buffer
|
||||
s1 = self.mini_prompt + b.lines[0]
|
||||
s2 = util.padtrunc(s1, l)
|
||||
self.win.addnstr(self.y-1, 0, s2, l)
|
||||
#self.win.addnstr(self.y-1, 0, s2, l)
|
||||
self.win.addstr(self.y-1, 0, s2)
|
||||
|
||||
def draw_nothing(self):
|
||||
l = self.x - 1
|
||||
self.win.addnstr(self.y-1, 0, util.pad('', l), l)
|
||||
#self.win.addnstr(self.y-1, 0, util.pad('', l), l)
|
||||
self.win.addstr(self.y-1, 0, util.pad('', l))
|
||||
|
||||
def open_aes_file(path, nl, name=None):
|
||||
if os.path.isfile(path) or not os.path.exists(path):
|
||||
|
|
20
util.py
20
util.py
|
@ -26,25 +26,9 @@ def cleanse(s):
|
|||
return s2
|
||||
|
||||
def padtrunc(s, i, c=' '):
|
||||
assert i >= 0
|
||||
assert len(c) == 1
|
||||
|
||||
l = len(s)
|
||||
if l < i:
|
||||
return s + c * (i - l)
|
||||
elif l > i:
|
||||
return s[0:i]
|
||||
else:
|
||||
return s
|
||||
|
||||
return s.ljust(i, c)[:i]
|
||||
def pad(s, i, c=' '):
|
||||
assert len(c) == 1
|
||||
|
||||
l = len(s)
|
||||
if len(s) < i:
|
||||
return s + c * (i - l)
|
||||
else:
|
||||
return s
|
||||
return s.ljust(i, c)
|
||||
|
||||
def count_leading_whitespace(s):
|
||||
m = regex.leading_whitespace.match(s)
|
||||
|
|
Loading…
Reference in New Issue