aboutsummaryrefslogtreecommitdiff
path: root/server-client.c
diff options
context:
space:
mode:
authornicm <nicm>2022-03-24 09:05:57 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2022-04-06 14:19:51 +0100
commit89a0046ad360d7a499732e327bae69b7e4b2536e (patch)
tree03ab2c55c4a70e18be56715ab86a9643690330b5 /server-client.c
parent60a0a904e007390b8fba484eea9461bf095bff7a (diff)
downloadrtmux-89a0046ad360d7a499732e327bae69b7e4b2536e.tar.gz
rtmux-89a0046ad360d7a499732e327bae69b7e4b2536e.tar.bz2
rtmux-89a0046ad360d7a499732e327bae69b7e4b2536e.zip
Add a capability for OSC 7 and use it similarly to how the title is set
(and controlled by the same set-titles option). GitHub issue 3127.
Diffstat (limited to 'server-client.c')
-rw-r--r--server-client.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/server-client.c b/server-client.c
index 3b888d01..2350a982 100644
--- a/server-client.c
+++ b/server-client.c
@@ -40,6 +40,7 @@ static void server_client_check_exit(struct client *);
static void server_client_check_redraw(struct client *);
static void server_client_check_modes(struct client *);
static void server_client_set_title(struct client *);
+static void server_client_set_path(struct client *);
static void server_client_reset_state(struct client *);
static int server_client_assume_paste(struct session *);
static void server_client_update_latest(struct client *);
@@ -2600,8 +2601,10 @@ server_client_check_redraw(struct client *c)
}
if (c->flags & CLIENT_ALLREDRAWFLAGS) {
- if (options_get_number(s->options, "set-titles"))
+ if (options_get_number(s->options, "set-titles")) {
server_client_set_title(c);
+ server_client_set_path(c);
+ }
screen_redraw_screen(c);
}
@@ -2647,6 +2650,26 @@ server_client_set_title(struct client *c)
format_free(ft);
}
+/* Set client path. */
+static void
+server_client_set_path(struct client *c)
+{
+ struct session *s = c->session;
+ const char *path;
+
+ if (s->curw == NULL)
+ return;
+ if (s->curw->window->active->base.path == NULL)
+ path = "";
+ else
+ path = s->curw->window->active->base.path;
+ if (c->path == NULL || strcmp(path, c->path) != 0) {
+ free(c->path);
+ c->path = xstrdup(path);
+ tty_set_path(&c->tty, c->path);
+ }
+}
+
/* Dispatch message from client. */
static void
server_client_dispatch(struct imsg *imsg, void *arg)