diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2022-04-18 11:47:14 +0100 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2022-04-18 11:47:14 +0100 |
commit | 58d1a206c6ae6b33059ea6b469c21dad92ea0841 (patch) | |
tree | 7a27d44d3631833c77536a700e509d5e08fbb562 /cmd-run-shell.c | |
parent | e0c982c5adf54fcfc7c6e588b1350fd8ae474310 (diff) | |
download | rtmux-58d1a206c6ae6b33059ea6b469c21dad92ea0841.tar.gz rtmux-58d1a206c6ae6b33059ea6b469c21dad92ea0841.tar.bz2 rtmux-58d1a206c6ae6b33059ea6b469c21dad92ea0841.zip |
Add a way for lines added to copy mode to be passed through the parser to
handle escape sequences and use it for run-shell, GitHub issue 3156.
Diffstat (limited to 'cmd-run-shell.c')
-rw-r--r-- | cmd-run-shell.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/cmd-run-shell.c b/cmd-run-shell.c index 5e914e65..db5774d2 100644 --- a/cmd-run-shell.c +++ b/cmd-run-shell.c @@ -84,22 +84,17 @@ cmd_run_shell_print(struct job *job, const char *msg) if (cdata->wp_id != -1) wp = window_pane_find_by_id(cdata->wp_id); - if (wp == NULL) { - if (cdata->item != NULL) { - cmdq_print(cdata->item, "%s", msg); - return; - } - if (cmd_find_from_nothing(&fs, 0) != 0) - return; + if (wp == NULL && cdata->item != NULL) + wp = server_client_get_pane(cdata->client); + if (wp == NULL && cmd_find_from_nothing(&fs, 0) == 0) wp = fs.wp; - if (wp == NULL) - return; - } + if (wp == NULL) + return; wme = TAILQ_FIRST(&wp->modes); if (wme == NULL || wme->mode != &window_view_mode) window_pane_set_mode(wp, NULL, &window_view_mode, NULL, NULL); - window_copy_add(wp, "%s", msg); + window_copy_add(wp, 1, "%s", msg); } static enum cmd_retval @@ -227,7 +222,8 @@ cmd_run_shell_callback(struct job *job) int retcode, status; do { - if ((line = evbuffer_readline(event->input)) != NULL) { + line = evbuffer_readln(event->input, NULL, EVBUFFER_EOL_LF); + if (line != NULL) { cmd_run_shell_print(job, line); free(line); } |