about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-01-30 19:03:45 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-01-30 19:03:45 +0000
commita1476c1ee262e2b75bf12ade0e1225158e835453 (patch)
treef63ad93f829fac3c59639e4c888495ebdddc518e
parent2f6267dc31c4e0bbb8680b5a440f47517f8f75c2 (diff)
downloadzsh-a1476c1ee262e2b75bf12ade0e1225158e835453.tar.gz
zsh-a1476c1ee262e2b75bf12ade0e1225158e835453.tar.xz
zsh-a1476c1ee262e2b75bf12ade0e1225158e835453.zip
23141: don't zrfresh() after printjob() that didn't print
-rw-r--r--ChangeLog5
-rw-r--r--Src/jobs.c20
2 files changed, 20 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 08c6dcf39..2b48e48c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-27  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 23141: Src/jobs.c: don't refresh the display after
+	a printjob() that didn't print anything.
+
 2007-01-29  Clint Adams  <clint@zsh.org>
 
 	* 23140: Completion/Unix/Command/_arping: handle syntax for
diff --git a/Src/jobs.c b/Src/jobs.c
index 6f8bf0e12..38666ef55 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -448,8 +448,8 @@ update_job(Job jn)
 	curjob = job;
     }
     if ((isset(NOTIFY) || job == thisjob) && (jn->stat & STAT_LOCKED)) {
-	printjob(jn, !!isset(LONGLISTJOBS), 0);
-	if (zleactive)
+	if (printjob(jn, !!isset(LONGLISTJOBS), 0) &&
+	    zleactive)
 	    zrefreshptr();
     }
     if (sigtrapped[SIGCHLD] && job != thisjob)
@@ -804,19 +804,22 @@ should_report_time(Job j)
  * synch = 0 means asynchronous
  * synch = 1 means synchronous
  * synch = 2 means called synchronously from jobs
+ *
+ * Returns 1 if some output was done.
 */
 
 /**/
-void
+int
 printjob(Job jn, int lng, int synch)
 {
     Process pn;
     int job, len = 9, sig, sflag = 0, llen;
     int conted = 0, lineleng = columns, skip = 0, doputnl = 0;
+    int doneprint = 0;
     FILE *fout = (synch == 2) ? stdout : shout;
 
     if (jn->stat & STAT_NOPRINT)
-	return;
+	return 0;
 
     /*
      * Wow, what a hack.  Did I really write this? --- pws
@@ -874,8 +877,10 @@ printjob(Job jn, int lng, int synch)
 
 	if (!synch)
 	    trashzleptr();
-	if (doputnl && !synch)
+	if (doputnl && !synch) {
+	    doneprint = 1;
 	    putc('\n', fout);
+	}
 	for (pn = jn->procs; pn;) {
 	    len2 = (thisfmt ? 5 : 10) + len;	/* 2 spaces */
 	    if (lng & 3)
@@ -888,6 +893,7 @@ printjob(Job jn, int lng, int synch)
 			break;
 		    len2 += strlen(qn->text) + 2;
 		}
+	    doneprint = 1;
 	    if (!thisfmt || lng) {
 		if (fline)
 		    fprintf(fout, "[%ld]  %c ",
@@ -944,6 +950,7 @@ printjob(Job jn, int lng, int synch)
 	}
 	fflush(fout);
     } else if (doputnl && interact && !synch) {
+	doneprint = 1;
 	putc('\n', fout);
 	fflush(fout);
     }
@@ -954,6 +961,7 @@ printjob(Job jn, int lng, int synch)
 
     if ((lng & 4) || (interact && job == thisjob &&
 		      jn->pwd && strcmp(jn->pwd, pwd))) {
+	doneprint = 1;
 	fprintf(fout, "(pwd %s: ", (lng & 4) ? "" : "now");
 	fprintdir(((lng & 4) && jn->pwd) ? jn->pwd : pwd, fout);
 	fprintf(fout, ")\n");
@@ -973,6 +981,8 @@ printjob(Job jn, int lng, int synch)
 	    setprevjob();
     } else
 	jn->stat &= ~STAT_CHANGED;
+
+    return doneprint;
 }
 
 /**/