diff options
| author | Charlie Groves <charlie.groves@gmail.com> | 2022-02-24 10:47:41 -0500 | 
|---|---|---|
| committer | Charlie Groves <charlie.groves@gmail.com> | 2022-03-11 11:16:46 -0500 | 
| commit | 039e94f491d2f8576cbef1aeacd5ea1f7bc0982a (patch) | |
| tree | 2737147f9a2e9c15ff09df6b16131997c9a17734 /src/nvim/main.c | |
| parent | 70d2ab158320e72542dc2a845858d6f97da86e00 (diff) | |
| download | rneovim-039e94f491d2f8576cbef1aeacd5ea1f7bc0982a.tar.gz rneovim-039e94f491d2f8576cbef1aeacd5ea1f7bc0982a.tar.bz2 rneovim-039e94f491d2f8576cbef1aeacd5ea1f7bc0982a.zip  | |
test(remote): add tests for --remote
This also fixes a fair number of issues found in running the tests
Diffstat (limited to 'src/nvim/main.c')
| -rw-r--r-- | src/nvim/main.c | 23 | 
1 files changed, 12 insertions, 11 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c index 843ca5f855..a3588ac5df 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -821,7 +821,6 @@ static void handle_remote_client(mparm_T *params, int remote_args,      Boolean should_exit = true;      Boolean tabbed; -    int files;      int t_argc = remote_args;      Array args = ARRAY_DICT_INIT; @@ -839,12 +838,17 @@ static void handle_remote_client(mparm_T *params, int remote_args,      Object o = nlua_exec(s, a, &err);      api_free_string(s);      api_free_array(a); +    if (ERROR_SET(&err)) { +      mch_errmsg(err.msg); +      mch_errmsg("\n"); +      os_exit(2); +    }      if (o.type == kObjectTypeDictionary) {        rvobj.data.dictionary = o.data.dictionary; -    } else if (!ERROR_SET(&err)) { -      api_set_error(&err, kErrorTypeException, -                    "Function returned unexpected value"); +    } else { +      mch_errmsg("vim._cs_remote returned unexpected value\n"); +      os_exit(3);      }      for (size_t i = 0; i < rvobj.data.dictionary.size ; i++) { @@ -853,18 +857,15 @@ static void handle_remote_client(mparm_T *params, int remote_args,          tabbed = rvobj.data.dictionary.items[i].value.data.boolean;        } else if (strcmp(rvobj.data.dictionary.items[i].key.data, "should_exit") == 0) {          should_exit = rvobj.data.dictionary.items[i].value.data.boolean; -      } else if (strcmp(rvobj.data.dictionary.items[i].key.data, "files") == 0) { -        files = (int)rvobj.data.dictionary.items[i].value.data.integer;        }      }      if (should_exit) {        os_exit(0); -    } else { -      if (tabbed) { -        params->window_count = files; -        params->window_layout = WIN_TABS; -      } +    } +    if (tabbed) { +      params->window_count = argc - remote_args - 1; +      params->window_layout = WIN_TABS;      }  }  | 
