diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2014-09-08 21:58:50 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2014-09-08 21:58:50 +0200 |
| commit | ee3ded959f5486e921e45ac6753b21c2fcd63f0f (patch) | |
| tree | 69bbccd4f7babce44dad355ac0dcc1573e9fa895 /main.c | |
| parent | e7b6ac1574ba4dad280e6a45beb52dac4e3ea2e9 (diff) | |
| download | vis-ee3ded959f5486e921e45ac6753b21c2fcd63f0f.tar.gz vis-ee3ded959f5486e921e45ac6753b21c2fcd63f0f.tar.xz | |
Improve undo/redo
Currently a snapshot is taken whenever an operator is completed or
a certain idle time in either insert or replace mode is detected.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -47,6 +47,7 @@ struct Mode { void (*leave)(Mode *new); bool (*unknown)(Key *key0, Key *key1); /* unknown key for this mode, return value determines whether parent modes will be checked */ bool (*input)(const char *str, size_t len); /* unknown key for this an all parent modes */ + void (*idle)(void); }; typedef struct { @@ -263,7 +264,8 @@ int main(int argc, char *argv[]) { } if (!FD_ISSET(STDIN_FILENO, &fds)) { - vis_snapshot(vis); + if (mode->idle) + mode->idle(); timeout = NULL; continue; } @@ -291,7 +293,9 @@ int main(int argc, char *argv[]) { if (key.code) continue; - if (mode->input && mode->input(key.str, strlen(key.str))) + if (mode->input) + mode->input(key.str, strlen(key.str)); + if (mode->idle) timeout = &idle; } |
