mirror of
https://github.com/tmate-io/tmate.git
synced 2025-01-23 14:28:55 +01:00
Whitespace nits, from Ben Boeckel.
This commit is contained in:
parent
f884fff869
commit
7af5fec038
13
mode-key.c
13
mode-key.c
@ -35,9 +35,7 @@
|
||||
*
|
||||
* vi command mode is handled by having a mode flag in the struct which allows
|
||||
* two sets of bindings to be swapped between. A couple of editing commands
|
||||
* (MODEKEYEDIT_SWITCHMODE, MODEKEYEDIT_SWITCHMODEAPPEND,
|
||||
* MODEKEYEDIT_SWITCHMODEAPPENDLINE, and MODEKEYEDIT_SWITCHMODEBEGINLINE)
|
||||
* are special-cased to do this.
|
||||
* (any matching MODEKEYEDIT_SWITCHMODE*) are special-cased to do this.
|
||||
*/
|
||||
|
||||
/* Edit keys command strings. */
|
||||
@ -67,6 +65,9 @@ const struct mode_key_cmdstr mode_key_cmdstr_edit[] = {
|
||||
{ MODEKEYEDIT_SWITCHMODEAPPEND, "switch-mode-append" },
|
||||
{ MODEKEYEDIT_SWITCHMODEAPPENDLINE, "switch-mode-append-line" },
|
||||
{ MODEKEYEDIT_SWITCHMODEBEGINLINE, "switch-mode-begin-line" },
|
||||
{ MODEKEYEDIT_SWITCHMODECHANGELINE, "switch-mode-change-line" },
|
||||
{ MODEKEYEDIT_SWITCHMODESUBSTITUTE, "switch-mode-substitute" },
|
||||
{ MODEKEYEDIT_SWITCHMODESUBSTITUTELINE, "switch-mode-substitute-line" },
|
||||
{ MODEKEYEDIT_TRANSPOSECHARS, "transpose-chars" },
|
||||
|
||||
{ 0, NULL }
|
||||
@ -166,9 +167,11 @@ const struct mode_key_entry mode_key_vi_edit[] = {
|
||||
{ '0', 1, MODEKEYEDIT_STARTOFLINE },
|
||||
{ 'A', 1, MODEKEYEDIT_SWITCHMODEAPPENDLINE },
|
||||
{ 'B', 1, MODEKEYEDIT_PREVIOUSSPACE },
|
||||
{ 'C', 1, MODEKEYEDIT_SWITCHMODECHANGELINE },
|
||||
{ 'D', 1, MODEKEYEDIT_DELETETOENDOFLINE },
|
||||
{ 'E', 1, MODEKEYEDIT_NEXTSPACEEND },
|
||||
{ 'I', 1, MODEKEYEDIT_SWITCHMODEBEGINLINE },
|
||||
{ 'S', 1, MODEKEYEDIT_SWITCHMODESUBSTITUTELINE },
|
||||
{ 'W', 1, MODEKEYEDIT_NEXTSPACE },
|
||||
{ 'X', 1, MODEKEYEDIT_BACKSPACE },
|
||||
{ '\003' /* C-c */, 1, MODEKEYEDIT_CANCEL },
|
||||
@ -185,6 +188,7 @@ const struct mode_key_entry mode_key_vi_edit[] = {
|
||||
{ 'k', 1, MODEKEYEDIT_HISTORYUP },
|
||||
{ 'l', 1, MODEKEYEDIT_CURSORRIGHT },
|
||||
{ 'p', 1, MODEKEYEDIT_PASTE },
|
||||
{ 's', 1, MODEKEYEDIT_SWITCHMODESUBSTITUTE },
|
||||
{ 'w', 1, MODEKEYEDIT_NEXTWORD },
|
||||
{ 'x', 1, MODEKEYEDIT_DELETE },
|
||||
{ KEYC_BSPACE, 1, MODEKEYEDIT_BACKSPACE },
|
||||
@ -545,6 +549,9 @@ mode_key_lookup(struct mode_key_data *mdata, int key, const char **arg)
|
||||
case MODEKEYEDIT_SWITCHMODEAPPEND:
|
||||
case MODEKEYEDIT_SWITCHMODEAPPENDLINE:
|
||||
case MODEKEYEDIT_SWITCHMODEBEGINLINE:
|
||||
case MODEKEYEDIT_SWITCHMODECHANGELINE:
|
||||
case MODEKEYEDIT_SWITCHMODESUBSTITUTE:
|
||||
case MODEKEYEDIT_SWITCHMODESUBSTITUTELINE:
|
||||
mdata->mode = 1 - mdata->mode;
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
|
13
status.c
13
status.c
@ -142,10 +142,8 @@ status_set_window_at(struct client *c, u_int x)
|
||||
|
||||
x += c->wlmouse;
|
||||
RB_FOREACH(wl, winlinks, &s->windows) {
|
||||
if (x < wl->status_width &&
|
||||
session_select(s, wl->idx) == 0) {
|
||||
if (x < wl->status_width && session_select(s, wl->idx) == 0)
|
||||
server_redraw_session(s);
|
||||
}
|
||||
x -= wl->status_width + 1;
|
||||
}
|
||||
}
|
||||
@ -938,6 +936,7 @@ status_prompt_redraw(struct client *c)
|
||||
off = 0;
|
||||
|
||||
memcpy(&gc, &grid_default_cell, sizeof gc);
|
||||
|
||||
/* Change colours for command mode. */
|
||||
if (c->prompt_mdata.mode == 1) {
|
||||
colour_set_fg(&gc, options_get_number(&s->options, "message-command-fg"));
|
||||
@ -1099,6 +1098,7 @@ status_prompt_key(struct client *c, int key)
|
||||
}
|
||||
break;
|
||||
case MODEKEYEDIT_DELETE:
|
||||
case MODEKEYEDIT_SWITCHMODESUBSTITUTE:
|
||||
if (c->prompt_index != size) {
|
||||
memmove(c->prompt_buffer + c->prompt_index,
|
||||
c->prompt_buffer + c->prompt_index + 1,
|
||||
@ -1107,11 +1107,13 @@ status_prompt_key(struct client *c, int key)
|
||||
}
|
||||
break;
|
||||
case MODEKEYEDIT_DELETELINE:
|
||||
case MODEKEYEDIT_SWITCHMODESUBSTITUTELINE:
|
||||
*c->prompt_buffer = '\0';
|
||||
c->prompt_index = 0;
|
||||
c->flags |= CLIENT_STATUS;
|
||||
break;
|
||||
case MODEKEYEDIT_DELETETOENDOFLINE:
|
||||
case MODEKEYEDIT_SWITCHMODECHANGELINE:
|
||||
if (c->prompt_index < size) {
|
||||
c->prompt_buffer[c->prompt_index] = '\0';
|
||||
c->flags |= CLIENT_STATUS;
|
||||
@ -1190,6 +1192,11 @@ status_prompt_key(struct client *c, int key)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Back up to the end-of-word like vi. */
|
||||
if (options_get_number(oo, "status-keys") == MODEKEY_VI &&
|
||||
c->prompt_index != 0)
|
||||
c->prompt_index--;
|
||||
|
||||
c->flags |= CLIENT_STATUS;
|
||||
break;
|
||||
case MODEKEYEDIT_PREVIOUSSPACE:
|
||||
|
@ -1894,6 +1894,7 @@ void
|
||||
window_copy_cursor_next_word_end(struct window_pane *wp, const char *separators)
|
||||
{
|
||||
struct window_copy_mode_data *data = wp->modedata;
|
||||
struct options *oo = &wp->window->options;
|
||||
struct screen *back_s = data->backing;
|
||||
u_int px, py, xx, yy;
|
||||
int expected = 1;
|
||||
@ -1927,6 +1928,10 @@ window_copy_cursor_next_word_end(struct window_pane *wp, const char *separators)
|
||||
expected = !expected;
|
||||
} while (expected == 0);
|
||||
|
||||
/* Back up to the end-of-word like vi. */
|
||||
if (options_get_number(oo, "status-keys") == MODEKEY_VI && px != 0)
|
||||
px--;
|
||||
|
||||
window_copy_update_cursor(wp, px, data->cy);
|
||||
if (window_copy_update_selection(wp))
|
||||
window_copy_redraw_lines(wp, data->cy, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user