Merge branch 'master' into scrollback-position-indicator

This commit is contained in:
Daniel Eklöf 2020-07-27 16:51:39 +02:00
commit 5c20069588
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
5 changed files with 32 additions and 13 deletions

View file

@ -18,6 +18,8 @@
* [LICENSE](LICENSE), [README.md](README.md) and
[CHANGELOG.md](CHANGELOG.md) are now installed to
`${datadir}/doc/foot`.
* Support for escaping quotes in **pipe-visible** and
**pipe-scrollback** commands.
### Changed
@ -35,6 +37,8 @@
outside it.
* Scrollback search to focus match, that requires a viewport change,
roughly in the center of the screen.
* Extending a selection with the right mouse button now works while
dragging the mouse.
* Mouse cursor is now always a `left_ptr` when inside the margins, to
indicate it is not possible to start a selection.
* Scrollback position indicator. This feature is optional and
@ -46,7 +50,10 @@
### Removed
### Fixed
* Crash in scrollback search
* Crash in scrollback search.
* Crash when a **pipe-visible** or **pipe-scrollback** command
contained an unclosed quote
(https://codeberg.org/dnkl/foot/issues/49).
* Crash when starting a selection inside the margins.

View file

@ -189,7 +189,7 @@ This section lets you override the default key bindings.
The general format is _action=combo1...comboN_. That is, each action
may have one or more key combinations, space separated. Each
combination is on the form _mod1+mod2+key_. The names of the modifiers
and the key *must* be a valid XKB key name.
and the key *must* be valid XKB key names.
Note that if *Shift* is one of the modifiers, the _key_ *must* be in
upper case. For example, *Control+Shift+v* will never trigger -

View file

@ -1187,7 +1187,7 @@ wl_pointer_motion(void *data, struct wl_pointer *wl_pointer,
if (seat->mouse.col < 0 || seat->mouse.row < 0)
break;
bool update_selection = seat->mouse.button == BTN_LEFT;
bool update_selection = seat->mouse.button == BTN_LEFT || seat->mouse.button == BTN_RIGHT;
bool update_selection_early = term->selection.end.row == -1;
if (update_selection && update_selection_early)

View file

@ -373,8 +373,8 @@ selection_extend_normal(struct terminal *term, int col, int row, uint32_t serial
if (row < start->row || (row == start->row && col < start->col)) {
/* Extend selection to start *before* current start */
new_start = (struct coord){col, row};
new_end = *end;
new_start = *end;
new_end = (struct coord){col, row};
}
else if (row > end->row || (row == end->row && col > end->col)) {
@ -392,8 +392,8 @@ selection_extend_normal(struct terminal *term, int col, int row, uint32_t serial
abs(linear - (end->row * term->cols + end->col)))
{
/* Move start point */
new_start = (struct coord){col, row};
new_end = *end;
new_start = *end;
new_end = (struct coord){col, row};
}
else {
@ -441,13 +441,13 @@ selection_extend_block(struct terminal *term, int col, int row, uint32_t serial)
/* Move one of the top corners */
if (abs(col - top_left.col) < abs(col - top_right.col)) {
new_start = (struct coord){col, row};
new_end = bottom_right;
new_start = bottom_right;
new_end = (struct coord){col, row};
}
else {
new_start = (struct coord){col, row};
new_end = bottom_left;
new_start = bottom_left;
new_end = (struct coord){col, row};
}
}

View file

@ -38,14 +38,16 @@ tokenize_cmdline(char *cmdline, char ***argv)
char delim = first_token_is_quoted ? cmdline[0] : ' ';
char *p = first_token_is_quoted ? &cmdline[1] : &cmdline[0];
char *search_start = p;
size_t idx = 0;
while (*p != '\0') {
char *end = strchr(p, delim);
char *end = strchr(search_start, delim);
if (end == NULL) {
if (delim != ' ') {
LOG_ERR("unterminated %s quote\n", delim == '"' ? "double" : "single");
LOG_ERR("unterminated %s quote", delim == '"' ? "double" : "single");
free(*argv);
*argv = NULL;
return false;
}
@ -57,6 +59,15 @@ tokenize_cmdline(char *cmdline, char ***argv)
return true;
}
if (end > p && *(end - 1) == '\\') {
/* Escaped quote, remove one level of escaping and
* continue searching for "our" closing quote */
memmove(end - 1, end, strlen(end));
end[strlen(end) - 1] = '\0';
search_start = end;
continue;
}
*end = '\0';
if (!push_argv(argv, &argv_size, p, &idx))
@ -74,6 +85,7 @@ tokenize_cmdline(char *cmdline, char ***argv)
p++;
} else
delim = ' ';
search_start = p;
}
if (!push_argv(argv, &argv_size, NULL, &idx))