[BACK]Return to tty.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

Diff for /src/usr.bin/mg/tty.c between version 1.10 and 1.11

version 1.10, 2002/01/10 12:13:35 version 1.11, 2002/01/18 08:37:08
Line 99 
Line 99 
                 tcinsl = charcost(insert_line);                  tcinsl = charcost(insert_line);
         else          else
                 /* make this cost high enough */                  /* make this cost high enough */
                 tcinsl = NROW * NCOL;                  tcinsl = nrow * ncol;
   
         /* Estimate cost of deleting a line */          /* Estimate cost of deleting a line */
         if (change_scroll_region)          if (change_scroll_region)
Line 111 
Line 111 
                 tcdell = charcost(delete_line);                  tcdell = charcost(delete_line);
         else          else
                 /* make this cost high enough */                  /* make this cost high enough */
                 tcdell = NROW * NCOL;                  tcdell = nrow * ncol;
   
         /* Flag to indicate that we can both insert and delete lines */          /* Flag to indicate that we can both insert and delete lines */
         insdel = (insert_line || parm_insert_line) &&          insdel = (insert_line || parm_insert_line) &&
Line 400 
Line 400 
   
 /*  /*
  * This routine is called by the "refresh the screen" command to try   * This routine is called by the "refresh the screen" command to try
  * to resize the display. The new size, which must not exceed the NROW   * to resize the display. Look in "window.c" to see how
  * and NCOL limits, is stored back into "nrow" and * "ncol". Display can  
  * always deal with a screen NROW by NCOL. Look in "window.c" to see how  
  * the caller deals with a change.   * the caller deals with a change.
    *
    * We use `newrow' and `newcol' so vtresize() know the difference between the
    * new and old settings.
  */   */
 void  void
 ttresize()  ttresize()
 {  {
           int newrow = 0, newcol = 0;
   
 #ifdef  TIOCGWINSZ  #ifdef  TIOCGWINSZ
         struct  winsize winsize;          struct  winsize winsize;
   
         if (ioctl(0, TIOCGWINSZ, (char *) &winsize) == 0) {          if (ioctl(0, TIOCGWINSZ, (char *) &winsize) == 0) {
                 nrow = winsize.ws_row;                  newrow = winsize.ws_row;
                 ncol = winsize.ws_col;                  newcol = winsize.ws_col;
         } else nrow = 0;          }
 #endif  #endif
         if ((nrow <= 0 || ncol <= 0) &&          if ((newrow <= 0 || newcol <= 0) &&
             ((nrow = lines) <= 0 || (ncol = columns) <= 0)) {              ((newrow = lines) <= 0 || (newcol = columns) <= 0)) {
                 nrow = 24;                  newrow = 24;
                 ncol = 80;                  newcol = 80;
         }          }
           if (vtresize(1, newrow, newcol))
         /* Enforce maximum screen size. */                  panic("vtresize failed");
         if (nrow > NROW)          nrow = newrow;
                 nrow = NROW;          ncol = newcol;
         if (ncol > NCOL)  
                 ncol = NCOL;  
 }  }
   
 /*  /*

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11