Mercurial > vim
comparison src/channel.c @ 9189:4b55d8e162d4 v7.4.1878
commit https://github.com/vim/vim/commit/cf7c11a9479ba7ce775b86c7a846fae48321d260
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 2 20:05:26 2016 +0200
patch 7.4.1878
Problem: Whether a job has exited isn't detected until a character is
typed. After calling exit_cb the cursor is in the wrong place.
Solution: Don't wait forever for a character to be typed when there is a
pending job. Update the screen if neede after calling exit_cb.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 02 Jun 2016 20:15:05 +0200 |
parents | d0f69d0bea7a |
children | d2d44592467d |
comparison
equal
deleted
inserted
replaced
9188:6de68608c4ea | 9189:4b55d8e162d4 |
---|---|
4401 if (job->jv_status == JOB_STARTED && job->jv_stoponexit != NULL) | 4401 if (job->jv_status == JOB_STARTED && job->jv_stoponexit != NULL) |
4402 mch_stop_job(job, job->jv_stoponexit); | 4402 mch_stop_job(job, job->jv_stoponexit); |
4403 } | 4403 } |
4404 | 4404 |
4405 /* | 4405 /* |
4406 * Return TRUE when there is any job that might exit, which means | |
4407 * job_check_ended() should be called once in a while. | |
4408 */ | |
4409 int | |
4410 has_pending_job() | |
4411 { | |
4412 job_T *job; | |
4413 | |
4414 for (job = first_job; job != NULL; job = job->jv_next) | |
4415 if (job->jv_status == JOB_STARTED && job_still_useful(job)) | |
4416 return TRUE; | |
4417 return FALSE; | |
4418 } | |
4419 | |
4420 /* | |
4406 * Called once in a while: check if any jobs that seem useful have ended. | 4421 * Called once in a while: check if any jobs that seem useful have ended. |
4407 */ | 4422 */ |
4408 void | 4423 void |
4409 job_check_ended(void) | 4424 job_check_ended(void) |
4410 { | 4425 { |
4422 { | 4437 { |
4423 next = job->jv_next; | 4438 next = job->jv_next; |
4424 if (job->jv_status == JOB_STARTED && job_still_useful(job)) | 4439 if (job->jv_status == JOB_STARTED && job_still_useful(job)) |
4425 job_status(job); /* may free "job" */ | 4440 job_status(job); /* may free "job" */ |
4426 } | 4441 } |
4442 } | |
4443 if (channel_need_redraw) | |
4444 { | |
4445 channel_need_redraw = FALSE; | |
4446 redraw_after_callback(); | |
4427 } | 4447 } |
4428 } | 4448 } |
4429 | 4449 |
4430 /* | 4450 /* |
4431 * "job_start()" function | 4451 * "job_start()" function |
4656 call_func(job->jv_exit_cb, (int)STRLEN(job->jv_exit_cb), | 4676 call_func(job->jv_exit_cb, (int)STRLEN(job->jv_exit_cb), |
4657 &rettv, 2, argv, 0L, 0L, &dummy, TRUE, | 4677 &rettv, 2, argv, 0L, 0L, &dummy, TRUE, |
4658 job->jv_exit_partial, NULL); | 4678 job->jv_exit_partial, NULL); |
4659 clear_tv(&rettv); | 4679 clear_tv(&rettv); |
4660 --job->jv_refcount; | 4680 --job->jv_refcount; |
4681 channel_need_redraw = TRUE; | |
4661 } | 4682 } |
4662 if (job->jv_status == JOB_ENDED && job->jv_refcount == 0) | 4683 if (job->jv_status == JOB_ENDED && job->jv_refcount == 0) |
4663 { | 4684 { |
4664 /* The job was already unreferenced, now that it ended it can be | 4685 /* The job was already unreferenced, now that it ended it can be |
4665 * freed. Careful: caller must not use "job" after this! */ | 4686 * freed. Careful: caller must not use "job" after this! */ |