From e6d1b6770c14e401fc131e9bfa5a5d2068b9211f Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 31 Mar 2020 16:53:23 +0000 Subject: [PATCH 1/3] Add non-regex search variants to avoid the performance cost for people with large histories or long lines. --- tmux.1 | 31 +++---------------------------- tmux.h | 9 +++------ 2 files changed, 6 insertions(+), 34 deletions(-) diff --git a/tmux.1 b/tmux.1 index e785cf8b..a3b2b0f8 100644 --- a/tmux.1 +++ b/tmux.1 @@ -565,18 +565,6 @@ Environment variables may be set by using the syntax for example .Ql HOME=/home/user . Variables set during parsing are added to the global environment. -A hidden variable may be set with -.Ql %hidden , -for example: -.Bd -literal -offset indent -%hidden MYVAR=42 -.Ed -.Pp -Hidden variables are not passed to the environment of processes created -by tmux. -See the -.Sx GLOBAL AND SESSION ENVIRONMENT -section. .Pp Commands may be parsed conditionally by surrounding them with .Ql %if , @@ -2273,7 +2261,7 @@ Rename the current window, or the window at if specified, to .Ar new-name . .It Xo Ic resize-pane -.Op Fl DLMRTUZ +.Op Fl DLMRUZ .Op Fl t Ar target-pane .Op Fl x Ar width .Op Fl y Ar height @@ -2312,9 +2300,6 @@ and unzoomed (its normal position in the layout). .Fl M begins mouse resizing (only valid if bound to a mouse key binding, see .Sx MOUSE SUPPORT ) . -.Pp T -trims all lines below the current cursor position and moves lines out of the -history to replace them. .It Xo Ic resize-window .Op Fl aADLRU .Op Fl t Ar target-window @@ -4723,16 +4708,10 @@ from inside, and the variable with the correct terminal setting of .Ql screen . .Pp -Variables in both session and global environments may be marked as hidden. -Hidden variables are not passed into the environment of new processes and -instead can only be used by tmux itself (for example in formats, see the -.Sx FORMATS -section). -.Pp Commands to alter and view the environment are: .Bl -tag -width Ds .It Xo Ic set-environment -.Op Fl hgru +.Op Fl gru .Op Fl t Ar target-session .Ar name Op Ar value .Xc @@ -4749,10 +4728,8 @@ flag unsets a variable. .Fl r indicates the variable is to be removed from the environment before starting a new process. -.Fl h -marks the variable as hidden. .It Xo Ic show-environment -.Op Fl hgs +.Op Fl gs .Op Fl t Ar target-session .Op Ar variable .Xc @@ -4769,8 +4746,6 @@ Variables removed from the environment are prefixed with If .Fl s is used, the output is formatted as a set of Bourne shell commands. -.Fl h -shows hidden variables (omitted by default). .El .Sh STATUS LINE .Nm diff --git a/tmux.h b/tmux.h index 53bbc222..20559144 100644 --- a/tmux.h +++ b/tmux.h @@ -1048,9 +1048,6 @@ struct environ_entry { char *name; char *value; - int flags; -#define ENVIRON_HIDDEN 0x1 - RB_ENTRY(environ_entry) entry; }; @@ -1960,10 +1957,10 @@ struct environ_entry *environ_first(struct environ *); struct environ_entry *environ_next(struct environ_entry *); void environ_copy(struct environ *, struct environ *); struct environ_entry *environ_find(struct environ *, const char *); -void printflike(4, 5) environ_set(struct environ *, const char *, int, - const char *, ...); +void printflike(3, 4) environ_set(struct environ *, const char *, const char *, + ...); void environ_clear(struct environ *, const char *); -void environ_put(struct environ *, const char *, int); +void environ_put(struct environ *, const char *); void environ_unset(struct environ *, const char *); void environ_update(struct options *, struct environ *, struct environ *); void environ_push(struct environ *); From e221ef203c8d21e6ef3f6847c076c915ba1d9788 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 31 Mar 2020 17:13:20 +0000 Subject: [PATCH 2/3] Add a -T flag to resize-pane to trim lines below the cursor, moving lines out of the history. GitHub issue 2134. --- tmux.1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tmux.1 b/tmux.1 index a3b2b0f8..b0fc5600 100644 --- a/tmux.1 +++ b/tmux.1 @@ -2261,7 +2261,7 @@ Rename the current window, or the window at if specified, to .Ar new-name . .It Xo Ic resize-pane -.Op Fl DLMRUZ +.Op Fl DLMRTUZ .Op Fl t Ar target-pane .Op Fl x Ar width .Op Fl y Ar height @@ -2300,6 +2300,9 @@ and unzoomed (its normal position in the layout). .Fl M begins mouse resizing (only valid if bound to a mouse key binding, see .Sx MOUSE SUPPORT ) . +.Pp T +trims all lines below the current cursor position and moves lines out of the +history to replace them. .It Xo Ic resize-window .Op Fl aADLRU .Op Fl t Ar target-window From 38f1546a667c014a77778f6dd91898dbf41b077f Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 31 Mar 2020 17:14:40 +0000 Subject: [PATCH 3/3] Add a way to mark environment variables as "hidden" so they can be used by tmux but are not passed into the environment of new panes. --- tmux.1 | 26 ++++++++++++++++++++++++-- tmux.h | 9 ++++++--- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/tmux.1 b/tmux.1 index b0fc5600..e785cf8b 100644 --- a/tmux.1 +++ b/tmux.1 @@ -565,6 +565,18 @@ Environment variables may be set by using the syntax for example .Ql HOME=/home/user . Variables set during parsing are added to the global environment. +A hidden variable may be set with +.Ql %hidden , +for example: +.Bd -literal -offset indent +%hidden MYVAR=42 +.Ed +.Pp +Hidden variables are not passed to the environment of processes created +by tmux. +See the +.Sx GLOBAL AND SESSION ENVIRONMENT +section. .Pp Commands may be parsed conditionally by surrounding them with .Ql %if , @@ -4711,10 +4723,16 @@ from inside, and the variable with the correct terminal setting of .Ql screen . .Pp +Variables in both session and global environments may be marked as hidden. +Hidden variables are not passed into the environment of new processes and +instead can only be used by tmux itself (for example in formats, see the +.Sx FORMATS +section). +.Pp Commands to alter and view the environment are: .Bl -tag -width Ds .It Xo Ic set-environment -.Op Fl gru +.Op Fl hgru .Op Fl t Ar target-session .Ar name Op Ar value .Xc @@ -4731,8 +4749,10 @@ flag unsets a variable. .Fl r indicates the variable is to be removed from the environment before starting a new process. +.Fl h +marks the variable as hidden. .It Xo Ic show-environment -.Op Fl gs +.Op Fl hgs .Op Fl t Ar target-session .Op Ar variable .Xc @@ -4749,6 +4769,8 @@ Variables removed from the environment are prefixed with If .Fl s is used, the output is formatted as a set of Bourne shell commands. +.Fl h +shows hidden variables (omitted by default). .El .Sh STATUS LINE .Nm diff --git a/tmux.h b/tmux.h index 20559144..53bbc222 100644 --- a/tmux.h +++ b/tmux.h @@ -1048,6 +1048,9 @@ struct environ_entry { char *name; char *value; + int flags; +#define ENVIRON_HIDDEN 0x1 + RB_ENTRY(environ_entry) entry; }; @@ -1957,10 +1960,10 @@ struct environ_entry *environ_first(struct environ *); struct environ_entry *environ_next(struct environ_entry *); void environ_copy(struct environ *, struct environ *); struct environ_entry *environ_find(struct environ *, const char *); -void printflike(3, 4) environ_set(struct environ *, const char *, const char *, - ...); +void printflike(4, 5) environ_set(struct environ *, const char *, int, + const char *, ...); void environ_clear(struct environ *, const char *); -void environ_put(struct environ *, const char *); +void environ_put(struct environ *, const char *, int); void environ_unset(struct environ *, const char *); void environ_update(struct options *, struct environ *, struct environ *); void environ_push(struct environ *);