summaryrefslogtreecommitdiffstats
path: root/server-client.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2022-03-24 12:01:11 +0000
committerThomas Adam <thomas@xteddy.org>2022-03-24 12:01:11 +0000
commit5e491e79475425ca58316eac30a76038756a6499 (patch)
treec7e4318f1574fddb1541f3b75d9e09d58c2f37db /server-client.c
parent964deae422e4127a64f60fa3b54e2bf47b8e074c (diff)
parent792d13af49f2550a9a8d11b0099528628957a1a0 (diff)
Merge branch 'obsd-master' into master
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)