*** empty log message ***
authorpcg <pcg>
Fri, 5 Dec 2003 04:05:13 +0000 (04:05 +0000)
committerpcg <pcg>
Fri, 5 Dec 2003 04:05:13 +0000 (04:05 +0000)
src/command.C
src/command.h

index c9b8a328431b5cd4d5f259a4faf76aa19884620d..d73d8e8f6945442ac62d9220d3f64c2a8293c743 100644 (file)
@@ -1,7 +1,7 @@
 /*--------------------------------*-C-*---------------------------------*
  * File:       command.c
  *----------------------------------------------------------------------*
- * $Id: command.C,v 1.11 2003-12-02 21:49:46 pcg Exp $
+ * $Id: command.C,v 1.12 2003-12-05 04:05:13 pcg Exp $
  *
  * All portions of code are copyright by their respective author/s.
  * Copyright (c) 1992      John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
@@ -788,107 +788,112 @@ rxvt_term::pty_cb (io_watcher &w, short revents)
   if (revents & EVENT_WRITE)
     tt_write (0, 0);
   else if (revents & EVENT_READ)
-    // loop, but don't allow a single term to monopolize us
-    // the number of loops is fully arbitrary, and thus wrong
-    for (int i = 1; i-- && pty_fill (); )
-      {
-        if (!seen_input)
-          {
-            seen_input = 1;
-            /* once we know the shell is running, send the screen size.  Again! */
-            tt_winch ();
-          }
+    {
+      bool flag = true;
 
-        uint32_t ch = NOCHAR;
+      // loop, but don't allow a single term to monopolize us
+      // the number of loops is fully arbitrary, and thus wrong
+      while (flag && pty_fill ())
+        {
+          if (!seen_input)
+            {
+              seen_input = 1;
+              /* once we know the shell is running, send the screen size.  Again! */
+              tt_winch ();
+            }
 
-        for (;;)
-          {
-            if (ch == NOCHAR)
-              ch = next_char ();
+          uint32_t ch = NOCHAR;
 
-            if (ch == NOCHAR) // TODO: improve
-              break;
+          for (;;)
+            {
+              if (ch == NOCHAR)
+                ch = next_char ();
 
-            if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r')
-              {
-                /* Read a text string from the input buffer */
-                uint32_t buf[BUFSIZ];
-                bool refreshnow = false;
-                int nlines = 0;
-                uint32_t *str = buf;
+              if (ch == NOCHAR) // TODO: improve
+                break;
 
-                *str++ = ch;
+              if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r')
+                {
+                  /* Read a text string from the input buffer */
+                  uint32_t buf[BUFSIZ];
+                  bool refreshnow = false;
+                  int nlines = 0;
+                  uint32_t *str = buf;
 
-                for (;;)
-                  {
-                    ch = next_char ();
+                  *str++ = ch;
 
-                    if (ch == NOCHAR || (ch < ' ' && ch != '\t' && ch != '\n' && ch != '\r'))
-                      break;
-                    else
-                      {
-                        *str++ = ch;
-
-                        if (ch == '\n')
-                          {
-                            nlines++;
-                            refresh_count++;
-
-                            if (!(Options & Opt_jumpScroll)
-                                || (refresh_count >= (refresh_limit * (TermWin.nrow - 1))))
-                              {
-                                refreshnow = true;
-                                ch = NOCHAR;
-                                break;
-                              }
-                          }
-
-                        if (str >= buf + BUFSIZ)
-                          {
-                            ch = NOCHAR;
-                            break;
-                          }
-                      }
-                  }
-
-                rxvt_scr_add_lines (this, buf, nlines, str - buf);
-
-                /*
-                 * If there have been a lot of new lines, then update the screen
-                 * What the heck I'll cheat and only refresh less than every page-full.
-                 * the number of pages between refreshes is refresh_limit, which
-                 * is incremented here because we must be doing flat-out scrolling.
-                 *
-                 * refreshing should be correct for small scrolls, because of the
-                 * time-out
-                 */
-                if (refreshnow)
-                  {
-                    if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD)
-                      refresh_limit++;
+                  for (;;)
+                    {
+                      ch = next_char ();
 
-                    rxvt_scr_refresh (this, refresh_type);
-                  }
+                      if (ch == NOCHAR || (ch < ' ' && ch != '\t' && ch != '\n' && ch != '\r'))
+                        break;
+                      else
+                        {
+                          *str++ = ch;
+
+                          if (ch == '\n')
+                            {
+                              nlines++;
+                              refresh_count++;
+
+                              if (!(Options & Opt_jumpScroll)
+                                  || (refresh_count >= (refresh_limit * (TermWin.nrow - 1))))
+                                {
+                                  refreshnow = true;
+                                  flag = false;
+                                  ch = NOCHAR;
+                                  break;
+                                }
+                            }
+
+                          if (str >= buf + BUFSIZ)
+                            {
+                              ch = NOCHAR;
+                              break;
+                            }
+                        }
+                    }
+
+                  rxvt_scr_add_lines (this, buf, nlines, str - buf);
+
+                  /*
+                   * If there have been a lot of new lines, then update the screen
+                   * What the heck I'll cheat and only refresh less than every page-full.
+                   * the number of pages between refreshes is refresh_limit, which
+                   * is incremented here because we must be doing flat-out scrolling.
+                   *
+                   * refreshing should be correct for small scrolls, because of the
+                   * time-out
+                   */
+                  if (refreshnow)
+                    {
+                      if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD)
+                        refresh_limit++;
+
+                      rxvt_scr_refresh (this, refresh_type);
+                    }
+
+                }
+              else
+                {
+                  switch (ch)
+                    {
+                      default:
+                        rxvt_process_nonprinting (this, ch);
+                        break;
+                      case C0_ESC:     /* escape char */
+                        rxvt_process_escape_seq (this);
+                        break;
+                      /*case 0x9b: */  /* CSI */
+                      /*  rxvt_process_csi_seq (this); */
+                    }
 
-              }
-            else
-              {
-                switch (ch)
-                  {
-                    default:
-                      rxvt_process_nonprinting (this, ch);
-                      break;
-                    case C0_ESC:       /* escape char */
-                      rxvt_process_escape_seq (this);
-                      break;
-                    /*case 0x9b: */    /* CSI */
-                    /*  rxvt_process_csi_seq (this); */
-                  }
-
-                ch = NOCHAR;
-              }
-          }
-      }
+                  ch = NOCHAR;
+                }
+            }
+        }
+    }
 }
 
 // read the next character, currently handles UTF-8
index 9c8ae3cc0f850207ef681bacc04d5e83224e317d..56e2d1bf0c55933e56fcd28e9f0ba65d79760a8d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: command.h,v 1.2 2003-11-24 17:31:27 pcg Exp $
+ * $Id: command.h,v 1.3 2003-12-05 04:05:13 pcg Exp $
  */
 
 #ifndef _COMMAND_H_
@@ -15,7 +15,7 @@
 #endif
 
 /* a large REFRESH_PERIOD causes problems with `cat' */
-#define REFRESH_PERIOD         10
+#define REFRESH_PERIOD         1
 
 #ifndef MULTICLICK_TIME
 # define MULTICLICK_TIME       500