mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-23 19:21:53 +03:00
Revert "GH-376 Compute tabs in the main loop"
This reverts commit 5fbc773584
.
This commit is contained in:
parent
b03393a3e0
commit
279a768bf7
@ -255,10 +255,7 @@ static CFDataRef local_server_callback(CFMessagePortRef local, SInt32 msgid, CFD
|
||||
}
|
||||
|
||||
case NeoVimAgentMsgIdGetTabs: {
|
||||
NSUInteger responseId = response_id_from_data(data);
|
||||
server_tabs(responseId);
|
||||
|
||||
return nil;
|
||||
return [NSKeyedArchiver archivedDataWithRootObject:server_tabs()];
|
||||
}
|
||||
|
||||
case NeoVimAgentMsgIdGetBoolOption: {
|
||||
|
@ -20,7 +20,7 @@ extern void server_vim_input_marked_text(NSString *markedText);
|
||||
extern bool server_has_dirty_docs();
|
||||
extern NSString *server_escaped_filename(NSString *filename);
|
||||
extern NSArray *server_buffers();
|
||||
extern void server_tabs(NSUInteger responseId);
|
||||
extern NSArray *server_tabs();
|
||||
extern void server_get_bool_option(NSUInteger responseId, NSString *option);
|
||||
extern void server_set_bool_option(NSUInteger responseId, NSString *option, bool value);
|
||||
extern void server_select_win(int window_handle);
|
||||
|
@ -792,10 +792,7 @@ NSArray *server_buffers() {
|
||||
return result;
|
||||
}
|
||||
|
||||
static void neovim_tabs(void **argv) {
|
||||
NSUInteger *values = (NSUInteger *) argv[0];
|
||||
NSUInteger responseId = values[0];
|
||||
|
||||
NSArray *server_tabs() {
|
||||
NSMutableArray *tabs = [[NSMutableArray new] autorelease];
|
||||
FOR_ALL_TABS(t) {
|
||||
NSMutableArray *windows = [NSMutableArray new];
|
||||
@ -818,22 +815,7 @@ static void neovim_tabs(void **argv) {
|
||||
[tab release];
|
||||
}
|
||||
|
||||
NSData *resultData = [NSKeyedArchiver archivedDataWithRootObject:tabs];
|
||||
NSData *data = data_with_response_id_prefix(responseId, resultData);
|
||||
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdSyncResult data:data];
|
||||
|
||||
free(values); // malloc'ed in loop_schedule(&main_loop, ...) (in _queue) somewhere
|
||||
}
|
||||
|
||||
void server_tabs(NSUInteger responseId) {
|
||||
queue(^{
|
||||
NSUInteger *values = malloc(sizeof(NSUInteger));
|
||||
values[0] = responseId;
|
||||
|
||||
// free release in neovim_command
|
||||
loop_schedule(&main_loop, event_create(1, neovim_tabs, 1, values));
|
||||
});
|
||||
return tabs;
|
||||
}
|
||||
|
||||
void server_select_win(int window_handle) {
|
||||
|
@ -347,16 +347,13 @@ static CFDataRef local_server_callback(CFMessagePortRef local, SInt32 msgid, CFD
|
||||
}
|
||||
|
||||
- (NSArray<NeoVimWindow *> *)tabs {
|
||||
NSUInteger reqId = [self nextRequestResponseId];
|
||||
NSData *data = [NSData dataWithBytes:&reqId length:sizeof(NSUInteger)];
|
||||
|
||||
[self sendMessageWithId:NeoVimAgentMsgIdGetTabs data:data expectsReply:NO];
|
||||
NSData *responseData = [self responseByWaitingForId:reqId];
|
||||
if (responseData == nil) {
|
||||
NSData *response = [self sendMessageWithId:NeoVimAgentMsgIdGetTabs data:nil expectsReply:YES];
|
||||
if (response == nil) {
|
||||
log4Warn("The response for the msg %lu was nil.", NeoVimAgentMsgIdGetTabs);
|
||||
return @[];
|
||||
}
|
||||
|
||||
return [NSKeyedUnarchiver unarchiveObjectWithData:responseData];
|
||||
return [NSKeyedUnarchiver unarchiveObjectWithData:response];
|
||||
}
|
||||
|
||||
- (void)runLocalServer {
|
||||
|
Loading…
Reference in New Issue
Block a user