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.
Files: src/os_unix.c, src/channel.c, src/proto/channel.pro
*** ../vim-7.4.1877/src/os_unix.c 2016-05-08 09:40:46.490843730 +0200
--- src/os_unix.c 2016-06-02 19:55:47.112392132 +0200
***************
*** 438,454 ****
for (;;) /* repeat until we got a character */
{
while (do_resize) /* window changed size */
handle_resize();
#ifdef MESSAGE_QUEUE
parse_queued_messages();
#endif
/*
* We want to be interrupted by the winch signal
* or by an event on the monitored file descriptors.
*/
! if (!WaitForChar(-1L))
{
if (do_resize) /* interrupted by SIGWINCH signal */
handle_resize();
--- 438,468 ----
for (;;) /* repeat until we got a character */
{
+ long wtime_now = -1L;
+
while (do_resize) /* window changed size */
handle_resize();
#ifdef MESSAGE_QUEUE
parse_queued_messages();
+
+ # ifdef FEAT_JOB_CHANNEL
+ if (has_pending_job())
+ {
+ /* Don't wait longer than a few seconds, checking for a finished
+ * job requires polling. */
+ if (p_ut > 9000L)
+ wtime_now = 1000L;
+ else
+ wtime_now = 10000L - p_ut;
+ }
+ # endif
#endif
/*
* We want to be interrupted by the winch signal
* or by an event on the monitored file descriptors.
*/
! if (!WaitForChar(wtime_now))
{
if (do_resize) /* interrupted by SIGWINCH signal */
handle_resize();
*** ../vim-7.4.1877/src/channel.c 2016-05-29 16:44:22.153304121 +0200
--- src/channel.c 2016-06-02 20:00:37.012388144 +0200
***************
*** 4403,4408 ****
--- 4403,4423 ----
}
/*
+ * Return TRUE when there is any job that might exit, which means
+ * job_check_ended() should be called once in a while.
+ */
+ int
+ has_pending_job()
+ {
+ job_T *job;
+
+ for (job = first_job; job != NULL; job = job->jv_next)
+ if (job->jv_status == JOB_STARTED && job_still_useful(job))
+ return TRUE;
+ return FALSE;
+ }
+
+ /*
* Called once in a while: check if any jobs that seem useful have ended.
*/
void
***************
*** 4425,4430 ****
--- 4440,4450 ----
job_status(job); /* may free "job" */
}
}
+ if (channel_need_redraw)
+ {
+ channel_need_redraw = FALSE;
+ redraw_after_callback();
+ }
}
/*
***************
*** 4658,4663 ****
--- 4678,4684 ----
job->jv_exit_partial, NULL);
clear_tv(&rettv);
--job->jv_refcount;
+ channel_need_redraw = TRUE;
}
if (job->jv_status == JOB_ENDED && job->jv_refcount == 0)
{
*** ../vim-7.4.1877/src/proto/channel.pro 2016-05-28 22:22:28.830213562
+0200
--- src/proto/channel.pro 2016-06-02 19:55:45.164392159 +0200
***************
*** 57,62 ****
--- 57,63 ----
void free_unused_jobs(int copyID, int mask);
void job_set_options(job_T *job, jobopt_T *opt);
void job_stop_on_exit(void);
+ int has_pending_job(void);
void job_check_ended(void);
job_T *job_start(typval_T *argvars);
char *job_status(job_T *job);
*** ../vim-7.4.1877/src/version.c 2016-06-02 19:06:20.276432943 +0200
--- src/version.c 2016-06-02 20:02:30.500386583 +0200
***************
*** 755,756 ****
--- 755,758 ----
{ /* Add new patch number below this line */
+ /**/
+ 1878,
/**/
--
The users that I support would double-click on a landmine to find out
what happens. -- A system administrator
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.