From 9190ba057c5714e3f78bd68a62c06cc9386e3d76 Mon Sep 17 00:00:00 2001 From: Doug Barton Date: Mon, 14 Dec 2009 07:18:31 +0000 Subject: [PATCH] Revert the xterm terminal behavior to NOT clear the screen after exiting a pager, vi, etc. Add some example xterm*-clear entries to the termcap files to make it easier for people to enable that behavior. Document the examples in the man page to make them easier to find. --- etc/termcap.small | 7 ++++++- share/termcap/termcap.5 | 19 ++++++++++++++++++- share/termcap/termcap.src | 35 +++++++++++++++++++++++++++++------ 3 files changed, 53 insertions(+), 8 deletions(-) diff --git a/etc/termcap.small b/etc/termcap.small index 9e7165e8ecaa..d51147117592 100644 --- a/etc/termcap.small +++ b/etc/termcap.small @@ -312,7 +312,7 @@ xterm-basic|modern xterm common:\ :kD=\E[3~:kb=^H:ke=\E[?1l\E>:ks=\E[?1h\E=:le=^H:md=\E[1m:\ :me=\E[m:ml=\El:mr=\E[7m:mu=\Em:nd=\E[C:op=\E[39;49m:\ :rc=\E8:rs=\E[!p\E[?3;4l\E[4l\E>:sc=\E7:se=\E[27m:sf=^J:\ - :so=\E[7m:sr=\EM:st=\EH:te=\E[?1049l:ti=\E[?1049h:\ + :so=\E[7m:sr=\EM:st=\EH:\ :ue=\E[24m:up=\E[A:us=\E[4m:ve=\E[?12l\E[?25h:vi=\E[?25l:vs=\E[?12;25h: # # This is the only entry which you should have to customize, since "xterm" @@ -320,3 +320,8 @@ xterm-basic|modern xterm common:\ # color_xterm and rxvt. xterm|X11 terminal emulator:\ :tc=xterm-new: +# +# Add the capability to "clear the screen" after exiting vi, more/less, etc. +xterm-clear:\ + :te=\E[?1049l:ti=\E[?1049h:\ + :tc=xterm-new: diff --git a/share/termcap/termcap.5 b/share/termcap/termcap.5 index bb5b5123c34e..603e786cf4f6 100644 --- a/share/termcap/termcap.5 +++ b/share/termcap/termcap.5 @@ -53,7 +53,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 16, 1994 +.Dd December 13, 2009 .Dt TERMCAP 5 .Os .Sh NAME @@ -1999,6 +1999,22 @@ Unfortunately, due to lack of a definition for string parameters in only .Xr terminfo 5 supports these capabilities. +.Pp +For the +.Xr xterm 1 +terminal emulator the traditional behavior in +FreeBSD when exiting a pager such as +.Xr less 1 +or +.Xr more 1 , +or an editor such as +.Xr vi 1 +is NOT to clear the screen after the program exits. +If you prefer to clear the screen there are a number of +.Dq xterm-clear +entries that add this capability in the +.Nm +file that you can use directly, or as examples. .Ss Glitches and Braindamage Hazeltine terminals, which do not allow `~' characters to be displayed, should indicate @@ -2105,6 +2121,7 @@ Hash database file containing terminal descriptions (see .Xr tset 1 , .Xr ul 1 , .Xr vi 1 , +.Xr xterm 1 , .Xr ncurses 3 , .Xr printf 3 , .Xr termcap 3 , diff --git a/share/termcap/termcap.src b/share/termcap/termcap.src index af4bf3913695..40fcc7be2389 100644 --- a/share/termcap/termcap.src +++ b/share/termcap/termcap.src @@ -2800,7 +2800,12 @@ SW|screen-w|VT 100/ANSI X3.64 virtual terminal with 132 cols:\ # # I checked the limits using ncurses "captoinfo -CrTUvx", which prints # the resolved length of each entry in a comment at the end - T.Dickey + +# Add the capability to "clear the screen" after exiting vi, more/less, etc. # +xterm-clear:\ + :te=\E[?1049l:ti=\E[?1049h:\ + :tc=xterm-new: xterm-new|modern xterm:\ :*6=\EOF:@7=\EOF:F1=\E[23~:F2=\E[24~:K2=\EOE:Km=\E[M:\ :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:\ @@ -2820,7 +2825,7 @@ xterm-basic|modern xterm common:\ :kD=\E[3~:kb=^H:ke=\E[?1l\E>:ks=\E[?1h\E=:le=^H:md=\E[1m:\ :me=\E[m:ml=\El:mr=\E[7m:mu=\Em:nd=\E[C:op=\E[39;49m:\ :rc=\E8:rs=\E[!p\E[?3;4l\E[4l\E>:sc=\E7:se=\E[27m:sf=^J:\ - :so=\E[7m:sr=\EM:st=\EH:te=\E[?1049l:ti=\E[?1049h:\ + :so=\E[7m:sr=\EM:st=\EH:\ :ue=\E[24m:up=\E[A:us=\E[4m:ve=\E[?12l\E[?25h:vi=\E[?25l:vs=\E[?12;25h: # The xterm-new description has all of the features, but is not completely @@ -2886,6 +2891,12 @@ xterm-xmc|xterm alias 6:\ # # An 8-bit description is doable with termcap, but there are probably no # termcap (or BSD curses) applications that are able to use it. +# +# Add the capability to "clear the screen" after exiting vi, more/less, etc. +# +xterm-8bit-clear:\ + :te=\233?1049l:ti=\233?1049h:ue=\23324m:\ + :tc=xterm-8bit: xterm-8bit|xterm terminal emulator 8-bit controls (X Window System):\ :am:km:mi:ms:xn:\ :co#80:it#8:li#24:\ @@ -2902,7 +2913,7 @@ xterm-8bit|xterm terminal emulator 8-bit controls (X Window System):\ :ke=\233?1l\E>:kh=\2331~:kl=\217D:kr=\217C:ks=\233?1h\E=:\ :ku=\217A:le=^H:mb=\2335m:md=\2331m:me=\233m:mr=\2337m:\ :nd=\233C:rc=\E8:sc=\E7:se=\23327m:sf=^J:so=\2337m:sr=\215:\ - :st=\210:ta=^I:te=\233?1049l:ti=\233?1049h:ue=\23324m:\ + :st=\210:ta=^I:ue=\23324m:\ :up=\233A:us=\2334m:vb=\233?5h\233?5l:ve=\233?25l\233?25h:\ :vs=\233?12;25h:vi=\233?25l: # @@ -2941,6 +2952,12 @@ xterm-ic|xterm-vi|xterm with insert char:\ :IC=\E[%d@:ei@:ic=\E[@:im@:tc=xterm: # # Compatible with the X11R6.3 xterm +# +# Add the capability to "clear the screen" after exiting vi, more/less, etc. +# +xterm-r6-clear:\ + :te=\E[2J\E[?47l\E8:ti=\E7\E[?47h:ue=\E[m:\ + :tc=xterm-r6: xterm-r6|xterm-old|X11R6 xterm:\ :am:bs:km:mi:ms:pt:xn:\ :co#80:kn#20:li#24:\ @@ -2958,10 +2975,16 @@ xterm-r6|xterm-old|X11R6 xterm:\ :ke=\E[?1l\E>:kh=\E[1~:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\ :ku=\EOA:md=\E[1m:me=\E[m:ml=\El:mr=\E[7m:mu=\Em:nd=\E[C:\ :rc=\E8:rs=\E[m\E[?7h\E[4l\E>\E7\E[r\E[?1;3;4;6l\E8:\ - :sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:te=\E[2J\E[?47l\E8:\ - :ti=\E7\E[?47h:ue=\E[m:up=\E[A:us=\E[4m: + :sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:\ + :ue=\E[m:up=\E[A:us=\E[4m: # # Compatible with the R5 xterm +# +# Add the capability to "clear the screen" after exiting vi, more/less, etc. +# +xterm-r5-clear:\ + :te=\E[2J\E[?47l\E8:ti=\E7\E[?47h:ue=\E[m:\ + :tc=xterm-r5: xterm-r5|X11R5 xterm X11R5:\ :am:bs:km:mi:ms:pt:xn:\ :co#80:kn#4:li#24:\ @@ -2974,8 +2997,8 @@ xterm-r5|X11R5 xterm X11R5:\ :ke=\E[?1l\E>:kh=\E[1~:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\ :ku=\EOA:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:rc=\E8:\ :rs=\E>\E[?1;3;4;5;6l\E[4l\E[?7h\E[m\E[r\E[2J\E[H:\ - :sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:te=\E[2J\E[?47l\E8:\ - :ti=\E7\E[?47h:ue=\E[m:up=\E[A:us=\E[4m: + :sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:\ + :up=\E[A:us=\E[4m: # # Customization begins here. xterm-xfree86|xterm terminal emulator (XFree86):\