mirror of
https://github.com/tmux/tmux.git
synced 2026-09-14 09:11:59 +00:00
Undo these as top level tmux commands.
This commit is contained in:
@@ -98,7 +98,6 @@ dist_tmux_SOURCES = \
|
||||
cmd-command-prompt.c \
|
||||
cmd-confirm-before.c \
|
||||
cmd-copy-mode.c \
|
||||
cmd-output.c \
|
||||
cmd-detach-client.c \
|
||||
cmd-display-menu.c \
|
||||
cmd-display-message.c \
|
||||
|
||||
113
cmd-output.c
113
cmd-output.c
@@ -1,113 +0,0 @@
|
||||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "tmux.h"
|
||||
|
||||
static enum cmd_retval cmd_output_exec(struct cmd *, struct cmdq_item *);
|
||||
|
||||
const struct cmd_entry cmd_select_output_entry = {
|
||||
.name = "select-output",
|
||||
.alias = NULL,
|
||||
|
||||
.args = { "at:", 0, 0, NULL },
|
||||
.usage = "[-a] " CMD_TARGET_PANE_USAGE,
|
||||
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_output_exec
|
||||
};
|
||||
|
||||
const struct cmd_entry cmd_copy_output_entry = {
|
||||
.name = "copy-output",
|
||||
.alias = NULL,
|
||||
|
||||
.args = { "aCPt:", 0, 1, NULL },
|
||||
.usage = "[-aCP] " CMD_TARGET_PANE_USAGE " [prefix]",
|
||||
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_output_exec
|
||||
};
|
||||
|
||||
const struct cmd_entry cmd_copy_pipe_output_entry = {
|
||||
.name = "copy-pipe-output",
|
||||
.alias = NULL,
|
||||
|
||||
.args = { "aCPt:", 0, 2, NULL },
|
||||
.usage = "[-aCP] " CMD_TARGET_PANE_USAGE " [command] [prefix]",
|
||||
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_output_exec
|
||||
};
|
||||
|
||||
const struct cmd_entry cmd_pipe_output_entry = {
|
||||
.name = "pipe-output",
|
||||
.alias = NULL,
|
||||
|
||||
.args = { "at:", 0, 1, NULL },
|
||||
.usage = "[-a] " CMD_TARGET_PANE_USAGE " [command]",
|
||||
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_output_exec
|
||||
};
|
||||
|
||||
const struct cmd_entry cmd_open_output_entry = {
|
||||
.name = "open-output",
|
||||
.alias = NULL,
|
||||
|
||||
.args = { "at:", 0, 1, NULL },
|
||||
.usage = "[-a] " CMD_TARGET_PANE_USAGE " [command]",
|
||||
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_output_exec
|
||||
};
|
||||
|
||||
const struct cmd_entry cmd_open_selection_entry = {
|
||||
.name = "open-selection",
|
||||
.alias = NULL,
|
||||
|
||||
.args = { "t:", 0, 1, NULL },
|
||||
.usage = CMD_TARGET_PANE_USAGE " [command]",
|
||||
|
||||
.target = { 't', CMD_FIND_PANE, 0 },
|
||||
|
||||
.flags = CMD_AFTERHOOK,
|
||||
.exec = cmd_output_exec
|
||||
};
|
||||
|
||||
static enum cmd_retval
|
||||
cmd_output_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = cmd_get_args(self);
|
||||
struct cmd_find_state *target = cmdq_get_target(item);
|
||||
struct client *c = cmdq_get_client(item);
|
||||
|
||||
window_copy_output(target->wp, c, target->s, target->wl, item,
|
||||
cmd_get_entry(self)->name, args);
|
||||
return (CMD_RETURN_NORMAL);
|
||||
}
|
||||
12
cmd.c
12
cmd.c
@@ -39,8 +39,6 @@ extern const struct cmd_entry cmd_clear_prompt_history_entry;
|
||||
extern const struct cmd_entry cmd_clock_mode_entry;
|
||||
extern const struct cmd_entry cmd_command_prompt_entry;
|
||||
extern const struct cmd_entry cmd_confirm_before_entry;
|
||||
extern const struct cmd_entry cmd_copy_output_entry;
|
||||
extern const struct cmd_entry cmd_copy_pipe_output_entry;
|
||||
extern const struct cmd_entry cmd_copy_mode_entry;
|
||||
extern const struct cmd_entry cmd_customize_mode_entry;
|
||||
extern const struct cmd_entry cmd_delete_buffer_entry;
|
||||
@@ -78,11 +76,8 @@ extern const struct cmd_entry cmd_new_session_entry;
|
||||
extern const struct cmd_entry cmd_new_window_entry;
|
||||
extern const struct cmd_entry cmd_next_layout_entry;
|
||||
extern const struct cmd_entry cmd_next_window_entry;
|
||||
extern const struct cmd_entry cmd_open_output_entry;
|
||||
extern const struct cmd_entry cmd_open_selection_entry;
|
||||
extern const struct cmd_entry cmd_paste_buffer_entry;
|
||||
extern const struct cmd_entry cmd_pipe_pane_entry;
|
||||
extern const struct cmd_entry cmd_pipe_output_entry;
|
||||
extern const struct cmd_entry cmd_previous_layout_entry;
|
||||
extern const struct cmd_entry cmd_previous_window_entry;
|
||||
extern const struct cmd_entry cmd_refresh_client_entry;
|
||||
@@ -96,7 +91,6 @@ extern const struct cmd_entry cmd_rotate_window_entry;
|
||||
extern const struct cmd_entry cmd_run_shell_entry;
|
||||
extern const struct cmd_entry cmd_save_buffer_entry;
|
||||
extern const struct cmd_entry cmd_select_layout_entry;
|
||||
extern const struct cmd_entry cmd_select_output_entry;
|
||||
extern const struct cmd_entry cmd_select_pane_entry;
|
||||
extern const struct cmd_entry cmd_select_window_entry;
|
||||
extern const struct cmd_entry cmd_send_keys_entry;
|
||||
@@ -140,8 +134,6 @@ const struct cmd_entry *cmd_table[] = {
|
||||
&cmd_command_prompt_entry,
|
||||
&cmd_confirm_before_entry,
|
||||
&cmd_copy_mode_entry,
|
||||
&cmd_copy_output_entry,
|
||||
&cmd_copy_pipe_output_entry,
|
||||
&cmd_customize_mode_entry,
|
||||
&cmd_delete_buffer_entry,
|
||||
&cmd_detach_client_entry,
|
||||
@@ -178,11 +170,8 @@ const struct cmd_entry *cmd_table[] = {
|
||||
&cmd_new_window_entry,
|
||||
&cmd_next_layout_entry,
|
||||
&cmd_next_window_entry,
|
||||
&cmd_open_output_entry,
|
||||
&cmd_open_selection_entry,
|
||||
&cmd_paste_buffer_entry,
|
||||
&cmd_pipe_pane_entry,
|
||||
&cmd_pipe_output_entry,
|
||||
&cmd_previous_layout_entry,
|
||||
&cmd_previous_window_entry,
|
||||
&cmd_refresh_client_entry,
|
||||
@@ -196,7 +185,6 @@ const struct cmd_entry *cmd_table[] = {
|
||||
&cmd_run_shell_entry,
|
||||
&cmd_save_buffer_entry,
|
||||
&cmd_select_layout_entry,
|
||||
&cmd_select_output_entry,
|
||||
&cmd_select_pane_entry,
|
||||
&cmd_select_window_entry,
|
||||
&cmd_send_keys_entry,
|
||||
|
||||
@@ -19,20 +19,20 @@ $TMUX kill-server 2>/dev/null
|
||||
$TMUX new-session -d -x80 -y20 "sh -c 'printf \"\\033]133;A\\007p\\$ \\033]133;B\\007echo\\n\\033]133;C\\007one\\ntwo\\n\\033]133;D;0\\007separator\\n\\033]133;A\\007p\\$ \\033]133;B\\007broken\\n\\033]133;C\\007unfinished\"; exec sleep 100'" || exit 1
|
||||
sleep 1
|
||||
|
||||
$TMUX copy-output || exit 1
|
||||
$TMUX copy-mode -U || exit 1
|
||||
$TMUX send-keys -X copy-output || exit 1
|
||||
[ "$($TMUX show-buffer)" = unfinished ] || exit 1
|
||||
|
||||
$TMUX pipe-output "wc -c >$OUT" || exit 1
|
||||
$TMUX send-keys -X pipe-output "wc -c >$OUT" || exit 1
|
||||
sleep 1
|
||||
[ "$(cat "$OUT")" = 10 ] || exit 1
|
||||
|
||||
$TMUX copy-pipe-output "wc -c >$OUT" output || exit 1
|
||||
$TMUX send-keys -X copy-pipe-output "wc -c >$OUT" output || exit 1
|
||||
sleep 1
|
||||
[ "$(cat "$OUT")" = 10 ] || exit 1
|
||||
[ "$($TMUX show-buffer)" = unfinished ] || exit 1
|
||||
|
||||
$TMUX select-output || exit 1
|
||||
[ "$($TMUX display-message -p '#{pane_in_mode}')" = 1 ] || exit 1
|
||||
$TMUX send-keys -X select-output || exit 1
|
||||
$TMUX send-keys -X copy-selection || exit 1
|
||||
[ "$($TMUX show-buffer)" = unfinished ] || exit 1
|
||||
$TMUX send-keys -X cancel || exit 1
|
||||
@@ -71,21 +71,24 @@ $TMUX send-keys -X cancel || exit 1
|
||||
|
||||
$TMUX new-window -d -n plain "printf 'alpha\\nbeta\\n'; exec sleep 100" || exit 1
|
||||
sleep 1
|
||||
$TMUX copy-output -a -t :plain || exit 1
|
||||
$TMUX copy-mode -t :plain || exit 1
|
||||
$TMUX send-keys -t :plain.0 -X copy-output -a || exit 1
|
||||
all=$($TMUX show-buffer)
|
||||
case "$all" in
|
||||
*alpha*beta*) ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
$TMUX send-keys -t :plain.0 -X cancel || exit 1
|
||||
|
||||
$TMUX set-buffer -b keep unchanged || exit 1
|
||||
$TMUX copy-output -t :plain || exit 1
|
||||
$TMUX copy-mode -t :plain || exit 1
|
||||
$TMUX send-keys -t :plain.0 -X copy-output || exit 1
|
||||
[ "$($TMUX show-buffer -b keep)" = unchanged ] || exit 1
|
||||
$TMUX send-keys -t :plain.0 -X cancel || exit 1
|
||||
|
||||
$TMUX select-output -t :plain || exit 1
|
||||
[ "$($TMUX display-message -p -t :plain.0 '#{pane_in_mode}')" = 0 ] || exit 1
|
||||
$TMUX select-output -a -t :plain || exit 1
|
||||
[ "$($TMUX display-message -p -t :plain.0 '#{pane_in_mode}')" = 1 ] || exit 1
|
||||
$TMUX copy-mode -t :plain || exit 1
|
||||
$TMUX send-keys -t :plain.0 -X select-output || exit 1
|
||||
$TMUX send-keys -t :plain.0 -X select-output -a || exit 1
|
||||
$TMUX send-keys -t :plain.0 -X copy-selection || exit 1
|
||||
all=$($TMUX show-buffer)
|
||||
case "$all" in
|
||||
@@ -96,8 +99,10 @@ $TMUX send-keys -t :plain.0 -X cancel || exit 1
|
||||
|
||||
$TMUX new-window -d -n empty "printf '\\033]133;A\\007p\\$ \\033]133;B\\007echo\\033]133;C\\007one\\n\\033]133;D;0\\007\\033]133;A\\007p\\$ \\033]133;B\\007true\\033]133;C\\033]133;D;0\\007'; exec sleep 100" || exit 1
|
||||
sleep 1
|
||||
$TMUX copy-output -t :empty || exit 1
|
||||
$TMUX copy-mode -t :empty || exit 1
|
||||
$TMUX send-keys -t :empty.0 -X copy-output || exit 1
|
||||
[ "$($TMUX show-buffer)" = one ] || exit 1
|
||||
$TMUX send-keys -t :empty.0 -X cancel || exit 1
|
||||
|
||||
$TMUX new-window -d -n prompt "printf '\\033]133;A\\007p\\$ \\033]133;B\\007echo\\033]133;C\\007one\\n\\033]133;D;0\\007\\033]133;A\\007p\\$ \\033]133;B\\007'; exec sleep 100" || exit 1
|
||||
sleep 1
|
||||
|
||||
3
tmux.h
3
tmux.h
@@ -4012,9 +4012,6 @@ int window_copy_get_current_offset(struct window_pane *, u_int *,
|
||||
u_int *);
|
||||
char *window_copy_get_hyperlink(struct window_pane *, u_int, u_int);
|
||||
void window_copy_set_line_numbers(struct window_pane *, int);
|
||||
void window_copy_output(struct window_pane *, struct client *,
|
||||
struct session *, struct winlink *, struct cmdq_item *,
|
||||
const char *, struct args *);
|
||||
|
||||
/* window-customize.c */
|
||||
extern const struct window_mode window_customize_mode;
|
||||
|
||||
@@ -350,7 +350,6 @@ struct window_copy_mode_data {
|
||||
int hide_position; /* hide position marker */
|
||||
int line_numbers; /* 0 off, 1 from option, 2 absolute */
|
||||
int fold_view;
|
||||
int output_previous;
|
||||
u_int output_status_width;
|
||||
|
||||
enum {
|
||||
@@ -2151,10 +2150,6 @@ window_copy_cmd_select_output(struct window_copy_cmd_state *cs)
|
||||
total = data->source->grid->hsize + data->source->grid->sy;
|
||||
ey = total - 1;
|
||||
ex = grid_get_line(data->source->grid, ey)->cellused;
|
||||
} else if (data->output_previous) {
|
||||
if (!window_copy_find_previous_output_range(data->source, &sx, &sy,
|
||||
&ex, &ey))
|
||||
return (WINDOW_COPY_CMD_NOTHING);
|
||||
} else if (!window_copy_find_output_range(wme, &sx, &sy, &ex, &ey))
|
||||
return (WINDOW_COPY_CMD_NOTHING);
|
||||
buf = window_copy_get_output(wme, &len, all);
|
||||
@@ -5320,69 +5315,6 @@ window_copy_command(struct window_mode_entry *wme, struct client *c,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
window_copy_output(struct window_pane *wp, struct client *c,
|
||||
struct session *s, struct winlink *wl, struct cmdq_item *item,
|
||||
const char *command, struct args *args)
|
||||
{
|
||||
struct window_mode_entry *wme = TAILQ_FIRST(&wp->modes);
|
||||
struct window_copy_mode_data *data;
|
||||
struct window_copy_cmd_state cs;
|
||||
struct args *mode_args;
|
||||
enum window_copy_cmd_action action;
|
||||
int temporary = 0;
|
||||
|
||||
if (wme == NULL || wme->mode != &window_copy_mode) {
|
||||
if (strcmp(command, "open-selection") == 0)
|
||||
return;
|
||||
mode_args = args_create();
|
||||
if (window_pane_set_mode(wp, wp, &window_copy_mode, item, NULL,
|
||||
mode_args)) {
|
||||
args_free(mode_args);
|
||||
return;
|
||||
}
|
||||
args_free(mode_args);
|
||||
wme = TAILQ_FIRST(&wp->modes);
|
||||
temporary = 1;
|
||||
}
|
||||
|
||||
cs.wme = wme;
|
||||
cs.args = args;
|
||||
cs.wargs = args;
|
||||
cs.m = NULL;
|
||||
cs.c = c;
|
||||
cs.s = s;
|
||||
cs.wl = wl;
|
||||
|
||||
data = wme->data;
|
||||
data->output_previous = temporary;
|
||||
if (strcmp(command, "select-output") == 0)
|
||||
action = window_copy_cmd_select_output(&cs);
|
||||
else if (strcmp(command, "copy-output") == 0)
|
||||
action = window_copy_cmd_copy_output(&cs);
|
||||
else if (strcmp(command, "copy-pipe-output") == 0)
|
||||
action = window_copy_cmd_copy_pipe_output(&cs);
|
||||
else if (strcmp(command, "pipe-output") == 0)
|
||||
action = window_copy_cmd_pipe_output(&cs);
|
||||
else if (strcmp(command, "open-output") == 0)
|
||||
action = window_copy_cmd_open_output(&cs);
|
||||
else if (strcmp(command, "open-selection") == 0)
|
||||
action = window_copy_cmd_open_selection(&cs);
|
||||
else {
|
||||
data->output_previous = 0;
|
||||
if (temporary)
|
||||
window_pane_reset_mode(wp);
|
||||
return;
|
||||
}
|
||||
data->output_previous = 0;
|
||||
|
||||
if (temporary && (strcmp(command, "select-output") != 0 ||
|
||||
action != WINDOW_COPY_CMD_REDRAW))
|
||||
window_pane_reset_mode(wp);
|
||||
else if (action == WINDOW_COPY_CMD_REDRAW)
|
||||
window_copy_redraw_screen(wme);
|
||||
}
|
||||
|
||||
static void
|
||||
window_copy_scroll_to(struct window_mode_entry *wme, u_int px, u_int py,
|
||||
int no_redraw)
|
||||
@@ -7594,12 +7526,6 @@ window_copy_get_output(struct window_mode_entry *wme, size_t *len, int all)
|
||||
sx = sy = 0;
|
||||
ey = total - 1;
|
||||
ex = grid_get_line(gd, ey)->cellused;
|
||||
} else if (data->output_previous) {
|
||||
if (!window_copy_find_previous_output_range(data->source, &sx, &sy,
|
||||
&ex, &ey)) {
|
||||
*len = 0;
|
||||
return (NULL);
|
||||
}
|
||||
} else if (!window_copy_find_output_range(wme, &sx, &sy, &ex, &ey)) {
|
||||
*len = 0;
|
||||
return (NULL);
|
||||
|
||||
Reference in New Issue
Block a user