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

View File

@ -134,9 +134,7 @@ def get_env(opts, active_child):
return env return env
def launch(boss, opts, args, target_tab=None): def tab_for_window(boss, opts, 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)
@ -150,6 +148,13 @@ def launch(boss, opts, args, target_tab=None):
tab.set_title(opts.tab_title) tab.set_title(opts.tab_title)
else: else:
tab = target_tab or boss.active_tab tab = target_tab or boss.active_tab
return tab
def launch(boss, opts, args, target_tab=None):
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
@ -190,6 +195,7 @@ def launch(boss, opts, args, target_tab=None):
if penv: if penv:
env.update(penv) env.update(penv)
tab = tab_for_window(boss, opts, target_tab)
new_window = tab.new_window(env=env or None, **kw) new_window = tab.new_window(env=env or None, **kw)
if opts.keep_focus and active: if opts.keep_focus and active:
boss.set_active_window(active) boss.set_active_window(active)