mirror of
https://github.com/tmux/tmux.git
synced 2025-04-12 12:08:48 +00:00
Add flag to next-prompt/previous-prompt to go to command output instead,
from Magnus Gross.
This commit is contained in:
parent
dee72ed41f
commit
7a44984069
3
input.c
3
input.c
@ -2756,6 +2756,9 @@ input_osc_133(struct input_ctx *ictx, const char *p)
|
||||
case 'A':
|
||||
gl->flags |= GRID_LINE_START_PROMPT;
|
||||
break;
|
||||
case 'C':
|
||||
gl->flags |= GRID_LINE_START_OUTPUT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
107
tmux.1
107
tmux.1
@ -1782,29 +1782,35 @@ Exit copy mode.
|
||||
.Xc
|
||||
Clear the current selection.
|
||||
.It Xo
|
||||
.Ic copy-end-of-line [<prefix>]
|
||||
.Ic copy-end-of-line
|
||||
.Op Ar prefix
|
||||
.Xc
|
||||
Copy from the cursor position to the end of the line.
|
||||
.Ar prefix
|
||||
is used to name the new paste buffer.
|
||||
.It Xo
|
||||
.Ic copy-end-of-line-and-cancel [<prefix>]
|
||||
.Ic copy-end-of-line-and-cancel
|
||||
.Op Ar prefix
|
||||
.Xc
|
||||
Copy from the cursor position and exit copy mode.
|
||||
.It Xo
|
||||
.Ic copy-line [<prefix>]
|
||||
.Ic copy-line
|
||||
.Op Ar prefix
|
||||
.Xc
|
||||
Copy the entire line.
|
||||
.It Xo
|
||||
.Ic copy-line-and-cancel [<prefix>]
|
||||
.Ic copy-line-and-cancel
|
||||
.Op Ar prefix
|
||||
.Xc
|
||||
Copy the entire line and exit copy mode.
|
||||
.It Xo
|
||||
.Ic copy-selection [<prefix>]
|
||||
.Ic copy-selection
|
||||
.Op Ar prefix
|
||||
.Xc
|
||||
Copies the current selection.
|
||||
.It Xo
|
||||
.Ic copy-selection-and-cancel [<prefix>]
|
||||
.Ic copy-selection-and-cancel
|
||||
.Op Ar prefix
|
||||
(vi: Enter)
|
||||
(emacs: M-w)
|
||||
.Xc
|
||||
@ -1840,7 +1846,8 @@ Move the cursor up.
|
||||
.Xc
|
||||
Move the cursor to the end of the line.
|
||||
.It Xo
|
||||
.Ic goto-line <line>
|
||||
.Ic goto-line
|
||||
.Ar line
|
||||
(vi: :)
|
||||
(emacs: g)
|
||||
.Xc
|
||||
@ -1864,13 +1871,15 @@ Scroll to the top of the history.
|
||||
.Xc
|
||||
Repeat the last jump.
|
||||
.It Xo
|
||||
.Ic jump-backward <to>
|
||||
.Ic jump-backward
|
||||
.Ar to
|
||||
(vi: F)
|
||||
(emacs: F)
|
||||
.Xc
|
||||
Jump backwards to the specified text.
|
||||
.It Xo
|
||||
.Ic jump-forward <to>
|
||||
.Ic jump-forward
|
||||
.Ar to
|
||||
(vi: f)
|
||||
(emacs: f)
|
||||
.Xc
|
||||
@ -1901,6 +1910,7 @@ Move to the next matching bracket.
|
||||
Move to the next paragraph.
|
||||
.It Xo
|
||||
.Ic next-prompt
|
||||
.Op Fl o
|
||||
.Xc
|
||||
Move to the next prompt.
|
||||
.It Xo
|
||||
@ -1933,6 +1943,7 @@ Move to the previous matching bracket.
|
||||
Move to the previous paragraph.
|
||||
.It Xo
|
||||
.Ic previous-prompt
|
||||
.Op Fl o
|
||||
.Xc
|
||||
Move to the previous prompt.
|
||||
.It Xo
|
||||
@ -1960,12 +1971,14 @@ Refresh the content from the pane.
|
||||
.Xc
|
||||
Repeat the last search.
|
||||
.It Xo
|
||||
.Ic search-backward <for>
|
||||
.Ic search-backward
|
||||
.Ar text
|
||||
(vi: ?)
|
||||
.Xc
|
||||
Search backwards for the specified text.
|
||||
.It Xo
|
||||
.Ic search-forward <for>
|
||||
.Ic search-forward
|
||||
.Ar text
|
||||
(vi: /)
|
||||
.Xc
|
||||
Search forward for the specified text.
|
||||
@ -2033,6 +2046,9 @@ move between shell prompts, but require the shell to emit an escape sequence
|
||||
.Nm
|
||||
where the prompts are located; if the shell does not do this, these commands
|
||||
will do nothing.
|
||||
The
|
||||
.Fl o
|
||||
flag jumps to the beginning of the command output instead of the shell prompt.
|
||||
.Pp
|
||||
Copy commands may take an optional buffer prefix argument which is used
|
||||
to generate the buffer name (the default is
|
||||
@ -4073,6 +4089,26 @@ The default is to run
|
||||
.Xr lock 1
|
||||
with
|
||||
.Fl np .
|
||||
.It Ic menu-style Ar style
|
||||
Set the menu style.
|
||||
See the
|
||||
.Sx STYLES
|
||||
section on how to specify
|
||||
.Ar style .
|
||||
Attributes are ignored.
|
||||
.It Ic menu-border-style Ar style
|
||||
Set the menu border style.
|
||||
See the
|
||||
.Sx STYLES
|
||||
section on how to specify
|
||||
.Ar style .
|
||||
Attributes are ignored.
|
||||
.It Ic menu-border-lines Ar type
|
||||
Set the type of characters used for drawing menu borders.
|
||||
See
|
||||
.Ic popup-border-lines
|
||||
for possible values for
|
||||
.Ar type .
|
||||
.It Ic message-command-style Ar style
|
||||
Set status line message command style.
|
||||
This is used for the command prompt with
|
||||
@ -4540,20 +4576,18 @@ Attributes are ignored.
|
||||
.Pp
|
||||
.It Ic popup-style Ar style
|
||||
Set the popup style.
|
||||
For how to specify
|
||||
.Ar style ,
|
||||
see the
|
||||
See the
|
||||
.Sx STYLES
|
||||
section.
|
||||
section on how to specify
|
||||
.Ar style .
|
||||
Attributes are ignored.
|
||||
.Pp
|
||||
.It Ic popup-border-style Ar style
|
||||
Set the popup border style.
|
||||
For how to specify
|
||||
.Ar style ,
|
||||
see the
|
||||
See the
|
||||
.Sx STYLES
|
||||
section.
|
||||
section on how to specify
|
||||
.Ar style .
|
||||
Attributes are ignored.
|
||||
.Pp
|
||||
.It Ic popup-border-lines Ar type
|
||||
@ -6028,9 +6062,12 @@ the default is
|
||||
.Tg menu
|
||||
.It Xo Ic display-menu
|
||||
.Op Fl O
|
||||
.Op Fl b Ar border-lines
|
||||
.Op Fl c Ar target-client
|
||||
.Op Fl s Ar style
|
||||
.Op Fl S Ar border-style
|
||||
.Op Fl t Ar target-pane
|
||||
.Op Fl S Ar starting-choice
|
||||
.Op Fl C Ar starting-choice
|
||||
.Op Fl T Ar title
|
||||
.Op Fl x Ar position
|
||||
.Op Fl y Ar position
|
||||
@ -6057,10 +6094,24 @@ may not be chosen.
|
||||
The name may be empty for a separator line, in which case both the key and
|
||||
command should be omitted.
|
||||
.Pp
|
||||
.Fl b
|
||||
sets the type of characters used for drawing menu borders.
|
||||
See
|
||||
.Ic popup-border-lines
|
||||
for possible values for
|
||||
.Ar border-lines .
|
||||
.Pp
|
||||
.Fl s
|
||||
sets the style for the menu and
|
||||
.Fl S
|
||||
sets the style for the menu border (see
|
||||
.Sx STYLES ) .
|
||||
.Pp
|
||||
.Fl T
|
||||
is a format for the menu title (see
|
||||
.Sx FORMATS ) .
|
||||
.Fl S
|
||||
.Pp
|
||||
.Fl C
|
||||
sets the menu item selected by default, if the menu is not bound to a mouse key
|
||||
binding.
|
||||
.Pp
|
||||
@ -6175,8 +6226,8 @@ forwards any input read from stdin to the empty pane given by
|
||||
.Op Fl d Ar start-directory
|
||||
.Op Fl e Ar environment
|
||||
.Op Fl h Ar height
|
||||
.Op Fl s Ar style
|
||||
.Op Fl S Ar border-style
|
||||
.Op Fl s Ar border-style
|
||||
.Op Fl S Ar style
|
||||
.Op Fl t Ar target-pane
|
||||
.Op Fl T Ar title
|
||||
.Op Fl w Ar width
|
||||
@ -6219,7 +6270,7 @@ If omitted, half of the terminal size is used.
|
||||
does not surround the popup by a border.
|
||||
.Pp
|
||||
.Fl b
|
||||
sets the type of border line for the popup.
|
||||
sets the type of characters used for drawing popup borders.
|
||||
When
|
||||
.Fl B
|
||||
is specified, the
|
||||
@ -6233,12 +6284,8 @@ for possible values for
|
||||
.Fl s
|
||||
sets the style for the popup and
|
||||
.Fl S
|
||||
sets the style for the popup border.
|
||||
For how to specify
|
||||
.Ar style ,
|
||||
see the
|
||||
.Sx STYLES
|
||||
section.
|
||||
sets the style for the popup border (see
|
||||
.Sx STYLES ) .
|
||||
.Pp
|
||||
.Fl e
|
||||
takes the form
|
||||
|
11
tmux.h
11
tmux.h
@ -672,6 +672,7 @@ struct colour_palette {
|
||||
#define GRID_LINE_EXTENDED 0x2
|
||||
#define GRID_LINE_DEAD 0x4
|
||||
#define GRID_LINE_START_PROMPT 0x8
|
||||
#define GRID_LINE_START_OUTPUT 0x10
|
||||
|
||||
/* Grid string flags. */
|
||||
#define GRID_STRING_WITH_SEQUENCES 0x1
|
||||
@ -3306,11 +3307,13 @@ void menu_add_item(struct menu *, const struct menu_item *,
|
||||
struct cmd_find_state *);
|
||||
void menu_free(struct menu *);
|
||||
struct menu_data *menu_prepare(struct menu *, int, int, struct cmdq_item *,
|
||||
u_int, u_int, struct client *, struct cmd_find_state *,
|
||||
menu_choice_cb, void *);
|
||||
u_int, u_int, struct client *, enum box_lines, const char *,
|
||||
const char *, struct cmd_find_state *, menu_choice_cb,
|
||||
void *);
|
||||
int menu_display(struct menu *, int, int, struct cmdq_item *,
|
||||
u_int, u_int, struct client *, struct cmd_find_state *,
|
||||
menu_choice_cb, void *);
|
||||
u_int, u_int, struct client *, enum box_lines, const char *,
|
||||
const char *, struct cmd_find_state *, menu_choice_cb,
|
||||
void *);
|
||||
struct screen *menu_mode_cb(struct client *, void *, u_int *, u_int *);
|
||||
void menu_check_cb(struct client *, void *, u_int, u_int, u_int,
|
||||
struct overlay_ranges *);
|
||||
|
@ -131,7 +131,8 @@ static void window_copy_cursor_previous_word_pos(struct window_mode_entry *,
|
||||
const char *, u_int *, u_int *);
|
||||
static void window_copy_cursor_previous_word(struct window_mode_entry *,
|
||||
const char *, int);
|
||||
static void window_copy_cursor_prompt(struct window_mode_entry *, int);
|
||||
static void window_copy_cursor_prompt(struct window_mode_entry *, int,
|
||||
const char *);
|
||||
static void window_copy_scroll_up(struct window_mode_entry *, u_int);
|
||||
static void window_copy_scroll_down(struct window_mode_entry *, u_int);
|
||||
static void window_copy_rectangle_set(struct window_mode_entry *, int);
|
||||
@ -2245,8 +2246,9 @@ static enum window_copy_cmd_action
|
||||
window_copy_cmd_next_prompt(struct window_copy_cmd_state *cs)
|
||||
{
|
||||
struct window_mode_entry *wme = cs->wme;
|
||||
const char *arg1 = args_string(cs->args, 1);
|
||||
|
||||
window_copy_cursor_prompt(wme, 1);
|
||||
window_copy_cursor_prompt(wme, 1, arg1);
|
||||
return (WINDOW_COPY_CMD_NOTHING);
|
||||
}
|
||||
|
||||
@ -2254,8 +2256,9 @@ static enum window_copy_cmd_action
|
||||
window_copy_cmd_previous_prompt(struct window_copy_cmd_state *cs)
|
||||
{
|
||||
struct window_mode_entry *wme = cs->wme;
|
||||
const char *arg1 = args_string(cs->args, 1);
|
||||
|
||||
window_copy_cursor_prompt(wme, 0);
|
||||
window_copy_cursor_prompt(wme, 0, arg1);
|
||||
return (WINDOW_COPY_CMD_NOTHING);
|
||||
}
|
||||
|
||||
@ -2721,7 +2724,7 @@ static const struct {
|
||||
},
|
||||
{ .command = "previous-prompt",
|
||||
.minargs = 0,
|
||||
.maxargs = 0,
|
||||
.maxargs = 1,
|
||||
.clear = WINDOW_COPY_CMD_CLEAR_ALWAYS,
|
||||
.f = window_copy_cmd_previous_prompt
|
||||
},
|
||||
@ -5389,14 +5392,20 @@ window_copy_cursor_previous_word(struct window_mode_entry *wme,
|
||||
}
|
||||
|
||||
static void
|
||||
window_copy_cursor_prompt(struct window_mode_entry *wme, int direction)
|
||||
window_copy_cursor_prompt(struct window_mode_entry *wme, int direction,
|
||||
const char *args)
|
||||
{
|
||||
struct window_copy_mode_data *data = wme->data;
|
||||
struct screen *s = data->backing;
|
||||
struct grid *gd = s->grid;
|
||||
u_int end_line;
|
||||
u_int line = gd->hsize - data->oy + data->cy;
|
||||
int add;
|
||||
int add, line_flag;
|
||||
|
||||
if (args != NULL && strcmp(args, "-o") == 0)
|
||||
line_flag = GRID_LINE_START_OUTPUT;
|
||||
else
|
||||
line_flag = GRID_LINE_START_PROMPT;
|
||||
|
||||
if (direction == 0) { /* up */
|
||||
add = -1;
|
||||
@ -5413,7 +5422,7 @@ window_copy_cursor_prompt(struct window_mode_entry *wme, int direction)
|
||||
return;
|
||||
line += add;
|
||||
|
||||
if (grid_get_line(gd, line)->flags & GRID_LINE_START_PROMPT)
|
||||
if (grid_get_line(gd, line)->flags & line_flag)
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user