From afbdff64c3a145ecddb4a8d0751a487b04e7decd Mon Sep 17 00:00:00 2001 From: Tae Won Ha Date: Thu, 25 Aug 2016 14:40:36 +0200 Subject: [PATCH] Refactor slightly --- NeoVimServer/server_globals.h | 1 - NeoVimServer/server_ui.m | 14 +++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/NeoVimServer/server_globals.h b/NeoVimServer/server_globals.h index ddb134cc..8d191ad8 100644 --- a/NeoVimServer/server_globals.h +++ b/NeoVimServer/server_globals.h @@ -16,7 +16,6 @@ extern void server_vim_input(NSString *input); extern void server_delete(NSInteger count); extern void server_resize(int width, int height); extern void server_vim_input_marked_text(NSString *markedText); -extern void server_insert_marked_text(NSString *markedText); extern bool server_has_dirty_docs(); extern NSString *server_escaped_filename(NSString *filename); extern NSArray *server_buffers(); diff --git a/NeoVimServer/server_ui.m b/NeoVimServer/server_ui.m index d00795c9..4565903d 100644 --- a/NeoVimServer/server_ui.m +++ b/NeoVimServer/server_ui.m @@ -489,6 +489,12 @@ static void neovim_send_dirty_status(void **argv) { } } +static void insert_marked_text(NSString *markedText) { + _marked_text = [markedText retain]; // release when the final text is input in -vimInput + + loop_schedule(&main_loop, event_create(1, neovim_input, 1, [_marked_text retain])); // release in neovim_input +} + static void delete_marked_text() { NSUInteger length = [_marked_text lengthOfBytesUsingEncoding:NSUTF32StringEncoding] / 4; @@ -678,16 +684,10 @@ void server_vim_input_marked_text(NSString *markedText) { } // log4Debug("inserting marked text '%@' at %d:%d", markedText, _put_row, _put_column); - server_insert_marked_text(markedText); + insert_marked_text(markedText); }); } -void server_insert_marked_text(NSString *markedText) { - _marked_text = [markedText retain]; // release when the final text is input in -vimInput - - loop_schedule(&main_loop, event_create(1, neovim_input, 1, [_marked_text retain])); // release in neovim_input -} - bool server_has_dirty_docs() { FOR_ALL_BUFFERS(buffer) { if (buffer->b_p_bl == 0) {