home *** CD-ROM | disk | FTP | other *** search
/ Best Objectech Shareware Selections / UNTITLED.iso / boss / word / text / 019 / vterm.c < prev    next >
C/C++ Source or Header  |  1993-01-19  |  2KB  |  110 lines

  1. /*
  2.  *  Copyright (c) 1992 John E. Davis  (davis@amy.tch.harvard.edu)
  3.  *  All Rights Reserved.
  4.  */
  5. #include <stdio.h>
  6. #include "buffer.h"
  7. #include "screen.h"
  8. #include "window.h"
  9. #include "vterm.h"
  10.  
  11. void vscroll_down(int r1, int r2, int num)
  12. {
  13.     char *old;
  14.     int r;
  15.  
  16.     r1--; r2--;
  17.     while(num--)
  18.       {
  19.           old = Screen[r2].old;
  20.           for (r = r2; r > r1; r--)
  21.             {
  22.                 Screen[r].line = Screen[r-1].line;
  23.                 Screen[r].n = Screen[r-1].n;
  24.                 Screen[r].flags = Screen[r-1].flags;
  25.                 Screen[r].old = Screen[r-1].old;
  26.             }
  27.  
  28.           Screen[r1].line = NULL;
  29.           Screen[r1].n = 0;
  30.           Screen[r1].flags = 0;
  31.           Screen[r1].old = old;
  32.           blank_line(r1);
  33.       }
  34. }
  35.  
  36. void vscroll_up(int r1, int r2, int num)
  37. {
  38.     char *old;
  39.     int r;
  40.  
  41.     r1--; r2--;
  42.     while(num--)
  43.       {
  44.           old = Screen[r1].old;
  45.           for (r = r1; r < r2; r++)
  46.             {
  47.                 Screen[r].line = Screen[r+1].line;
  48.                 Screen[r].n = Screen[r+1].n;
  49.                 Screen[r].flags = Screen[r+1].flags;
  50.                 Screen[r].old = Screen[r+1].old;
  51.             }
  52.  
  53.           Screen[r2].line = NULL;
  54.           Screen[r2].n = 0;
  55.           Screen[r2].flags = 0;
  56.           Screen[r2].old = old;
  57.           blank_line(r2);
  58.       }
  59. }
  60.  
  61. void vins(char ch)
  62. {
  63.     int r;
  64.     char *pins, *p;
  65.  
  66.     r = Screen_Row - 1;
  67.     if (ch > ' ') Screen[r].n += 1;
  68.     pins = Screen[r].old + Screen_Col - 1;
  69.     p = Screen[r].old + Window->width - 1;
  70.     while(p > pins)
  71.       {
  72.           *p = *(p - 1);
  73.           p--;
  74.       }
  75.     *p = ch;
  76. }
  77.  
  78. void vdel()
  79. {
  80.     int r;
  81.     char *pmax, *p;
  82.  
  83.     r = Screen_Row - 1;
  84.     p = Screen[r].old + Screen_Col - 1;
  85.     pmax = Screen[r].old + Window->width - 1;
  86.     while(p < pmax)
  87.       {
  88.           *p = *(p + 1);
  89.           p++;
  90.       }
  91.     *p = ' ';
  92. }
  93.  
  94. void vdel_eol()
  95. {
  96.     int r;
  97.     char *pmax, *p;
  98.  
  99.     r = Screen_Row - 1;
  100.     p = Screen[r].old + Screen_Col - 1;
  101.     pmax = Screen[r].old + Window->width - 1;
  102.     while(p < pmax)
  103.       {
  104.           *p = ' ';
  105.           p++;
  106.       }
  107.     *p = ' ';
  108. }
  109.  
  110.