hate hate hat e

--HG--
branch : pmacs2
This commit is contained in:
moculus 2009-03-05 08:08:33 +00:00
parent 7eb60039eb
commit bfd99cab5d
4 changed files with 25 additions and 13 deletions

View File

@ -953,10 +953,12 @@ def open_plain_file(path, name=None, binary=False):
def run_app(stdscr, buffers, **kwargs):
curses.def_shell_mode()
a = Application(stdscr, buffers, **kwargs)
for name in kwargs.get('init_cmds', []):
act = a.methods[name]
act.execute(a.active_window())
a.last_action = act.name
metax = a.methods['meta-x']
for cmd in kwargs.get('init_cmds', []):
#act = a.methods[name]
#act.execute(a.active_window())
metax.execute(a.active_window(), method=cmd)
#a.last_action = act.name
a.run()
return 0

View File

@ -9,7 +9,6 @@ class XTermBuffer(Buffer, XTerm):
btype = 'term'
modename = 'pipe'
termtype = 'xterm'
#termtype = 'vt100'
def __init__(self, app, cmd, args, name=None):
XTerm.__init__(self)
Buffer.__init__(self)

View File

@ -147,7 +147,8 @@ class Interact(Method):
a = w.application
a.close_buffer_by_name(bname)
b = buffer.emul.XTermBuffer(a, cmd, [], name=bname)
#b = buffer.emul.XTermBuffer(a, cmd, [], name=bname)
b = buffer.emul.XTermBuffer(a, 'bash', ['-c', cmd], name=bname)
a.add_buffer(b)
window.Window(b, a)
if a.window().buffer is not b:

24
term.py
View File

@ -5,7 +5,7 @@ from point import Point
# entry. otherwise this project is probably hopeless.
def show(c):
if c in string.letters + string.digits + string.punctuation:
if c in string.letters + string.digits + string.punctuation + ' ':
return c
else:
return '\\%03o' % ord(c)
@ -112,13 +112,17 @@ class XTerm(Dumb):
'home': 'term_do_home',
'rmm': 'term_nop',
'smm': 'term_nop',
'bold': 'term_nop',
'op': 'term_nop', #original color-pair
'cup': 'term_nop',
'cup': 'term_nop', #hmmm?
'cnorm': 'term_nop', #make cursor normal
'civis': 'term_nop', #make cursor inviz
'cvvis': 'term_nop', #make cursor bold
'smcup': 'term_nop', #enter cup mode
'rmcup': 'term_nop', #leave cup mode
'smacs': 'term_nop', #orig charset
'rmacs': 'term_nop', #
'smso': 'term_nop', #enter standout
@ -162,10 +166,18 @@ class XTerm(Dumb):
self._meta.append(c)
def term_handle(self, c):
#UGHGHGHGH
if self._meta:
self._meta.append(c)
s = ''.join(self._meta)
if s.startswith('\x1b[H') and not '\x1b[H\x1b[2J'.startswith(s):
self._meta = self._meta[3:]
if self._meta[0] != '\x1b':
for c2 in self._meta[:-1]:
Dumb.term_handle(self, c)
self._meta = []
if self._meta:
s = ''.join(self._meta)
if s in self.sequences:
name = self.sequences[s]
if self.debug:
@ -175,10 +187,8 @@ class XTerm(Dumb):
f()
else:
self._term_insert('<%s>' % name)
# certain sequences shouldn't get removed immediately
if name in ('home',):
pass
else:
# certain sequences shouldn't get removed immediately; ugh
if name not in ['home']:
self._meta = []
elif self.style_re.match(s):
self._meta = []