Mercurial > vim
comparison src/misc2.c @ 18094:a1396a35444c v8.1.2042
patch 8.1.2042: the evalfunc.c file is too big
Commit: https://github.com/vim/vim/commit/9c658c9eacbd97e2c071f652a0155f71db94c0f3
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Sep 15 21:00:54 2019 +0200
patch 8.1.2042: the evalfunc.c file is too big
Problem: The evalfunc.c file is too big.
Solution: Move getchar() and parse_queued_messages() to getchar.c.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 15 Sep 2019 21:15:03 +0200 |
parents | 8b4f9be5db73 |
children | 1868ec23360e |
comparison
equal
deleted
inserted
replaced
18093:18c77f2ec0d9 | 18094:a1396a35444c |
---|---|
4347 return TRUE; | 4347 return TRUE; |
4348 return FALSE; | 4348 return FALSE; |
4349 } | 4349 } |
4350 #endif | 4350 #endif |
4351 | 4351 |
4352 #if defined(MESSAGE_QUEUE) || defined(PROTO) | |
4353 # define MAX_REPEAT_PARSE 8 | |
4354 | |
4355 /* | |
4356 * Process messages that have been queued for netbeans or clientserver. | |
4357 * Also check if any jobs have ended. | |
4358 * These functions can call arbitrary vimscript and should only be called when | |
4359 * it is safe to do so. | |
4360 */ | |
4361 void | |
4362 parse_queued_messages(void) | |
4363 { | |
4364 int old_curwin_id = curwin->w_id; | |
4365 int old_curbuf_fnum = curbuf->b_fnum; | |
4366 int i; | |
4367 int save_may_garbage_collect = may_garbage_collect; | |
4368 | |
4369 // Do not handle messages while redrawing, because it may cause buffers to | |
4370 // change or be wiped while they are being redrawn. | |
4371 if (updating_screen) | |
4372 return; | |
4373 | |
4374 // may_garbage_collect is set in main_loop() to do garbage collection when | |
4375 // blocking to wait on a character. We don't want that while parsing | |
4376 // messages, a callback may invoke vgetc() while lists and dicts are in use | |
4377 // in the call stack. | |
4378 may_garbage_collect = FALSE; | |
4379 | |
4380 // Loop when a job ended, but don't keep looping forever. | |
4381 for (i = 0; i < MAX_REPEAT_PARSE; ++i) | |
4382 { | |
4383 // For Win32 mch_breakcheck() does not check for input, do it here. | |
4384 # if defined(MSWIN) && defined(FEAT_JOB_CHANNEL) | |
4385 channel_handle_events(FALSE); | |
4386 # endif | |
4387 | |
4388 # ifdef FEAT_NETBEANS_INTG | |
4389 // Process the queued netbeans messages. | |
4390 netbeans_parse_messages(); | |
4391 # endif | |
4392 # ifdef FEAT_JOB_CHANNEL | |
4393 // Write any buffer lines still to be written. | |
4394 channel_write_any_lines(); | |
4395 | |
4396 // Process the messages queued on channels. | |
4397 channel_parse_messages(); | |
4398 # endif | |
4399 # if defined(FEAT_CLIENTSERVER) && defined(FEAT_X11) | |
4400 // Process the queued clientserver messages. | |
4401 server_parse_messages(); | |
4402 # endif | |
4403 # ifdef FEAT_JOB_CHANNEL | |
4404 // Check if any jobs have ended. If so, repeat the above to handle | |
4405 // changes, e.g. stdin may have been closed. | |
4406 if (job_check_ended()) | |
4407 continue; | |
4408 # endif | |
4409 # ifdef FEAT_TERMINAL | |
4410 free_unused_terminals(); | |
4411 # endif | |
4412 # ifdef FEAT_SOUND_CANBERRA | |
4413 if (has_sound_callback_in_queue()) | |
4414 invoke_sound_callback(); | |
4415 # endif | |
4416 break; | |
4417 } | |
4418 | |
4419 may_garbage_collect = save_may_garbage_collect; | |
4420 | |
4421 // If the current window or buffer changed we need to bail out of the | |
4422 // waiting loop. E.g. when a job exit callback closes the terminal window. | |
4423 if (curwin->w_id != old_curwin_id || curbuf->b_fnum != old_curbuf_fnum) | |
4424 ins_char_typebuf(K_IGNORE); | |
4425 } | |
4426 #endif | |
4427 | |
4428 #ifndef PROTO /* proto is defined in vim.h */ | 4352 #ifndef PROTO /* proto is defined in vim.h */ |
4429 # ifdef ELAPSED_TIMEVAL | 4353 # ifdef ELAPSED_TIMEVAL |
4430 /* | 4354 /* |
4431 * Return time in msec since "start_tv". | 4355 * Return time in msec since "start_tv". |
4432 */ | 4356 */ |