1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-01 01:32:04 +03:00

Refactor slightly

This commit is contained in:
Tae Won Ha 2016-08-25 14:40:36 +02:00
parent fc2affb75e
commit afbdff64c3
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
2 changed files with 7 additions and 8 deletions

View File

@ -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();

View File

@ -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) {