Fix handing of --stdin-source and getting of active window

This commit is contained in:
Kovid Goyal 2019-11-13 14:39:44 +05:30
parent f113184165
commit 00c2670039
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -114,7 +114,7 @@ screen.
return options_spec.ans return options_spec.ans
def parse_launch_args(args): def parse_launch_args(args=None):
args = list(args or ()) args = list(args or ())
try: try:
opts, args = parse_args(args=args, ospec=options_spec) opts, args = parse_args(args=args, ospec=options_spec)
@ -134,7 +134,9 @@ def get_env(opts, active_child):
return env return env
def launch(boss, opts, args): def launch(boss, opts, args, target_tab=None):
active = boss.active_window_for_cwd
active_child = getattr(active, 'child', None)
if opts.type == 'tab': if opts.type == 'tab':
tm = boss.active_tab_manager tm = boss.active_tab_manager
tab = tm.new_tab(empty_tab=True) tab = tm.new_tab(empty_tab=True)
@ -147,9 +149,7 @@ def launch(boss, opts, args):
if opts.tab_title: if opts.tab_title:
tab.set_title(opts.tab_title) tab.set_title(opts.tab_title)
else: else:
tab = boss.active_tab tab = target_tab or boss.active_tab
active = boss.active_window_for_cwd
active_child = getattr(active, 'child', None)
env = get_env(opts, active_child) env = get_env(opts, active_child)
kw = { kw = {
'allow_remote_control': opts.allow_remote_control 'allow_remote_control': opts.allow_remote_control
@ -180,7 +180,7 @@ def launch(boss, opts, args):
kw['cmd'] = final_cmd kw['cmd'] = final_cmd
if opts.type == 'overlay' and active and not active.overlay_window_id: if opts.type == 'overlay' and active and not active.overlay_window_id:
kw['overlay_for'] = active.id kw['overlay_for'] = active.id
if opts.stdin_source: if opts.stdin_source and opts.stdin_source != 'none':
q = opts.stdin_source q = opts.stdin_source
if opts.stdin_add_line_wrap_markers: if opts.stdin_add_line_wrap_markers:
q += '_wrap' q += '_wrap'