mirror of
https://github.com/tmux/tmux.git
synced 2026-06-22 07:16:58 +00:00
Removed cmd-tile-float-pane.c.
This commit is contained in:
@@ -150,7 +150,6 @@ dist_tmux_SOURCES = \
|
|||||||
cmd-source-file.c \
|
cmd-source-file.c \
|
||||||
cmd-split-window.c \
|
cmd-split-window.c \
|
||||||
cmd-swap-pane.c \
|
cmd-swap-pane.c \
|
||||||
cmd-tile-float-pane.c \
|
|
||||||
cmd-swap-window.c \
|
cmd-swap-window.c \
|
||||||
cmd-switch-client.c \
|
cmd-switch-client.c \
|
||||||
cmd-unbind-key.c \
|
cmd-unbind-key.c \
|
||||||
|
|||||||
@@ -1,154 +0,0 @@
|
|||||||
/* $OpenBSD$ */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2026 Michael Grant <mgrant@grant.org>
|
|
||||||
*
|
|
||||||
* 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 MIND, 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 <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "tmux.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* float-pane: lift a tiled pane out of the layout tree into a floating pane.
|
|
||||||
* tile-pane: insert a floating pane back into the tiled layout.
|
|
||||||
*
|
|
||||||
* saved_layout_cell is reused to remember the pane's tiled slot while it is
|
|
||||||
* floating, using the same mechanism as hide-pane. The cell's wp pointer
|
|
||||||
* is cleared while the pane is floating so that layout helpers treat the slot
|
|
||||||
* as empty.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static enum cmd_retval cmd_float_pane_exec(struct cmd *, struct cmdq_item *);
|
|
||||||
static enum cmd_retval cmd_tile_pane_exec(struct cmd *, struct cmdq_item *);
|
|
||||||
|
|
||||||
const struct cmd_entry cmd_float_pane_entry = {
|
|
||||||
.name = "float-pane",
|
|
||||||
.alias = "floatp",
|
|
||||||
|
|
||||||
.args = { "dt:x:X:y:Y:", 0, 0, NULL },
|
|
||||||
.usage = "[-x height] [-y width] [-X x-position] [-Y y-position] "
|
|
||||||
CMD_TARGET_PANE_USAGE,
|
|
||||||
|
|
||||||
.target = { 't', CMD_FIND_PANE, 0 },
|
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
|
||||||
.exec = cmd_float_pane_exec
|
|
||||||
};
|
|
||||||
|
|
||||||
const struct cmd_entry cmd_tile_pane_entry = {
|
|
||||||
.name = "tile-pane",
|
|
||||||
.alias = "tilep",
|
|
||||||
|
|
||||||
.args = { "dt:", 0, 0, NULL },
|
|
||||||
.usage = CMD_TARGET_PANE_USAGE,
|
|
||||||
|
|
||||||
.target = { 't', CMD_FIND_PANE, 0 },
|
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
|
||||||
.exec = cmd_tile_pane_exec
|
|
||||||
};
|
|
||||||
|
|
||||||
static enum cmd_retval
|
|
||||||
cmd_float_pane_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 window *w = target->wl->window;
|
|
||||||
struct window_pane *wp = target->wp;
|
|
||||||
struct layout_cell *lc = wp->layout_cell;
|
|
||||||
u_int sx = lc->saved_sx, sy = lc->saved_sy;
|
|
||||||
int ox = lc->saved_xoff, oy = lc->saved_yoff;
|
|
||||||
char *cause = NULL;
|
|
||||||
|
|
||||||
if (window_pane_is_floating(wp)) {
|
|
||||||
cmdq_error(item, "pane is already floating");
|
|
||||||
return (CMD_RETURN_ERROR);
|
|
||||||
}
|
|
||||||
if (window_pane_is_hidden(wp)) {
|
|
||||||
cmdq_error(item, "can't float a hidden pane");
|
|
||||||
return (CMD_RETURN_ERROR);
|
|
||||||
}
|
|
||||||
if (w->flags & WINDOW_ZOOMED) {
|
|
||||||
cmdq_error(item, "can't float a pane while window is zoomed");
|
|
||||||
return (CMD_RETURN_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
layout_remove_tile(w, lc);
|
|
||||||
layout_cell_floating_args_parse(item, args, w, &sx, &sy, &ox, &oy, &cause);
|
|
||||||
if (cause != NULL) {
|
|
||||||
cmdq_error(item, "failed to float pane: %s", cause);
|
|
||||||
free(cause);
|
|
||||||
return (CMD_RETURN_ERROR);
|
|
||||||
}
|
|
||||||
layout_set_size(lc, sx, sy, ox, oy);
|
|
||||||
|
|
||||||
lc->flags |= LAYOUT_CELL_FLOATING;
|
|
||||||
TAILQ_REMOVE(&w->z_index, wp, zentry);
|
|
||||||
TAILQ_INSERT_HEAD(&w->z_index, wp, zentry);
|
|
||||||
|
|
||||||
if (!args_has(args, 'd'))
|
|
||||||
window_set_active_pane(w, wp, 1);
|
|
||||||
layout_fix_offsets(w);
|
|
||||||
layout_fix_panes(w, NULL);
|
|
||||||
notify_window("window-layout-changed", w);
|
|
||||||
server_redraw_window(w);
|
|
||||||
|
|
||||||
return (CMD_RETURN_NORMAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static enum cmd_retval
|
|
||||||
cmd_tile_pane_exec(struct cmd *self, struct cmdq_item *item)
|
|
||||||
{
|
|
||||||
__unused struct args *args = cmd_get_args(self);
|
|
||||||
struct cmd_find_state *target = cmdq_get_target(item);
|
|
||||||
struct window *w = target->wl->window;
|
|
||||||
struct window_pane *wp = target->wp;
|
|
||||||
struct layout_cell *lc = wp->layout_cell;
|
|
||||||
|
|
||||||
if (!window_pane_is_floating(wp)) {
|
|
||||||
cmdq_error(item, "pane is not floating");
|
|
||||||
return (CMD_RETURN_ERROR);
|
|
||||||
}
|
|
||||||
if (window_pane_is_hidden(wp)) {
|
|
||||||
cmdq_error(item, "can't tile a hidden pane");
|
|
||||||
return (CMD_RETURN_ERROR);
|
|
||||||
}
|
|
||||||
if (w->flags & WINDOW_ZOOMED) {
|
|
||||||
cmdq_error(item, "can't tile a pane while window is zoomed");
|
|
||||||
return (CMD_RETURN_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
layout_save_size(lc);
|
|
||||||
lc->flags &= ~LAYOUT_CELL_FLOATING;
|
|
||||||
if (layout_insert_tile(w, lc) == 0) {
|
|
||||||
cmdq_error(item, "no space for a new pane");
|
|
||||||
return (CMD_RETURN_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
TAILQ_REMOVE(&w->z_index, wp, zentry);
|
|
||||||
TAILQ_INSERT_TAIL(&w->z_index, wp, zentry);
|
|
||||||
|
|
||||||
if (!args_has(args, 'd'))
|
|
||||||
window_set_active_pane(w, wp, 1);
|
|
||||||
layout_fix_offsets(w);
|
|
||||||
layout_fix_panes(w, NULL);
|
|
||||||
notify_window("window-layout-changed", w);
|
|
||||||
server_redraw_window(w);
|
|
||||||
|
|
||||||
return (CMD_RETURN_NORMAL);
|
|
||||||
}
|
|
||||||
4
cmd.c
4
cmd.c
@@ -69,7 +69,6 @@ extern const struct cmd_entry cmd_load_buffer_entry;
|
|||||||
extern const struct cmd_entry cmd_lock_client_entry;
|
extern const struct cmd_entry cmd_lock_client_entry;
|
||||||
extern const struct cmd_entry cmd_lock_server_entry;
|
extern const struct cmd_entry cmd_lock_server_entry;
|
||||||
extern const struct cmd_entry cmd_lock_session_entry;
|
extern const struct cmd_entry cmd_lock_session_entry;
|
||||||
extern const struct cmd_entry cmd_float_pane_entry;
|
|
||||||
extern const struct cmd_entry cmd_hide_pane_entry;
|
extern const struct cmd_entry cmd_hide_pane_entry;
|
||||||
extern const struct cmd_entry cmd_move_pane_entry;
|
extern const struct cmd_entry cmd_move_pane_entry;
|
||||||
extern const struct cmd_entry cmd_move_window_entry;
|
extern const struct cmd_entry cmd_move_window_entry;
|
||||||
@@ -120,7 +119,6 @@ extern const struct cmd_entry cmd_swap_window_entry;
|
|||||||
extern const struct cmd_entry cmd_switch_client_entry;
|
extern const struct cmd_entry cmd_switch_client_entry;
|
||||||
extern const struct cmd_entry cmd_unbind_key_entry;
|
extern const struct cmd_entry cmd_unbind_key_entry;
|
||||||
extern const struct cmd_entry cmd_unlink_window_entry;
|
extern const struct cmd_entry cmd_unlink_window_entry;
|
||||||
extern const struct cmd_entry cmd_tile_pane_entry;
|
|
||||||
extern const struct cmd_entry cmd_wait_for_entry;
|
extern const struct cmd_entry cmd_wait_for_entry;
|
||||||
|
|
||||||
const struct cmd_entry *cmd_table[] = {
|
const struct cmd_entry *cmd_table[] = {
|
||||||
@@ -166,7 +164,6 @@ const struct cmd_entry *cmd_table[] = {
|
|||||||
&cmd_lock_client_entry,
|
&cmd_lock_client_entry,
|
||||||
&cmd_lock_server_entry,
|
&cmd_lock_server_entry,
|
||||||
&cmd_lock_session_entry,
|
&cmd_lock_session_entry,
|
||||||
&cmd_float_pane_entry,
|
|
||||||
&cmd_hide_pane_entry,
|
&cmd_hide_pane_entry,
|
||||||
&cmd_move_pane_entry,
|
&cmd_move_pane_entry,
|
||||||
&cmd_move_window_entry,
|
&cmd_move_window_entry,
|
||||||
@@ -217,7 +214,6 @@ const struct cmd_entry *cmd_table[] = {
|
|||||||
&cmd_switch_client_entry,
|
&cmd_switch_client_entry,
|
||||||
&cmd_unbind_key_entry,
|
&cmd_unbind_key_entry,
|
||||||
&cmd_unlink_window_entry,
|
&cmd_unlink_window_entry,
|
||||||
&cmd_tile_pane_entry,
|
|
||||||
&cmd_wait_for_entry,
|
&cmd_wait_for_entry,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|||||||
60
tmux.1
60
tmux.1
@@ -3159,47 +3159,6 @@ zooms the pane.
|
|||||||
The
|
The
|
||||||
.Ic find-window
|
.Ic find-window
|
||||||
command works only if at least one client is attached.
|
command works only if at least one client is attached.
|
||||||
.Tg floatp
|
|
||||||
.It Xo Ic float\-pane
|
|
||||||
.Op Fl d
|
|
||||||
.Op Fl x Ar width
|
|
||||||
.Op Fl y Ar height
|
|
||||||
.Op Fl X Ar x\-position
|
|
||||||
.Op Fl y Ar y\-position
|
|
||||||
.Op Fl t Ar target\-pane
|
|
||||||
.Xc
|
|
||||||
.D1 Pq alias: Ic floatp
|
|
||||||
Lift
|
|
||||||
.Ar target\-pane
|
|
||||||
out of the tiled layout and make it floating.
|
|
||||||
The
|
|
||||||
.Fl x
|
|
||||||
and
|
|
||||||
.Fl y
|
|
||||||
options set the width and height of the floating pane in columns and lines
|
|
||||||
respectively.
|
|
||||||
The default is half the window width and a quarter the window height.
|
|
||||||
The
|
|
||||||
.Fl X
|
|
||||||
and
|
|
||||||
.Fl Y
|
|
||||||
options set the position of the upper-left corner of the pane.
|
|
||||||
If omitted, new floating panes are cascaded from the top-left of the window.
|
|
||||||
.Pp
|
|
||||||
If the pane had previously been floating, the position and sizes are restored
|
|
||||||
from the saved values not specified by the
|
|
||||||
.Fl x ,
|
|
||||||
.Fl y ,
|
|
||||||
.Fl X ,
|
|
||||||
and
|
|
||||||
.Fl Y
|
|
||||||
options.
|
|
||||||
.Pp
|
|
||||||
If
|
|
||||||
.Fl d
|
|
||||||
is given, the active pane is not changed.
|
|
||||||
The pane must not already be floating or hidden, and the window must not
|
|
||||||
be zoomed.
|
|
||||||
.Tg joinp
|
.Tg joinp
|
||||||
.It Xo Ic join\-pane
|
.It Xo Ic join\-pane
|
||||||
.Op Fl bdfhv
|
.Op Fl bdfhv
|
||||||
@@ -4133,25 +4092,6 @@ is omitted and a marked pane is present (see
|
|||||||
.Ic select\-pane
|
.Ic select\-pane
|
||||||
.Fl m ) ,
|
.Fl m ) ,
|
||||||
the window containing the marked pane is used rather than the current window.
|
the window containing the marked pane is used rather than the current window.
|
||||||
.Tg tilep
|
|
||||||
.It Xo Ic tile\-pane
|
|
||||||
.Op Fl d
|
|
||||||
.Op Fl t Ar target\-pane
|
|
||||||
.Xc
|
|
||||||
.D1 Pq alias: Ic tilep
|
|
||||||
Return a floating
|
|
||||||
.Ar target\-pane
|
|
||||||
back to the tiled layout.
|
|
||||||
The location in the layout is preserved.
|
|
||||||
Half the space from the nearest tiled pane in the layout is given to
|
|
||||||
.Ar target\-pane .
|
|
||||||
The floating position and sizes are saved so they can be restored by future
|
|
||||||
calls to
|
|
||||||
.Ic float\-pane .
|
|
||||||
If
|
|
||||||
.Fl d
|
|
||||||
is given, the active pane is not changed.
|
|
||||||
The pane must be floating, not hidden, and the window must not be zoomed.
|
|
||||||
.Tg showp
|
.Tg showp
|
||||||
.It Xo Ic show\-pane
|
.It Xo Ic show\-pane
|
||||||
.Op Fl t Ar target\-pane
|
.Op Fl t Ar target\-pane
|
||||||
|
|||||||
Reference in New Issue
Block a user