Scrollback - Stephen

From Gwen Morse's Wiki
Jump to: navigation, search
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; TF Scrollback
;;;
;;; >I really like tinyfugue, however I haven't been able to find a way to scroll
;;; >up in the non-typed lines. Something like pressing page-up, which would
;;; >scroll the top window (in visual mode) up. (shift-pageup works in most
;;; >terminal emus, but I don't want the bottom lines for input to scroll away).
;;; > 
;;; >Does this exist and have I missed it, or can it be implemented?
;;;
;;; Some time ago I wrote a macro to get PgUp and PgDown working correctly. 
;;; Don't wonder at the strange names - they are a wild mixture between english and
;;; german. ;-)
;;;
;;; Stephan Lichtenhagen (stephan at lichtenhagen dot de)
;;;
;;; Modified by Gwen Morse to only recall 'World' information, not TF commands.
;;; 'Breaks' sometimes in that it doesn't always calculate the correct amount of screen
;;; size to recall, nor does it properly handle '/more on' and '/more off'.

/set LastLine 0
/def -b'^[[5~' Hist_back=\
        /let Zeilen $[lines() - (visual =~ 'on' ? isize+5 : 5)]%;\
        /if (!LastLine | (time() - Hist_Time > 120)) \
                /test regmatch('([0-9]+): ', $$(/recall -q -w -ag #1))%;\
                /set LastLine %P1%;\
                /let Hist_Anzeigen 1%;\
        /else \
                /if (LastLine <= Zeilen) \
                        /beep 1%;\
                /else \
                        /set LastLine $[FirstLine - 1]%;\
                        /let Hist_Anzeigen 1%;\
                /endif%;\
        /endif%;\
        /set FirstLine $[LastLine > Zeilen ? LastLine - Zeilen : 1]%;\
        /set Hist_Time $[time()]%;\
        /if (Hist_Anzeigen) \
                /if ((more =~ 'on') & (!moresize())) \
                        /set more off%;\
                        /set more on%;\
                /endif%;\
                /recall -q -w -ag %{FirstLine}-%{LastLine}%;\
        /endif
/def -b'^[[6~' Hist_vor=\
        /let Zeilen $[lines() - (visual =~ 'on' ? isize+5 : 5)]%;\
        /test regmatch('([0-9]+): ', $$(/recall -q -w -ag #1))%;\
        /let BottomLine %P1%;\
        /if (!LastLine | (time() - Hist_Time > 120)) \
                /set LastLine %BottomLine%;\
                /beep 1%;\
        /else \
                /if (LastLine == BottomLine) \
                        /beep 1%;\
                        /set LastLine %BottomLine%;\
                /else \
                        /set LastLine $[LastLine + Zeilen < BottomLine ? \
                                LastLine + Zeilen + 1 : BottomLine]%;\
                        /let Hist_Anzeigen 1%;\
                /endif%;\
        /endif%;\
        /set Hist_Time $[time()]%;\
        /set FirstLine $[LastLine > Zeilen ? LastLine - Zeilen : 1]%;\
        /if (Hist_Anzeigen) \
                /if ((more =~ 'on') & (!moresize())) \
                        /set more off%;\
                        /set more on%;\
                /endif%;\
                /recall -q -w -ag %{FirstLine}-%{LastLine}%;\
        /endif

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;