diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-05-10 22:22:52 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-05-10 22:22:52 +0200 |
| commit | e2e0162b5bfd2a5ef31f1d09fca4da8962d5d098 (patch) | |
| tree | 984329f1824e81b0eb2a6f162f5c33ec7c8eb69c /vis.c | |
| parent | 0ac9c6210b3b08b2e8a9e7e4de387abcef9afcff (diff) | |
| download | vis-e2e0162b5bfd2a5ef31f1d09fca4da8962d5d098.tar.gz vis-e2e0162b5bfd2a5ef31f1d09fca4da8962d5d098.tar.xz | |
Revert "vis: clean up interaction between vis and ui"
This caused issues on OpenBSD where it crashed the terminal.
Also on Mac OS X suspend via ^Z (Ctrl-Z) was missing a \r i.e.
the shell prompt was not properly redrawn.
While in principle user interfaces should not have to depend on
libtermkey, in practice this won't be an issue unless we are
adding a non-terminal based UI (which won't happen anytime soon).
This reverts commit 8f92b98848f9366e78c7aa824615bade83971513.
Close #311
Diffstat (limited to 'vis.c')
| -rw-r--r-- | vis.c | 14 |
1 files changed, 4 insertions, 10 deletions
@@ -19,6 +19,7 @@ #include <sys/ioctl.h> #include <sys/mman.h> #include <pwd.h> +#include <termkey.h> #include "vis.h" #include "text-util.h" @@ -339,12 +340,6 @@ Vis *vis_new(Ui *ui, VisEvent *event) { Vis *vis = calloc(1, sizeof(Vis)); if (!vis) return NULL; - const char *term = getenv("TERM"); - if (!term) - term = "xterm"; - vis->termkey = termkey_new_abstract(term, TERMKEY_FLAG_UTF8); - if (!vis->termkey) - goto err; vis->ui = ui; vis->ui->init(vis->ui, vis); vis->tabwidth = 8; @@ -403,8 +398,6 @@ void vis_free(Vis *vis) { map_free(vis_modes[i].bindings); array_release_full(&vis->motions); array_release_full(&vis->textobjects); - if (vis->termkey) - termkey_destroy(vis->termkey); free(vis); } @@ -668,7 +661,7 @@ const char *vis_keys_next(Vis *vis, const char *keys) { if (!keys || !*keys) return NULL; TermKeyKey key; - TermKey *termkey = vis->termkey; + TermKey *termkey = vis->ui->termkey_get(vis->ui); const char *next = NULL; /* first try to parse a special key of the form <Key> */ if (*keys == '<' && (next = termkey_strpkey(termkey, keys+1, &key, TERMKEY_FORMAT_VIM)) && *next == '>') @@ -924,7 +917,8 @@ int vis_run(Vis *vis, int argc, char *argv[]) { continue; } - vis->ui->needkey(vis->ui); + TermKey *termkey = vis->ui->termkey_get(vis->ui); + termkey_advisereadable(termkey); const char *key; while ((key = getkey(vis))) |
