/* */ /* Copyright Notice */ /* */ /* */ /* C version Copyright (C) 1984 Change Software, Inc. */ /* Copyright (C) 1978 1979 1980 1981 1982 1983 1984 1985 */ /* Change Software, Inc. */ /* */ /* */ /* This software is furnished under a license and may */ /* be used and copied only in accordance with the */ /* terms of such license and with the inclusion of */ /* the above copyright notice. This software or any */ /* other copies thereof may not be provided or other- */ /* wise made available to any other person. No title */ /* to and ownership of the software is hereby trans- */ /* ferred. */ /* */ #include "sysdef.h" #include "tempio.h" #include "scerrd.h" /*+ VTDELETELINE() delete current line, repeat or select range */ /*+ VTDELC() delete current char, if at eoln, merg lines */ /*+ VTDELW() delete current word */ /*+ VTDEOLN() delete to end of current line */ /*+ VTDBOLN() delete to start of current line */ /*+ VTERALINE() remove all characters in the line */ /*+ VTUNLINE() undelete the last deleted line */ /*+ VTUNWORD() undelete the last deleted word */ /*+ VTUNCHAR() undelete the last deleted character */ /*+ VTCUTDEL() cut and delete a select range */ #define CR 015 #define LF 012 #define FF 014 #define TAB 011 #define then vtdeleteline() { int printflag,offset,status,oldcurline ; register int firstline,nlines,i ; extern int *curline,cut_st,*lochigh,*loclow,*maxline,rept,read_only ; extern int page_size[],termtype ; creset() ; if ( rept < 2 && cut_st == 0 && read_only ) then vtmvup() ; else scunloadline() ; printflag = 0 ; offset = *curline - *loclow ; if ( rept ) then { firstline = *curline ; nlines = rept ; rept = 0 ; } else { if ( cut_st ) then { if ( read_only ) then (*curline)-- ; nlines = *curline - cut_st ; if ( nlines <= 0 ) then { nlines = 1 ; firstline = *curline ; } else { firstline = cut_st ; *curline = cut_st ; } cut_st = 0 ; } else { nlines = 1 ; firstline = *curline ; } } if ( nlines <= 0 ) then { vtbell() ; return(0) ; } oldcurline = *curline ; for (i=0; i= *maxline ) then rstpage(*loclow) ; if ( *curline >= *maxline ) then *curline = *lochigh ; scloadline() ; if ( status == 0 ) then nlines = i ; if ( nlines ) then { if ( *loclow == *lochigh ) then { rstpage(*loclow-page_size[termtype]) ; *curline = *lochigh ; scloadline() ; ref_screen() ; } else scdelline(nlines) ; } scloadline() ; return(status) ; } vtdelc() { register int status ; extern int worklength ; extern int *curline,*lochigh,*loclow,chposition,curposition,read_only ; status = 0 ; if ( read_only ) then return(0) ; if ( atcrlf() ) then { scunloadline() ; (*curline)++ ; scloadline() ; if ((*curline)-1 == *lochigh && read_only==0) then status = delline( *curline ) ; else if ( read_only == 0 ) then status = vtdeleteline() ; (*curline)-- ; scloadline() ; if ( status ) then { creset() ; while ( atcrlf() == 0 ) pinc() ; scmove() ; svlinsert( chposition ) ; lkill() ; partdump() ; scmove() ; } else delc() ; } else delc() ; return(1) ; } static delc() { extern int chposition,read_only ; if ( read_only ) then return(0) ; remchar(chposition) ; scmove() ; lkill() ; partdump() ; scmove() ; } vtdelword() { register int status ; extern int read_only ; if ( read_only ) then return(0) ; if ( atcrlf() ) then vtdelc() ; status = delword() ; scmove() ; lkill() ; partdump() ; scmove() ; return(status) ; } vtdeoln() { extern int chposition,read_only ; if ( read_only ) then return(0) ; sveoln(chposition) ; deleoln(chposition) ; lkill() ; scmove() ; partdump() ; scmove() ; return(1) ; } vtdboln() { extern int chposition,read_only ; if ( read_only ) then return(0) ; svboln(chposition) ; delboln(chposition) ; creset() ; scmove() ; lkill() ; partdump() ; scmove() ; return(1) ; } vteraline() { extern int chposition,read_only ; if ( read_only ) then return(0) ; creset() ; sveoln(chposition) ; while ( atcrlf() == 0 ) remchar( chposition ) ; scmove() ; lkill() ; } vtunline() { extern int chposition,read_only ; extern struct deltype lastdeleted ; register int status,save_partial ; save_partial = lastdeleted.lastline.partial ; if ( read_only ) then lastdeleted.lastline.partial = 0 ; if (lastdeleted.lastline.partial == 0 ) then { creset() ; sclinsert(CR) ; creset() ; } status = svlinsert(chposition) ; lastdeleted.lastline.partial = save_partial ; unfin() ; return( status ) ; } vtunword() { extern int chposition,read_only ; register int status ; if ( read_only ) then return(0) ; status = svwinsert(chposition) ; unfin() ; return( status ) ; } vtunchar() { extern int chposition,read_only ; register int status ; if ( read_only ) then return(0) ; status = svcinsert(chposition) ; unfin() ; return( status ) ; } static unfin() { lkill() ; partdump() ; scmove() ; } vtcutdel() { extern int cut_st ; register int oldcutst ; if ( chkselect() == 0 ) then return(0) ; if ( cut_st == 0 ) then { scwarning( w_nocu ) ; return(0) ; } else { oldcutst = cut_st ; vtmark() ; cut_st = oldcutst ; vtdeleteline() ; } }