Screen Editing

T

Thomas Dickey

Tak-Shing Chan said:
I don't need to know the answer, since Steve Summit's C-FAQ
rofl...

19.4 covered this (``for clearing the screen, a halfway portable
solution is to print a form-feed character ('\f'), which will
cause some displays to clear''). Presumably, those displays that
would clear are still in use.

The faq does contain some archaisms (and outright errors).

p.s: appeals to authority are generally regarded as inferior to direct
observation - something to consider if you choose to pursue a
technical career ;-)
 
T

Tak-Shing Chan

The faq does contain some archaisms (and outright errors).

p.s: appeals to authority are generally regarded as inferior to direct
observation - something to consider if you choose to pursue a
technical career ;-)

Direct observations aren't always statistically significant.

Tak-Shing
 
M

Mark McIntyre

On Thu, 17 Aug 2006 22:40:44 +0100, in comp.lang.c , Tak-Shing Chan

(stuff to some guy called Dickey).

Chan, given that my kill filters automatically picked this guy up, I
suspect "Dickey" is a sock puppet for an existing troll. I suggest you
killfile him.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
T

Thomas Dickey

(stuff to some guy called Dickey).

hmm - this seems to be your usual level, so I won't follow your lead.
Chan, given that my kill filters automatically picked this guy up, I
suspect "Dickey" is a sock puppet for an existing troll. I suggest you
killfile him.

not at all.
Unlike present company, I happen to know what I'm talking about.
 
K

Keith Thompson

Ancient_Hacker said:
and it's not clear terminal control falls under the baliwick of the C
language or th standard C libraries..

In fact, it's perfectly clear that terminal control does *not* fall
under the bailiwick of the standard C language and library.
The most portable way is dorky, but works most every place I can think
of:


for( i=1; i <= 66 + 24 /* for those TALL full page displays,plus
lagniappe */; i++ )
puts( "\n" );

There's no reason to assume that the terminal window is no taller than
66 rows. I'm typing this in a 65-row window, and I could easily
expand it.

Also, depending on what kind of terminal or emulator you're using, the
"erased" lines can just be scrolled off the top of the screen/window,
where they can be recovered. If I clear the screen, it's often
because I want to erase some sensitive information, and scrolling it
out of sight isn't good enough.

And, of course, it leaves the cursor at the bottom of the window.

Clearing the screen, or, more generally, controlling cursor position,
is one of those things that can *almost* be done in standard C with
some really ugly tricks, but there's almost always a much cleaner
system-specific solution. Don't waste your time trying to do it
portably.
 
K

Keith Thompson

Andrew Smallshaw said:
Most terminals, particularly modern ones, will clear the screen if
you simply send them a formfeed. It's not guaranteed, but it's a
similar kind of assumption to backspace will move the cursor left
which seems pretty much standard these days.

I haven't found that to be the case for any of the terminal emulators
I use. I've just tried xterm, dtterm, gnome-terminal, a Windows
command window, the GNU "screen" program, and rxvt; none of them clear
the screen in response to a formfeed character.
 
T

Tak-Shing Chan

hmm - this seems to be your usual level, so I won't follow your lead.


not at all.
Unlike present company, I happen to know what I'm talking about.

Really? Do you know anything about these 120 terminals?
According to my termcap (yes, appealing to authority again), they
all respond to form feeds by clearing the screen:

