diff --git a/Makefile.am b/Makefile.am index 8fcbdd0c..e20a8d62 100644 --- a/Makefile.am +++ b/Makefile.am @@ -150,7 +150,6 @@ dist_tmux_SOURCES = \ cmd-source-file.c \ cmd-split-window.c \ cmd-swap-pane.c \ - cmd-tile-float-pane.c \ cmd-swap-window.c \ cmd-switch-client.c \ cmd-unbind-key.c \ diff --git a/cmd-tile-float-pane.c b/cmd-tile-float-pane.c deleted file mode 100644 index e64000ff..00000000 --- a/cmd-tile-float-pane.c +++ /dev/null @@ -1,154 +0,0 @@ -/* $OpenBSD$ */ - -/* - * Copyright (c) 2026 Michael Grant - * - * 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 - -#include -#include - -#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); -} diff --git a/cmd.c b/cmd.c index 3c812c8f..ea1b3ea4 100644 --- a/cmd.c +++ b/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_server_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_move_pane_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_unbind_key_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; const struct cmd_entry *cmd_table[] = { @@ -166,7 +164,6 @@ const struct cmd_entry *cmd_table[] = { &cmd_lock_client_entry, &cmd_lock_server_entry, &cmd_lock_session_entry, - &cmd_float_pane_entry, &cmd_hide_pane_entry, &cmd_move_pane_entry, &cmd_move_window_entry, @@ -217,7 +214,6 @@ const struct cmd_entry *cmd_table[] = { &cmd_switch_client_entry, &cmd_unbind_key_entry, &cmd_unlink_window_entry, - &cmd_tile_pane_entry, &cmd_wait_for_entry, NULL }; diff --git a/tmux.1 b/tmux.1 index bc3a52da..7b3d8794 100644 --- a/tmux.1 +++ b/tmux.1 @@ -3159,47 +3159,6 @@ zooms the pane. The .Ic find-window 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 .It Xo Ic join\-pane .Op Fl bdfhv @@ -4133,25 +4092,6 @@ is omitted and a marked pane is present (see .Ic select\-pane .Fl m ) , 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 .It Xo Ic show\-pane .Op Fl t Ar target\-pane