Google
 

Trailing-Edge - PDP-10 Archives - mit_emacs_170_teco_1220 - emacs/scrlin.emacs
There are no other files named scrlin.emacs in the archive.
!* -*-TECO-*- !
!~FILENAME~:! !SCRLIN macros for moving on screen lines!
SCRLIN
!& Setup SCRLIN Library:! !S Assign ^A, ^E, ^N, ^P!

   !* screen line moving commands!
   M.M ^R_Beginning_of_Line U.A
   M.M ^R_End_of_line       U.E
   M.M ^R_Down_Line         U.N
   M.M ^R_Up_Line           U.P
   FS RGETTY "G 1 M.V Use_Screen_Lines'   !* only on printing consoles!
!& Kill SCRLIN Library:! !S Remove redefinitions!

 m.m ^R_Beginning_of_Line-qA"e fs ^R InituA'
 m.m ^R_End_of_Line-qE"e fs ^R InituE'
 m.m ^R_Down_Line-qN"e m.m ^R_Down_Real_LineuN'
 m.m ^R_Up_Line-qP"e m.m ^R_Up_Real_LineuP'
!^R Down Line:! !^R Move down vertically to next real line.
Continuation lines are normally skipped.  If given after the
last LF in the buffer, makes a new one at the end.
If Use Screen Lines is 1, then continuation lines are not skipped.!

!* If Q.H contains a 1 in the left half, then its right half is a "permanent goal",!
!* and we should not clobber it.  Otherwise, it contains a temporary goal,!
!* which we should clobber if previous character wasn't vertical motion.!

    0FO..Q Use_Screen_Lines F"N W 1' [S    !* flag for using screen lines!
    FS ^R PREV-1002"N		    !* If previous command wasnt up or down real line,!
       Q.H-777777."L		    !* and goal isn't permanent,!
       FS ^R HPOSU.H''	    !* Current hpos becomes goal. Else goal not changed.!
    1002 FS ^R LAST		    !* Identify this command as up or down real.!
    FF"E QS"E @:L'		    !* hack for no arg:  first go to end of line!
               "#  1:<0,(FSWIDTH):FM>W '   !* otherwise, screen line!
         .-Z"E I
          -2'		    !* then if no next line, make one.!
         QS"E L''		    !* if there is one, go to it now or later.!
      "# QS"E @L'"#  US''	    !* Do have arg => move that many lines.!
    1:< QS,Q.H&777777. :FM >	    !* Find our goal, horizontally.!
    FS I&DLINE"N FS OSPEEDF"N-1200:"G 99F[%CENTER @0V'''
    0
!^R Up Line:! !^R Move up vertically to next real line.
Continuation lines are skipped unless Use Screen Lines is 1!
    0FO..Q Use_Screen_Lines F"N W 1' [S    !* flag for using screen lines!
    FS ^R PREV-1002"N		    !* If previous command wasnt up or down real line,!
       Q.H-777777."L		    !* and goal isn't permanent,!
          FS ^R HPOSU.H''	    !* Current hpos becomes goal. Else goal not changed.!
    1002 FS ^R LAST		    !* Identify this command as up or down real.!
    QS"N - F"E -1' US'	    !* do at least one line!
    1:< QS,Q.H&777777. (QS"E @-L : '"# @') FM > !* Find our goal, horizontally.
!     "N 1:<0,Q.H&777777. :FM>'	    !* if cant get there, reposition on this line!
    FS I&DLINE"N FS OSPEEDF"N-1200:"G 0F[%CENTER @0V'''
    0
!^R Beginning of Line:! !^R Go to beginning of line.
Normally, this refers to text lines (i.e. go to after the previous CRLF).
However, if Use Screen Lines is 1, it refers to the beginning of a screen
line (only useful on display consoles).  If the cursor is already at the
edge of the screen on a continued line, then the cursor is moved to the
beginning of the preceeding screen line.  With an argument, the cursor is
always moved to the beginning of the text line.!

    0FO..Q Use_Screen_Lines "E @0L 0'    !* normally, use text lines!
    FF "N @0L 0 '		    !* also when given an argument!

    !* Hacks for moving over line continuations!
    FS SAIL "E FS ^R HPOS-1"E 40.,0A-40."L :R'''  !* Special hack for split CTRL char!
    FS ^R HPOS "E 12.,0A-12."N R'' !* If at beginning of a screen line!
				    !* but not text line, move back first.!
    :<0,0 @ FM			    !* otherwise, beginning of screen line!
      fs ^H Print "L		    !* worry about the backspace case?!
         0a-"E R'"# 0;''"# 0;'>W
    0
!^R End of Line:! !^R Go to end of the line.
Normally, this refers to text lines (i.e. go to before the next CRLF).
However, if Use Screen Lines is 1, it refers to the end of a screen
line (only useful on display consoles).  If the cursor is already at the
edge of the screen on a continued line, then the cursor is moved to the
beginning of the next screen line first.  With an argument, the cursor
is always moved to the end of the text line.!
    0FO..Q Use_Screen_Lines "E @:L 0'    !* normally, end of text line!
    FF "N @:L 0'		    !* also, when given an arg.!
    
    !* Hacks for moving past continuations!
    FS SAIL "E			    !* not relevent in SAIL mode!
       FS ^R HPOS-(FSWIDTH-2) "E  !* hack for control chars at EOL!
	  40.,1A-40."L :C '''

    FS ^R HPOS-(FS WIDTH-1) "E    !* If at screen edge and not CRLF!
        @ F 
   "E :C''    !* then move to next line!

    1:<0,(FSWIDTH):FM> W	    !* Move to end of screen line!
    0