glasstty|classic glass tty interpreting ASCII control characters:\
pmcons|pmconsole|PMAX console:\
ibmpcx|xenix|ibmx|IBM PC xenix console display:\
ofcons:\
rcons|BSD rasterconsole:\
rcons-color|BSD rasterconsole with ANSI color:\
bsdos-sparc|Sun SPARC BSD/OS Console:\
mterm|mouse-sun|Der Mouse term:\
mgr|Bellcore MGR (non X) window system terminal emulation:\
mgr-sun|Mgr window with Sun keyboard:\
mgr-linux|Mgr window with Linux keyboard:\
oldsun|Sun Microsystems Workstation console:\
sun-il|Sun Microsystems console with working insert-line:\
sun-cgsix|sun-ss5|Sun SparcStation 5 console:\
sun|sun1|sun2|Sun Microsystems Inc. workstation console:\
sun-s|Sun Microsystems Workstation window with status line:\
sun-e-s|sun-s-e|Sun Microsystems Workstation with status hacked for emacs:\
sun-48|Sun 48-line window:\
sun-34|Sun 34-line window:\
sun-24|Sun 24-line window:\
sun-17|Sun 17-line window:\
sun-12|Sun 12-line window:\
sun-1|Sun 1-line window for sysline:\
sun-e|sun-nic|sune|Sun Microsystems Workstation without insert character:\
sun-c|sun-cmd|Sun Microsystems Workstation console with scrollable history:\
sun-type4|Sun Workstation console with type 4 keyboard:\
psterm|psterm-basic|NeWS psterm-80x34:\
psterm-96x48|NeWS psterm 96x48:\
psterm-90x28|NeWS psterm 90x28:\
psterm-80x24|NeWS psterm 80x24:\
psterm-fast|NeWS psterm fast version (flaky ctrl chars):\
next|NeXT console:\
wyse-vp|Wyse 50 in ADDS Viewpoint emulation mode with "enhance" on:\
rbcomm|IBM PC with RBcomm and EMACS keybindings:\
rbcomm-nam|IBM PC with RBcomm without autowrap:\
rbcomm-w|IBM PC with RBcomm in 132 column mode:\
att5620-s|tty5620-s|layer|vitty|5620 S layer:\
aas1901|Ann Arbor K4080 w/S1901 mod:\
regent|Adds Regent Series:\
regent100|Adds Regent 100:\
regent20|Adds Regent 20:\
regent25|Adds Regent 25:\
regent40|Adds Regent 40:\
regent40+|Adds Regent 40+:\
regent60|regent200|Adds Regent 60:\
viewpoint|addsviewpoint|adds viewpoint:\
screwpoint|adds viewpoint with ^O bug:\
vp60|viewpoint60|addsvp60|adds viewpoint60:\
cdc721|CDC Viking:\
cdc721ll|CDC Vikingll:\
cdc721-esc|Control Data 721:\
dg-generic|Generic Data General terminal in DG mode:\
dg200|data general dasher 200:\
dg211|Data General d211:\
dg450|dg6134|data general 6134:\
dg6053-old|dg100|data general 6053:\
dg6053|6053|6053-dg|dg605x|605x|605x-dg|d2|d2-dg|Data General DASHER 6053:\
d200|d200-dg|Data General DASHER D200:\
d210-dg|d214-dg|Data General DASHER D210 series in DG mode:\
d211-dg|d215-dg|Data General DASHER D211 series in DG mode:\
d216-dg|d216e-dg|d216+dg|d216e+dg|d217-dg|Data General DASHER D216 series in DG mode:\
d220-dg|Data General DASHER D220 color terminal in DG mode:\
d230c-dg|d230-dg|Data General DASHER D230C in DG mode:\
d400|d400-dg|d450|d450-dg|Data General DASHER D400/D450 series:\
d410-dg|d460-dg|d411-dg|d461-dg|Data General DASHER D410/D460 series in DG mode:\
d412-dg|d462-dg|d462e-dg|d412+dg|d462+dg|d413-dg|d463-dg|Data General DASHER D412/D462 series in DG mode:\
d430c-dg|d430-dg|Data General D430C in DG mode:\
d430c-dg-ccc|d430-dg-ccc|Data General D430C in DG mode with configurable colors:\
d470c-dg|d470-dg|Data General DASHER D470C in DG mode:\
d555-dg|Data General DASHER D555 series in DG mode:\
d577-dg|d578-dg|Data General DASHER D577/D578 series in DG mode:\
dm1520|dm1521|datamedia 1520:\
dt80-sas|Datamedia DT803/DTX for SAS usage:\
hz1000|hazeltine 1000:\
ibm-apl|apl|IBM apl terminal simulator:\
i100|gt100|gt100a|General Terminal 100A (formerly Infoton 100):\
addrinfo:\
infoton:\
prism9|p9|P9|MDC Prism-9 in ANSII mode:\
prism9-w|p9-w|P9-W|MDC Prism-9 in 132 column mode:\
prism12|p12|P12|MDC Prism-12 in ANSI mode:\
prism12-w|p12-w|P12-W|MDC Prism-12 in 132 column mode:\
prism14|p14|P14|MDC Prism-14 in ANSII mode:\
prism14-w|p14-w|P14-W|MDC Prism-14 in 132 column mode:\
p8gl|prism8gl|McDonnell-Douglas Prism-8 alternate definition:\
mime314|mm314|mime 314:\
ncr7900i|ncr7900|ncr 7900 model 1:\
ncr7900iv|ncr 7900 model 4:\
ncr7901|ncr 7901 model:\
uts30|sperry uts30 with cp/m@1R1:\
vc415|volker-craig 415:\
ibm-pc|ibm5051|5051|IBM Personal Computer (no ANSI.SYS):\
appleIIgs|appleIIe|appleIIc|Apple 80 column firmware interface:\
apple-ae|ASCII Express:\
appleII|apple ii plus:\
apple-uterm-vb|Videx Ultraterm for Apple micros with Visible Bell:\
apple-uterm|Ultraterm for Apple micros:\
lisa|apple lisa console display (black on white):\
liswb|apple lisa console display (white on black):\
mac|macintosh|Macintosh with MacTerminal:\
mac-w|macterminal-w|Apple Macintosh with Macterminal in 132 column mode:\
trs2|trsII|trs80II|Radio Shack Model II using P&T CP/M:\
trs16|trs-80 model 16 console:\
minitel1|minitel 1:\
minitel1b|minitel 1-bistandard (in 40cols mode):\
blit|jerq|blit running teletype rom:\
cbblit|fixterm|blit running columbus code:\
oblit|ojerq|first version of blit rom:\
cg7900|chromatics|chromatics 7900:\
intertube|intertec|Intertec InterTube:\
intertube2|intertec data systems intertube 2:\
rca|rca vp3301/vp3501:\
swtp|ct82|southwest technical products ct82:\
t3700|dumb teleray 3700:\
t3800|teleray 3800 series:\
apollo|apollo console:\
aws|Convergent Technologies AWS workstation under UTX and Xenix:\
awsc|Convergent Technologies AWS workstation under CTOS:\
aj510|Anderson-Jacobson model 510:\
d132|datagraphix|datagraphix 132a:\
teletec|Teletec Datascreen:\

