Fabian Homborg
c4593828f4
commandline: Add --is-valid option ( #8142 )
...
* commandline: Add --is-valid option to query whether it's syntactically complete
This means querying when the commandline is in a state that it could
be executed. Because our `execute` bind function also inserts a
newline if it isn't.
One case that's not handled right now: `execute` also expands
abbreviations, those can technically make the commandline invalid
again.
Unfortunately we have no real way to *check* without doing the
replacement.
Also since abbreviations are only available in command position when
you _execute_ them the commandline will most likely be valid.
This is enough to make transient prompts work:
```fish
function reset-transient --on-event fish_postexec
set -g TRANSIENT 0
end
function maybe_execute
if commandline --is-valid
set -g TRANSIENT 1
commandline -f repaint
else
set -g TRANSIENT 0
end
commandline -f execute
end
bind \r maybe_execute
```
and then in `fish_prompt` react to $TRANSIENT being set to 1.
2021-08-14 11:29:22 +02:00
..
2020-05-29 20:53:44 +02:00
2020-10-04 12:39:32 +02:00
2021-05-08 12:12:56 +02:00
2020-02-23 23:41:16 -08:00
2021-03-26 19:32:14 +01:00
2020-02-19 17:00:35 -08:00
2021-02-28 20:56:23 +08:00
2021-06-23 20:51:20 +02:00
2020-02-19 17:00:35 -08:00
2020-03-09 19:24:38 +01:00
2020-04-04 10:44:53 +02:00
2020-02-19 17:00:35 -08:00
2020-02-19 17:00:35 -08:00
2021-07-23 18:00:57 +02:00
2020-04-18 10:40:48 +02:00
2020-09-04 16:55:09 +02:00
2021-08-14 11:29:22 +02:00
2021-07-23 19:29:16 +02:00
2020-02-19 17:00:35 -08:00
2020-03-09 19:24:38 +01:00
2021-02-02 08:35:38 +01:00
2020-04-18 10:40:48 +02:00
2020-04-18 10:40:48 +02:00
2020-03-21 15:31:25 +01:00
2020-08-26 18:29:03 +02:00
2020-02-19 17:00:35 -08:00
2020-04-04 10:44:53 +02:00
2020-04-04 10:44:53 +02:00
2020-03-21 13:21:38 +01:00
2020-02-19 17:00:35 -08:00
2020-02-19 17:00:35 -08:00
2020-02-23 23:41:16 -08:00
2021-02-28 20:56:23 +08:00
2020-10-10 21:49:33 +02:00
2020-09-18 16:53:59 +02:00
2020-09-06 11:15:54 +02:00
2021-07-14 18:56:19 +02:00
2020-10-26 19:25:41 +01:00
2020-10-28 17:44:45 +01:00
2020-12-28 19:39:27 +01:00
2020-12-14 19:36:18 +01:00
2020-06-30 23:45:41 +02:00
2020-04-19 07:06:31 +02:00
2020-06-06 22:52:13 +08:00
2020-02-19 17:00:35 -08:00
2020-10-02 19:02:10 +02:00
2020-02-19 17:00:35 -08:00
2021-01-03 15:15:57 +01:00
2020-10-02 23:45:38 +02:00
2020-10-28 17:44:45 +01:00
2020-04-04 10:44:53 +02:00
2020-10-02 23:45:38 +02:00
2021-07-27 23:00:23 +02:00
2020-04-04 10:44:53 +02:00
2020-03-21 13:20:34 +01:00
2021-05-28 20:49:57 +02:00
2021-07-11 23:03:39 +08:00
2021-05-19 19:09:46 +02:00
2020-03-21 15:31:25 +01:00
2020-08-04 21:44:26 +02:00
2020-02-19 17:00:35 -08:00
2020-09-05 15:54:48 +02:00
2021-02-28 20:56:23 +08:00
2021-03-30 17:21:28 +02:00
2020-04-18 10:40:48 +02:00
2020-02-19 17:00:35 -08:00
2020-02-19 17:00:35 -08:00
2020-02-23 23:41:16 -08:00
2020-04-18 10:40:48 +02:00
2020-04-18 10:40:48 +02:00
2021-08-10 21:01:39 +02:00
2021-04-30 17:07:54 +02:00
2021-08-09 17:42:00 +02:00
2020-02-19 17:00:35 -08:00
2021-05-04 13:21:46 -07:00
2021-07-16 18:21:41 +02:00
2020-09-10 20:48:13 +02:00
2021-02-02 09:42:57 +01:00
2021-07-16 18:21:41 +02:00
2021-07-21 22:33:39 +02:00
2020-02-19 17:00:35 -08:00
2021-08-14 10:55:21 +02:00
2020-04-13 22:56:22 +02:00
2021-04-14 21:46:51 +02:00
2021-07-13 21:33:42 +02:00
2020-08-26 18:29:03 +02:00
2020-02-19 17:00:35 -08:00
2021-05-04 13:50:09 -07:00
2021-08-04 21:09:47 +02:00
2020-02-19 17:00:35 -08:00
2021-07-16 20:27:54 +02:00
2021-08-04 21:09:47 +02:00
2020-02-19 17:00:35 -08:00
2020-08-26 18:29:03 +02:00
2020-02-19 17:00:35 -08:00
2020-08-26 18:29:03 +02:00
2020-03-22 15:53:09 +01:00
2020-02-19 17:00:35 -08:00
2020-02-19 17:00:35 -08:00
2020-02-19 17:00:35 -08:00
2020-12-01 18:55:01 +01:00
2020-02-19 17:00:35 -08:00
2020-02-19 17:00:35 -08:00
2021-07-16 18:21:41 +02:00
2021-07-16 18:21:41 +02:00
2020-02-19 17:00:35 -08:00
2020-02-23 23:41:16 -08:00
2020-09-04 16:55:09 +02:00
2020-03-21 15:31:25 +01:00
2020-02-19 17:00:35 -08:00
2020-02-19 17:00:35 -08:00
2020-02-19 17:00:35 -08:00
2021-02-02 08:35:38 +01:00