mirror of
https://github.com/tmux/tmux.git
synced 2024-12-25 02:48:47 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
b29028a914
@ -301,6 +301,7 @@ server_client_lost(struct client *c)
|
|||||||
free(msg);
|
free(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(c->prompt_saved);
|
||||||
free(c->prompt_string);
|
free(c->prompt_string);
|
||||||
free(c->prompt_buffer);
|
free(c->prompt_buffer);
|
||||||
|
|
||||||
|
44
status.c
44
status.c
@ -766,6 +766,9 @@ status_prompt_clear(struct client *c)
|
|||||||
free(c->prompt_buffer);
|
free(c->prompt_buffer);
|
||||||
c->prompt_buffer = NULL;
|
c->prompt_buffer = NULL;
|
||||||
|
|
||||||
|
free(c->prompt_saved);
|
||||||
|
c->prompt_saved = NULL;
|
||||||
|
|
||||||
c->tty.flags &= ~(TTY_NOCURSOR|TTY_FREEZE);
|
c->tty.flags &= ~(TTY_NOCURSOR|TTY_FREEZE);
|
||||||
c->flags |= CLIENT_ALLREDRAWFLAGS; /* was frozen and may have changed */
|
c->flags |= CLIENT_ALLREDRAWFLAGS; /* was frozen and may have changed */
|
||||||
|
|
||||||
@ -1217,6 +1220,12 @@ process_key:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(c->prompt_saved);
|
||||||
|
c->prompt_saved = xcalloc(sizeof *c->prompt_buffer,
|
||||||
|
(c->prompt_index - idx) + 1);
|
||||||
|
memcpy(c->prompt_saved, c->prompt_buffer + idx,
|
||||||
|
(c->prompt_index - idx) * sizeof *c->prompt_buffer);
|
||||||
|
|
||||||
memmove(c->prompt_buffer + idx,
|
memmove(c->prompt_buffer + idx,
|
||||||
c->prompt_buffer + c->prompt_index,
|
c->prompt_buffer + c->prompt_index,
|
||||||
(size + 1 - c->prompt_index) *
|
(size + 1 - c->prompt_index) *
|
||||||
@ -1290,22 +1299,28 @@ process_key:
|
|||||||
c->prompt_index = utf8_strlen(c->prompt_buffer);
|
c->prompt_index = utf8_strlen(c->prompt_buffer);
|
||||||
goto changed;
|
goto changed;
|
||||||
case '\031': /* C-y */
|
case '\031': /* C-y */
|
||||||
if ((pb = paste_get_top(NULL)) == NULL)
|
if (c->prompt_saved != NULL) {
|
||||||
break;
|
ud = c->prompt_saved;
|
||||||
bufdata = paste_buffer_data(pb, &bufsize);
|
n = utf8_strlen(c->prompt_saved);
|
||||||
for (n = 0; n < bufsize; n++) {
|
} else {
|
||||||
ch = (u_char)bufdata[n];
|
if ((pb = paste_get_top(NULL)) == NULL)
|
||||||
if (ch < 32 || ch >= 127)
|
|
||||||
break;
|
break;
|
||||||
|
bufdata = paste_buffer_data(pb, &bufsize);
|
||||||
|
for (n = 0; n < bufsize; n++) {
|
||||||
|
ch = (u_char)bufdata[n];
|
||||||
|
if (ch < 32 || ch >= 127)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ud = xreallocarray(NULL, n, sizeof *ud);
|
||||||
|
for (idx = 0; idx < n; idx++)
|
||||||
|
utf8_set(&ud[idx], bufdata[idx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
c->prompt_buffer = xreallocarray(c->prompt_buffer, size + n + 1,
|
c->prompt_buffer = xreallocarray(c->prompt_buffer, size + n + 1,
|
||||||
sizeof *c->prompt_buffer);
|
sizeof *c->prompt_buffer);
|
||||||
if (c->prompt_index == size) {
|
if (c->prompt_index == size) {
|
||||||
for (idx = 0; idx < n; idx++) {
|
memcpy(c->prompt_buffer + c->prompt_index, ud,
|
||||||
ud = &c->prompt_buffer[c->prompt_index + idx];
|
n * sizeof *c->prompt_buffer);
|
||||||
utf8_set(ud, bufdata[idx]);
|
|
||||||
}
|
|
||||||
c->prompt_index += n;
|
c->prompt_index += n;
|
||||||
c->prompt_buffer[c->prompt_index].size = 0;
|
c->prompt_buffer[c->prompt_index].size = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -1313,12 +1328,13 @@ process_key:
|
|||||||
c->prompt_buffer + c->prompt_index,
|
c->prompt_buffer + c->prompt_index,
|
||||||
(size + 1 - c->prompt_index) *
|
(size + 1 - c->prompt_index) *
|
||||||
sizeof *c->prompt_buffer);
|
sizeof *c->prompt_buffer);
|
||||||
for (idx = 0; idx < n; idx++) {
|
memcpy(c->prompt_buffer + c->prompt_index, ud,
|
||||||
ud = &c->prompt_buffer[c->prompt_index + idx];
|
n * sizeof *c->prompt_buffer);
|
||||||
utf8_set(ud, bufdata[idx]);
|
|
||||||
}
|
|
||||||
c->prompt_index += n;
|
c->prompt_index += n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ud != c->prompt_saved)
|
||||||
|
free(ud);
|
||||||
goto changed;
|
goto changed;
|
||||||
case '\024': /* C-t */
|
case '\024': /* C-t */
|
||||||
idx = c->prompt_index;
|
idx = c->prompt_index;
|
||||||
|
1
tmux.h
1
tmux.h
@ -1384,6 +1384,7 @@ struct client {
|
|||||||
void *prompt_data;
|
void *prompt_data;
|
||||||
u_int prompt_hindex;
|
u_int prompt_hindex;
|
||||||
enum { PROMPT_ENTRY, PROMPT_COMMAND } prompt_mode;
|
enum { PROMPT_ENTRY, PROMPT_COMMAND } prompt_mode;
|
||||||
|
struct utf8_data *prompt_saved;
|
||||||
|
|
||||||
#define PROMPT_SINGLE 0x1
|
#define PROMPT_SINGLE 0x1
|
||||||
#define PROMPT_NUMERIC 0x2
|
#define PROMPT_NUMERIC 0x2
|
||||||
|
Loading…
Reference in New Issue
Block a user