diff options
author | Scott Prager <splinterofchaos@gmail.com> | 2015-04-06 22:37:52 -0400 |
---|---|---|
committer | Scott Prager <splinterofchaos@gmail.com> | 2015-04-06 22:37:52 -0400 |
commit | 5f3eeadd037e111e8ba5b04d39ff69806899ed6c (patch) | |
tree | 28a127f499573dceb78a9b966f504974b410e67e | |
parent | 6322a481736326e9964b83bf1291f93c6516bd7c (diff) | |
parent | 9a7b071e64fd358189930c77cbdc15c93e53caa1 (diff) | |
download | rneovim-5f3eeadd037e111e8ba5b04d39ff69806899ed6c.tar.gz rneovim-5f3eeadd037e111e8ba5b04d39ff69806899ed6c.tar.bz2 rneovim-5f3eeadd037e111e8ba5b04d39ff69806899ed6c.zip |
Merge pull request #2348 from mhinz/job-control-mouse
[RFC] Job control: enable mouse after foregrounding
-rw-r--r-- | src/nvim/tui/tui.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 72f93976c1..6d23c2cf74 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -50,6 +50,7 @@ typedef struct { int out_fd; int old_height; bool can_use_terminal_scroll; + bool mouse_enabled; bool busy; HlAttrs attrs, print_attrs; Cell **screen; @@ -84,7 +85,7 @@ typedef struct { } while (0) -void tui_start(void) +UI *tui_start(void) { TUIData *data = xcalloc(1, sizeof(TUIData)); UI *ui = xcalloc(1, sizeof(UI)); @@ -119,7 +120,6 @@ void tui_start(void) unibi_out(ui, unibi_clear_screen); // Enable bracketed paste unibi_out(ui, data->unibi_ext.enable_bracketed_paste); - // setup output handle in a separate event loop(we wanna do synchronous // write to the tty) data->write_loop = xmalloc(sizeof(uv_loop_t)); @@ -162,6 +162,7 @@ void tui_start(void) ui->set_icon = tui_set_icon; // Attach ui_attach(ui); + return ui; } static void tui_stop(UI *ui) @@ -384,12 +385,14 @@ static void tui_mouse_on(UI *ui) { TUIData *data = ui->data; unibi_out(ui, data->unibi_ext.enable_mouse); + data->mouse_enabled = true; } static void tui_mouse_off(UI *ui) { TUIData *data = ui->data; unibi_out(ui, data->unibi_ext.disable_mouse); + data->mouse_enabled = false; } static void tui_insert_mode(UI *ui) @@ -561,9 +564,14 @@ static void tui_flush(UI *ui) static void tui_suspend(UI *ui) { + TUIData *data = ui->data; + bool enable_mouse = data->mouse_enabled; tui_stop(ui); kill(0, SIGTSTP); - tui_start(); + ui = tui_start(); + if (enable_mouse) { + tui_mouse_on(ui); + } } static void tui_set_title(UI *ui, char *title) |