aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-07-27 14:51:39 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-07-27 14:51:39 +0000
commit5c20069588b69298573f4f94fcf6da85411dba94 (patch)
tree8788fb7e264db27de7f75caac475ab960e2f009c
parentrender: scrollback indicator: render relative indicator "smoothly" (diff)
parentdoc: foot.5: modifiers+keys are plural (diff)
Merge branch 'master' into scrollback-position-indicator
-rw-r--r--CHANGELOG.md9
-rw-r--r--doc/foot.5.scd2
-rw-r--r--input.c2
-rw-r--r--selection.c16
-rw-r--r--tokenize.c16
5 files changed, 32 insertions, 13 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fd2b1d79..5ad71078 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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.
diff --git a/doc/foot.5.scd b/doc/foot.5.scd
index 1202e203..188e8edf 100644
--- a/doc/foot.5.scd
+++ b/doc/foot.5.scd
@@ -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 -
diff --git a/input.c b/input.c
index fbf6b517..67661eee 100644
--- a/input.c
+++ b/input.c
@@ -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)
diff --git a/selection.c b/selection.c
index 3b8c1969..ffe06c27 100644
--- a/selection.c
+++ b/selection.c
@@ -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};
}
}
diff --git a/tokenize.c b/tokenize.c
index b4aab6b5..35d52345 100644
--- a/tokenize.c
+++ b/tokenize.c
@@ -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))