home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume7 / rvi / part1 / rv_delcol.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-11-30  |  604 b   |  35 lines

  1. #include "rv.h"
  2.  
  3. void delete_columns(first, last)
  4. /*
  5.  *  Delete - delete columns from current line
  6.  */
  7. INT    first,last;
  8. {
  9.     register struct sc_screen *sc;
  10.     register struct li_line   *line;
  11.     register char    *s1, *s2;
  12.  
  13.     sc = &screen;
  14.     save_Undo();
  15.     line = sc->sc_curline;
  16.     /*
  17.      * Compact line
  18.      */
  19.     s1 = &line->li_text[first];
  20.     s2 = &line->li_text[last+1];
  21.     while (*s1++ = *s2++)
  22.         ;
  23.     /*
  24.      * Draw line
  25.      */
  26.     redraw_curline(line->li_text);
  27.     /*
  28.      * Adjust cursor
  29.      */
  30.     sc->sc_column = first;
  31.     if (sc->sc_column >= line->li_width)
  32.         sc->sc_column = line->li_width-1;
  33.     move_cursor(sc->sc_lineno, sc->sc_column);
  34. }
  35.