Tak-Shing
 
T

Tak-Shing Chan

I haven't found that to be the case for any of the terminal emulators
I use. I've just tried xterm, dtterm, gnome-terminal, a Windows
command window, the GNU "screen" program, and rxvt; none of them clear
the screen in response to a formfeed character.

I have just posted a long list elsethread.

Tak-Shing
 
S

Steve Summit

Keith said:
I haven't found that to be the case for any of the terminal emulators
I use. I've just tried xterm, dtterm, gnome-terminal, a Windows
command window, the GNU "screen" program, and rxvt; none of them clear
the screen in response to a formfeed character.

I had no idea that \f had fallen into disuse.
I'm updating FAQ 19.4 accordingly.
 
T

Thomas Dickey

Tak-Shing Chan said:
hmm - this seems to be your usual level, so I won't follow your lead.


not at all.
Unlike present company, I happen to know what I'm talking about.
[/QUOTE]
Really? Do you know anything about these 120 terminals?

Sure. And I know how to use google too. Since you don't, I'll help:

xterm supports ANSI color, VT220 emulation and UTF-8
There's an faq at
http://invisible-island.net/xterm/xterm.faq.html
ftp://invisible-island.net/xterm/

The current version of ncurses is 5.5 (20051010)
There's an faq at
http://invisible-island.net/ncurses/ncurses.faq.html
According to my termcap (yes, appealing to authority again), they
all respond to form feeds by clearing the screen:

