Allow specifying a marker when launching windows
This commit is contained in:
parent
24d45b99e3
commit
9c3390c5e6
3 changed files with 13 additions and 1 deletions
|
|
@ -890,6 +890,7 @@ def cmd_launch(global_opts, opts, args):
|
|||
stdin_add_formatting: Boolean indicating whether to add formatting codes to stdin
|
||||
stdin_add_line_wrap_markers: Boolean indicating whether to add line wrap markers to stdin
|
||||
no_response: Boolean indicating whether to send back the window id
|
||||
marker: Specification for marker for new window, for example: "text 1 ERROR"
|
||||
'''
|
||||
if opts.no_response:
|
||||
global_opts.no_command_response = True
|
||||
|
|
|
|||
|
|
@ -116,6 +116,9 @@ def options_spec():
|
|||
screen.
|
||||
|
||||
|
||||
--marker
|
||||
Create a marker that highlights text in the newly created window. The syntax is
|
||||
the same as for the :opt:`toggle_marker` map action.
|
||||
'''
|
||||
options_spec.ans = OPTIONS
|
||||
return options_spec.ans
|
||||
|
|
@ -178,6 +181,8 @@ def launch(boss, opts, args, target_tab=None):
|
|||
kw['override_title'] = opts.window_title
|
||||
if opts.copy_colors and active:
|
||||
kw['copy_colors_from'] = active
|
||||
if opts.marker:
|
||||
kw['marker'] = opts.marker
|
||||
cmd = args or None
|
||||
if opts.copy_cmdline and active_child:
|
||||
cmd = active_child.foreground_cmdline
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ def _add_window(self, window, location=None):
|
|||
def new_window(
|
||||
self, use_shell=True, cmd=None, stdin=None, override_title=None,
|
||||
cwd_from=None, cwd=None, overlay_for=None, env=None, location=None,
|
||||
copy_colors_from=None, allow_remote_control=False
|
||||
copy_colors_from=None, allow_remote_control=False, marker=None
|
||||
):
|
||||
child = self.launch_child(
|
||||
use_shell=use_shell, cmd=cmd, stdin=stdin, cwd_from=cwd_from, cwd=cwd, env=env, allow_remote_control=allow_remote_control)
|
||||
|
|
@ -275,6 +275,12 @@ def new_window(
|
|||
# Must add child before laying out so that resize_pty succeeds
|
||||
get_boss().add_child(window)
|
||||
self._add_window(window, location=location)
|
||||
if marker:
|
||||
try:
|
||||
window.set_marker(marker)
|
||||
except Exception:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
return window
|
||||
|
||||
def new_special_window(self, special_window, location=None, copy_colors_from=None, allow_remote_control=False):
|
||||
|
|
|
|||
Loading…
Reference in a new issue