aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/ex_docmd.c13
-rw-r--r--src/nvim/globals.h3
-rw-r--r--src/nvim/msgpack_rpc/channel.c1
-rw-r--r--src/nvim/msgpack_rpc/remote_ui.c7
-rw-r--r--src/nvim/ui.c4
-rw-r--r--src/nvim/ui.h1
-rw-r--r--test/functional/ui/screen.lua7
7 files changed, 15 insertions, 21 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index ca79270fcc..5dae96d774 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -71,6 +71,7 @@
#include "nvim/os/time.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/mouse.h"
+#include "nvim/msgpack_rpc/channel.h"
static int quitmore = 0;
static int ex_pressedreturn = FALSE;
@@ -5398,10 +5399,16 @@ static void ex_stop(exarg_T *eap)
/*
* Disallow suspending for "rvim".
*/
- if (!check_restricted()
- ) {
- if (!eap->forceit)
+ if (!check_restricted()) {
+ if (!eap->forceit) {
autowrite_all();
+ }
+
+ if (abstract_ui) {
+ channel_close(last_message_source);
+ return;
+ }
+
windgoto((int)Rows - 1, 0);
out_char('\n');
out_flush();
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 11a7e9ecac..854dd33552 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -1245,6 +1245,9 @@ EXTERN int curr_tmode INIT(= TMODE_COOK); /* contains current terminal mode */
EXTERN bool embedded_mode INIT(= false);
// Using the "abstract_ui" termcap
EXTERN bool abstract_ui INIT(= false);
+// Id of the last channel sent a message to nvim. Used to determine the target
+// of channel-specific actions such as suspending
+EXTERN uint64_t last_message_source INIT(= 0);
/// Used to track the status of external functions.
/// Currently only used for iconv().
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c
index af7e7fa409..85511fb587 100644
--- a/src/nvim/msgpack_rpc/channel.c
+++ b/src/nvim/msgpack_rpc/channel.c
@@ -485,6 +485,7 @@ static void on_request_event(Event event)
{
RequestEvent *e = event.data;
Channel *channel = e->channel;
+ last_message_source = channel->id;
MsgpackRpcRequestHandler handler = e->handler;
Array args = e->args;
uint64_t request_id = e->request_id;
diff --git a/src/nvim/msgpack_rpc/remote_ui.c b/src/nvim/msgpack_rpc/remote_ui.c
index 6a638df61c..4db9c71ebb 100644
--- a/src/nvim/msgpack_rpc/remote_ui.c
+++ b/src/nvim/msgpack_rpc/remote_ui.c
@@ -97,7 +97,6 @@ static Object remote_ui_attach(uint64_t channel_id, uint64_t request_id,
ui->update_fg = remote_ui_update_fg;
ui->update_bg = remote_ui_update_bg;
ui->flush = remote_ui_flush;
- ui->suspend = remote_ui_suspend;
pmap_put(uint64_t)(connected_uis, channel_id, ui);
ui_attach(ui);
return NIL;
@@ -319,9 +318,3 @@ static void remote_ui_flush(UI *ui)
channel_send_event(data->channel_id, "redraw", data->buffer);
data->buffer = (Array)ARRAY_DICT_INIT;
}
-
-static void remote_ui_suspend(UI *ui)
-{
- UIData *data = ui->data;
- remote_ui_disconnect(data->channel_id);
-}
diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index da47080045..5bd4382483 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -117,9 +117,7 @@ void ui_write(uint8_t *s, int len)
*/
void ui_suspend(void)
{
- if (abstract_ui) {
- UI_CALL(suspend);
- } else {
+ if (!abstract_ui) {
mch_suspend();
}
}
diff --git a/src/nvim/ui.h b/src/nvim/ui.h
index 9ec10db75e..3d3e2f4ffc 100644
--- a/src/nvim/ui.h
+++ b/src/nvim/ui.h
@@ -35,7 +35,6 @@ struct ui_t {
void (*flush)(UI *ui);
void (*update_fg)(UI *ui, int fg);
void (*update_bg)(UI *ui, int bg);
- void (*suspend)(UI *ui);
};
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index 04d89d8331..5d139b367f 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -99,7 +99,6 @@ function Screen.new(width, height)
_mouse_enabled = true,
_bell = false,
_visual_bell = false,
- _suspended = true,
_attrs = {},
_cursor = {
enabled = true, row = 1, col = 1
@@ -116,12 +115,10 @@ end
function Screen:attach()
request('ui_attach', self._width, self._height, true)
- self._suspended = false
end
function Screen:detach()
request('ui_detach')
- self._suspended = true
end
function Screen:expect(expected, attr_ids)
@@ -286,10 +283,6 @@ function Screen:_handle_update_bg(bg)
self._bg = bg
end
-function Screen:_handle_suspend()
- self._suspended = true
-end
-
function Screen:_clear_block(top, lines, left, columns)
for i = top, top + lines - 1 do
self:_clear_row_section(i, left, left + columns - 1)