Let's stick to "most" and "modern". Do you understand the terms?
I'm assuming you don't, given the list you presented -
even ignoring the duplicates.
(and no, I won't waste time here by giving a chronology ;-)

most+modern would imply something like "in widespread use during the past
ten years". There - add that to your glossary.
 
B

Ben Pfaff

Keith Thompson said:
There's no reason to assume that the terminal window is no taller than
66 rows. I'm typing this in a 65-row window, and I could easily
expand it.

(The above actually works with displays up to 180 rows high.)

For some reason, no one liked this suggestion of mine when I
brought it during the last discussion of this issue:

for (;;)
putchar('\n');

It should be effective just about everywhere, even on very tall
terminals or those with a circular scrollback buffer. It will
even get the attention of those using printing terminals.
 
T

Tak-Shing Chan

Sure. And I know how to use google too. Since you don't, I'll help:

xterm supports ANSI color, VT220 emulation and UTF-8
There's an faq at
http://invisible-island.net/xterm/xterm.faq.html
ftp://invisible-island.net/xterm/

The current version of ncurses is 5.5 (20051010)
There's an faq at
http://invisible-island.net/ncurses/ncurses.faq.html

Irrelevant.
Let's stick to "most" and "modern". Do you understand the terms?
I'm assuming you don't, given the list you presented -
even ignoring the duplicates.
(and no, I won't waste time here by giving a chronology ;-)

most+modern would imply something like "in widespread use during the past
ten years". There - add that to your glossary.

Are you saying that Sun SPARC machines are not ``in
widespread use during the past ten years''? That is news to me.

By the way, I believe that ``modern'' on comp.lang.c means
post-1989 (when ANSI C is born).

Tak-Shing
 
T

Thomas Dickey

Tak-Shing Chan said:
Are you saying that Sun SPARC machines are not ``in
widespread use during the past ten years''? That is news to me.

You cited several duplicates. "Widespread" is debatable in this case,
since (aside from the rarely-used console, Sun hasn't supported a terminal
emulator for this for more than ten years - it's been that long that the
openwin programs have been regarded as unsupported/legacy/doomed).

For the others - spend a few moments to see how long it's been since the
actual terminals were sold as new.
By the way, I believe that ``modern'' on comp.lang.c means
post-1989 (when ANSI C is born).

no - the topic changed from ANSI C to terminal emulators, and the modern
era for that was the related curses work in X/Open. 1996.
 
T

Tak-Shing Chan

You cited several duplicates. "Widespread" is debatable in this case,
since (aside from the rarely-used console, Sun hasn't supported a terminal
emulator for this for more than ten years - it's been that long that the
openwin programs have been regarded as unsupported/legacy/doomed).

For the others - spend a few moments to see how long it's been since the
actual terminals were sold as new.


no - the topic changed from ANSI C to terminal emulators, and the modern
era for that was the related curses work in X/Open. 1996.

That is only true if you are using UNIX. Many modern systems
do not use curses.

Tak-Shing
 
T

Thomas Dickey

That is only true if you are using UNIX. Many modern systems
do not use curses.

Those that don't, either use vt100-compatible terminals (OpenVMS), or do
not make use of terminals (barring the miniscule fraction running Plan 9 ;-)

hmm - a few readers of this group could tell if 9term clears the screen
on a form-feed (it doesn't appear so to me, from reading its code).
 
T

Tak-Shing Chan

Those that don't, either use vt100-compatible terminals (OpenVMS), or do
not make use of terminals (barring the miniscule fraction running Plan 9 ;-)

There are embedded Linux systems without curses.

Tak-Shing
 
J

J. J. Farrell

Tak-Shing Chan said:
I have just posted a long list elsethread.

You posted a long list which has no obvious relevance to the point in
question. The list is a long way from "most terminals" and few of the
ones listed count as modern (one was recently sold as a rare antique
computer, many are archaic museum pieces).
 
T

Thomas Dickey

Tak-Shing Chan said:
No wonder you are so keen on xterm and ncurses---I just
noticed that you are the current maintainer of both!

That's been the case for more than ten years.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,010
Messages
2,570,273
Members
46,882
Latest member
VeronaMars

Latest Threads

Top