parent
7eb60039eb
commit
bfd99cab5d
|
@ -953,10 +953,12 @@ def open_plain_file(path, name=None, binary=False):
|
||||||
def run_app(stdscr, buffers, **kwargs):
|
def run_app(stdscr, buffers, **kwargs):
|
||||||
curses.def_shell_mode()
|
curses.def_shell_mode()
|
||||||
a = Application(stdscr, buffers, **kwargs)
|
a = Application(stdscr, buffers, **kwargs)
|
||||||
for name in kwargs.get('init_cmds', []):
|
metax = a.methods['meta-x']
|
||||||
act = a.methods[name]
|
for cmd in kwargs.get('init_cmds', []):
|
||||||
act.execute(a.active_window())
|
#act = a.methods[name]
|
||||||
a.last_action = act.name
|
#act.execute(a.active_window())
|
||||||
|
metax.execute(a.active_window(), method=cmd)
|
||||||
|
#a.last_action = act.name
|
||||||
a.run()
|
a.run()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ class XTermBuffer(Buffer, XTerm):
|
||||||
btype = 'term'
|
btype = 'term'
|
||||||
modename = 'pipe'
|
modename = 'pipe'
|
||||||
termtype = 'xterm'
|
termtype = 'xterm'
|
||||||
#termtype = 'vt100'
|
|
||||||
def __init__(self, app, cmd, args, name=None):
|
def __init__(self, app, cmd, args, name=None):
|
||||||
XTerm.__init__(self)
|
XTerm.__init__(self)
|
||||||
Buffer.__init__(self)
|
Buffer.__init__(self)
|
||||||
|
|
|
@ -147,7 +147,8 @@ class Interact(Method):
|
||||||
|
|
||||||
a = w.application
|
a = w.application
|
||||||
a.close_buffer_by_name(bname)
|
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)
|
a.add_buffer(b)
|
||||||
window.Window(b, a)
|
window.Window(b, a)
|
||||||
if a.window().buffer is not b:
|
if a.window().buffer is not b:
|
||||||
|
|
24
term.py
24
term.py
|
@ -5,7 +5,7 @@ from point import Point
|
||||||
# entry. otherwise this project is probably hopeless.
|
# entry. otherwise this project is probably hopeless.
|
||||||
|
|
||||||
def show(c):
|
def show(c):
|
||||||
if c in string.letters + string.digits + string.punctuation:
|
if c in string.letters + string.digits + string.punctuation + ' ':
|
||||||
return c
|
return c
|
||||||
else:
|
else:
|
||||||
return '\\%03o' % ord(c)
|
return '\\%03o' % ord(c)
|
||||||
|
@ -112,13 +112,17 @@ class XTerm(Dumb):
|
||||||
'home': 'term_do_home',
|
'home': 'term_do_home',
|
||||||
'rmm': 'term_nop',
|
'rmm': 'term_nop',
|
||||||
'smm': 'term_nop',
|
'smm': 'term_nop',
|
||||||
|
'bold': 'term_nop',
|
||||||
'op': 'term_nop', #original color-pair
|
'op': 'term_nop', #original color-pair
|
||||||
'cup': 'term_nop',
|
'cup': 'term_nop', #hmmm?
|
||||||
|
|
||||||
'cnorm': 'term_nop', #make cursor normal
|
'cnorm': 'term_nop', #make cursor normal
|
||||||
'civis': 'term_nop', #make cursor inviz
|
'civis': 'term_nop', #make cursor inviz
|
||||||
'cvvis': 'term_nop', #make cursor bold
|
'cvvis': 'term_nop', #make cursor bold
|
||||||
|
|
||||||
|
'smcup': 'term_nop', #enter cup mode
|
||||||
|
'rmcup': 'term_nop', #leave cup mode
|
||||||
|
|
||||||
'smacs': 'term_nop', #orig charset
|
'smacs': 'term_nop', #orig charset
|
||||||
'rmacs': 'term_nop', #
|
'rmacs': 'term_nop', #
|
||||||
'smso': 'term_nop', #enter standout
|
'smso': 'term_nop', #enter standout
|
||||||
|
@ -162,10 +166,18 @@ class XTerm(Dumb):
|
||||||
self._meta.append(c)
|
self._meta.append(c)
|
||||||
|
|
||||||
def term_handle(self, c):
|
def term_handle(self, c):
|
||||||
|
#UGHGHGHGH
|
||||||
if self._meta:
|
if self._meta:
|
||||||
self._meta.append(c)
|
self._meta.append(c)
|
||||||
s = ''.join(self._meta)
|
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:
|
if s in self.sequences:
|
||||||
name = self.sequences[s]
|
name = self.sequences[s]
|
||||||
if self.debug:
|
if self.debug:
|
||||||
|
@ -175,10 +187,8 @@ class XTerm(Dumb):
|
||||||
f()
|
f()
|
||||||
else:
|
else:
|
||||||
self._term_insert('<%s>' % name)
|
self._term_insert('<%s>' % name)
|
||||||
# certain sequences shouldn't get removed immediately
|
# certain sequences shouldn't get removed immediately; ugh
|
||||||
if name in ('home',):
|
if name not in ['home']:
|
||||||
pass
|
|
||||||
else:
|
|
||||||
self._meta = []
|
self._meta = []
|
||||||
elif self.style_re.match(s):
|
elif self.style_re.match(s):
|
||||||
self._meta = []
|
self._meta = []
|
||||||
|
|
Loading…
Reference in New Issue