[comp.text] destructive backspace on vi

dbar@csuchico.edu (David Barrett) (08/31/90)

When I use a screen editor, I like a "destructive backspace"
(you back up and the character under the cursor disappears).
Previous versions of vi that I have used (on ATT for example) 
have had this feature, I think.  But I am now using HP Version 
64.22.1.1 of vi on HP-UX 7.0 OS (this is response to ":ve"
command), where backspace apparently is nondestructive and 
can't be altered by ordinary users.

The man page for vi says erase = ^H, and ^H "returns the cursor to 
the last input character without erasing it".  That, I presume,
is final.  The system administrator here thinks there may be 
no solution to this but to find the pertinent line in vi source code,  
change it, and recompile.  Even if it is legal to revise source
code, it is hardly practical, I gather.  (i.e. Why make a change 
like that just to satisfy just one user? ) 

All the vi literature I have read says that the erase function 
can be linked to the key of your choice with the command "stty 
erase DEL", where the DEL is actually <CNTL> v DEL.  I do this
on the HP-UX system and I get a destructive backspace for commands
from the login shell mapped to the key of my choice.  Likewise for 
the ex editor.  But in vi, d.b.s. is against the rules.  Why is
this?  If d.b.s. is a good thing at the command level, and a good
thing in a line editor, why should it be a bad thing in a screen
editor? 

Is there some way to customize the editor for d.b.s. that I have 
not thought of?  Or does Confucius say "forget it"?

(Note:  I am new to UseNet.  I just read the info for new users.
I would like a reply in my mailbox, as shown above, and I'd be
glad to summarize these replies in a week or so, or whenever answers
stop coming in.  I could not find a more appropriate newsgroup than
comp.text.  "comp.editors" was mentioned to me, but I didn't find it
listed in new users' information.  I welcome criticism & suggestions.)

psrc@cbnewsl.att.com (paul.s.r.chisholm) (09/04/90)

In article <1990Aug30.224234.19582@ecst.csuchico.edu>, dbar@csuchico.edu (David Barrett) writes:
> When I use a screen editor, I like a "destructive backspace" (you
> back up and the character under the cursor disappears).  Previous
> versions of vi that I have used (on AT&T [systems] for example) have
> had this feature, I think. . . .  [In my current version,] backspace
> apparently is nondestructive and can't be altered by ordinary
> users.

Every version of vi I've used has a non-destructive backspace, both in
input mode, and when editing text on the bottom line in "colon" mode.
In fact, the documentation lists this as a feature, "so you can see
what you had typed" (or words to that effect).  (Also, destructive
backspace when inserting can be quite demanding, depending on how your
terminal does such things.  Yes, I know, every PC editor in the world
does this.  PC video access and UNIX(R) system terminal access aren't
the same; and if you want details or argument on this point, please use
e-mail.)  Your sysadmin is correct:  you'd need access to the source
code to change this.

> All the vi literature I have read says that the erase function can
> be linked to the key of your choice with the command "stty erase
> [char]" . . . .  I do this on [my] system and I get a destructive
> backspace for commands from the login shell mapped to the key of my
> choice.  Likewise for the ex editor.  But in vi, d.b.s. is against
> the rules.  Why is this?

Because full screen applications don't let the tty driver do such
handling; they do it themselves.  In fact, vi treats both backspace and
your current erase character (when you enter vi) as non-destructive
backspaces.  It does not, however, honor or reproduce the effect of the
"echoe" bit.

Paul S. R. Chisholm, AT&T Bell Laboratories
att!mtunq!psrc, psrc@mtunq.att.com, AT&T Mail !psrchisholm
I'm not speaking for the company, I'm just speaking my mind.
UNIX is a registered trademark of UNIX System Laboratories, Inc.,
a subsidiary of AT&T.

(P.S.:  Yes, comp.editors would be a better place to discuss this.
I've e-mailed the original author this reply, and moved discussion to
the editors newsgroup.)