-/* $OpenBSD: cfg.c,v 1.86 2022/06/20 07:59:37 nicm Exp $ */
+/* $OpenBSD: cfg.c,v 1.87 2023/09/15 06:31:49 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
{
struct client *c;
u_int i;
+ int flags = 0;
/*
* Configuration files are loaded without a client, so commands are run
cmdq_append(c, cfg_item);
}
- for (i = 0; i < cfg_nfiles; i++) {
- if (cfg_quiet)
- load_cfg(cfg_files[i], c, NULL, CMD_PARSE_QUIET, NULL);
- else
- load_cfg(cfg_files[i], c, NULL, 0, NULL);
- }
+ if (cfg_quiet)
+ flags = CMD_PARSE_QUIET;
+ for (i = 0; i < cfg_nfiles; i++)
+ load_cfg(cfg_files[i], c, NULL, NULL, flags, NULL);
cmdq_append(NULL, cmdq_get_callback(cfg_done, NULL));
}
int
-load_cfg(const char *path, struct client *c, struct cmdq_item *item, int flags,
- struct cmdq_item **new_item)
+load_cfg(const char *path, struct client *c, struct cmdq_item *item,
+ struct cmd_find_state *current, int flags, struct cmdq_item **new_item)
{
FILE *f;
struct cmd_parse_input pi;
}
if (item != NULL)
- state = cmdq_copy_state(cmdq_get_state(item));
+ state = cmdq_copy_state(cmdq_get_state(item), current);
else
state = cmdq_new_state(NULL, NULL, 0);
cmdq_add_format(state, "current_file", "%s", pi.file);
int
load_cfg_from_buffer(const void *buf, size_t len, const char *path,
- struct client *c, struct cmdq_item *item, int flags,
- struct cmdq_item **new_item)
+ struct client *c, struct cmdq_item *item, struct cmd_find_state *current,
+ int flags, struct cmdq_item **new_item)
{
struct cmd_parse_input pi;
struct cmd_parse_result *pr;
}
if (item != NULL)
- state = cmdq_copy_state(cmdq_get_state(item));
+ state = cmdq_copy_state(cmdq_get_state(item), current);
else
state = cmdq_new_state(NULL, NULL, 0);
cmdq_add_format(state, "current_file", "%s", pi.file);
-/* $OpenBSD: cmd-queue.c,v 1.114 2023/02/05 21:15:32 nicm Exp $ */
+/* $OpenBSD: cmd-queue.c,v 1.115 2023/09/15 06:31:49 nicm Exp $ */
/*
* Copyright (c) 2013 Nicholas Marriott <nicholas.marriott@gmail.com>
/* Make a copy of a state. */
struct cmdq_state *
-cmdq_copy_state(struct cmdq_state *state)
+cmdq_copy_state(struct cmdq_state *state, struct cmd_find_state *current)
{
+ if (current != NULL)
+ return (cmdq_new_state(current, &state->event, state->flags));
return (cmdq_new_state(&state->current, &state->event, state->flags));
}
-/* $OpenBSD: cmd-source-file.c,v 1.53 2021/08/23 11:04:21 nicm Exp $ */
+/* $OpenBSD: cmd-source-file.c,v 1.54 2023/09/15 06:31:49 nicm Exp $ */
/*
* Copyright (c) 2008 Tiago Cunha <me@tiagocunha.org>
.name = "source-file",
.alias = "source",
- .args = { "Fnqv", 1, -1, NULL },
- .usage = "[-Fnqv] path ...",
+ .args = { "t:Fnqv", 1, -1, NULL },
+ .usage = "[-Fnqv] " CMD_TARGET_PANE_USAGE " path ...",
+
+ .target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },
.flags = 0,
.exec = cmd_source_file_exec
size_t bsize = EVBUFFER_LENGTH(buffer);
u_int n;
struct cmdq_item *new_item;
+ struct cmd_find_state *target = cmdq_get_target(item);
if (!closed)
return;
cmdq_error(item, "%s: %s", path, strerror(error));
else if (bsize != 0) {
if (load_cfg_from_buffer(bdata, bsize, path, c, cdata->after,
- cdata->flags, &new_item) < 0)
+ target, cdata->flags, &new_item) < 0)
cdata->retval = CMD_RETURN_ERROR;
else if (new_item != NULL)
cdata->after = new_item;
-/* $OpenBSD: input.c,v 1.221 2023/09/15 06:28:15 nicm Exp $ */
+/* $OpenBSD: input.c,v 1.222 2023/09/15 06:31:49 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
/* Handle CSI graphics SM. */
static void
-input_csi_dispatch_sm_graphics(struct input_ctx *ictx)
+input_csi_dispatch_sm_graphics(__unused struct input_ctx *ictx)
{
}
-.\" $OpenBSD: tmux.1,v 1.931 2023/09/02 09:17:23 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.932 2023/09/15 06:31:49 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: September 2 2023 $
+.Dd $Mdocdate: September 15 2023 $
.Dt TMUX 1
.Os
.Sh NAME
.Tg source
.It Xo Ic source-file
.Op Fl Fnqv
+.Op Fl t Ar target-pane
.Ar path ...
.Xc
.D1 Pq alias: Ic source
-/* $OpenBSD: tmux.h,v 1.1209 2023/09/02 20:03:10 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.1210 2023/09/15 06:31:49 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
extern u_int cfg_nfiles;
extern int cfg_quiet;
void start_cfg(void);
-int load_cfg(const char *, struct client *, struct cmdq_item *, int,
- struct cmdq_item **);
+int load_cfg(const char *, struct client *, struct cmdq_item *,
+ struct cmd_find_state *, int, struct cmdq_item **);
int load_cfg_from_buffer(const void *, size_t, const char *,
- struct client *, struct cmdq_item *, int, struct cmdq_item **);
+ struct client *, struct cmdq_item *, struct cmd_find_state *,
+ int, struct cmdq_item **);
void printflike(1, 2) cfg_add_cause(const char *, ...);
void cfg_print_causes(struct cmdq_item *);
void cfg_show_causes(struct session *);
struct cmdq_state *cmdq_new_state(struct cmd_find_state *, struct key_event *,
int);
struct cmdq_state *cmdq_link_state(struct cmdq_state *);
-struct cmdq_state *cmdq_copy_state(struct cmdq_state *);
+struct cmdq_state *cmdq_copy_state(struct cmdq_state *,
+ struct cmd_find_state *);
void cmdq_free_state(struct cmdq_state *);
void printflike(3, 4) cmdq_add_format(struct cmdq_state *, const char *,
const char *, ...);