1820400 Members
3390 Online
109624 Solutions
New Discussion юеВ

stty delete ^? ?

 
SOLVED
Go to solution
David_246
Trusted Contributor

stty delete ^? ?

Hi,

I know we can set the erase key to function like :

stty erase ^H

However, my collegues will have to start using Midnight Commander for Unix, but start having a problem with not being able to use the key. This does work in the CDE editor.

Once pressing the key the key behaves as a key. Does anyone know a solution to make it delete, so the character in front of the current position is removed? So I am looking for something like (?) :

stty delete ^?

Any advise? The above doesn't work. Thanks a lot for your help.

Regs David
@yourservice
18 REPLIES 18
T G Manikandan
Honored Contributor

Re: stty delete ^? ?



check your settings

#stty -a

If your erase it set to the "delete key" revert that to the backspace
#stty erase ^H

you can also move things to their defaults using

#stty sane
David_246
Trusted Contributor

Re: stty delete ^? ?

Great, but how do I set the !!!delete key!!! to delete instead of showing ^? or behaving as a key.

Regs David

the output of stty -a is :

# stty -a
speed 9600 baud; line = 0;
rows = 24; columns = 80
min = 1; time = 1;
intr = ^C; quit = ^\; erase = ^H; kill = ^U
eof = ^D; eol = ^@; eol2 = ^@; swtch = ^@
stop = ^S; start = ^Q; susp = ^Z; dsusp = ^@
werase = ^@; lnext = ^@
parenb -parodd cs8 -cstopb hupcl cread -clocal -loblk -crts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -iuclc
ixon -ixany ixoff -imaxbel -rtsxoff -ctsxon -ienqak
isig icanon -iexten -xcase echo echoe echok -echonl -noflsh
echoctl -echoprt echoke -flusho -pendin
opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel -tostop
@yourservice
Mark Grant
Honored Contributor

Re: stty delete ^? ?

David, either try "stty erase ^?" (don't press the delete key here, press a "^" and then a "?") or re-programme your delete key to send a ^H.

Some terminal emulators such as "konsole" have a keyboard schema specifically for midnight commander. Others, like xterm adn I think hpterm also allow you to change what the "delete" key sends. If not, then you are going to have to look at xmodmap (man xmodmap) to program it to what you want. If you use dtterm then you need to look at Motif resource files which are extremely annoying.
Never preceed any demonstration with anything more predictive than "watch this"
Jeroen Peereboom
Honored Contributor

Re: stty delete ^? ?

David,

I would search for a keyboard definition.
You know, when using terminal emulation programs (like telnet clients, putty) you have to define the backspace key? Other programs ask you if pressing the backspace must send a ^H or ^?. So what terminal are you using? hpterm dtterm?

JP.
Jeroen Peereboom
Honored Contributor

Re: stty delete ^? ?

David,

maybe my previous reply was too fast...
I have to think it over...

JP.
David_246
Trusted Contributor

Re: stty delete ^? ?

Hi,

Maybe my question still is not clear.

I am looking for an ssty definable function that removes a character after the current cursor position.

Just as backspace does it in front of the current cursor position.

Is there?

Regs David
@yourservice
Mark Grant
Honored Contributor

Re: stty delete ^? ?

David,

stty doesn't have one of those. I think you might be barking up the wrong tree as they say. If this is what midnight commander does when you hit the delete key, then it is midnight commander that is erasing the character, not the terminal subsystem of the OS. What I suspect your problem is is that Midnight Commander is expecting to receive a DEL (ascii 127) when you press the delete key.

So, to solve this problem, you need to program your delete key to send a ascii 127(octal 177, hex 7F). This you can do wiht xmodmap
Never preceed any demonstration with anything more predictive than "watch this"
David_246
Trusted Contributor

Re: stty delete ^? ?

Hi Mark,

Unfortunetly this is beyond my reach of knowledge. If I show you an example config file of a vt100 file, do you know the answer then?
If so --> you have another ten-pointer.
If not, there's is nothing else than to say a big :

Thank You !


Regs David

# more vt100.ti

vt100|vt100-am|dec vt100 (w/advanced video),
am, mir, msgr, xenl, xon,
cols#80, it#8, lines#24, vt#3,
acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>,
clear=\E[H\E[J$<50>, cr=\r, csr=\E[%i%p1%d;%p2%dr,
cub=\E[%p1%dD, cub1=\b, cud=\E[%p1%dB, cud1=\n,
cuf=\E[%p1%dC, cuf1=\E[C$<2>,
cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA,
cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>,
el1=\E[1K$<3>, enacs=\E(B\E)0, home=\E[H, ht=\t,
hts=\EH, ind=\n, ka1=\EOq, ka3=\EOs, kb2=\EOr, kbs=\b,
kc1=\EOp, kc3=\EOn, kcub1=\EOD, kcud1=\EOB,
kcuf1=\EOC, kcuu1=\EOA, kent=\EOM, kf0=\EOy, kf1=\EOP,
kf10=\EOx, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOt,
kf6=\EOu, kf7=\EOv, kf8=\EOl, kf9=\EOw, rc=\E8,
rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmkx=\E[?1l\E>,
rmso=\E[m$<2>, rmul=\E[m$<2>,
rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7,
sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t^N%e^O%;,
sgr0=\E[m^O$<2>, smacs=^N, smkx=\E[?1h\E=,
smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g,
@yourservice
Mark Grant
Honored Contributor

Re: stty delete ^? ?

I don't think the terminfo entry is going to help either.

Try doing something like this with "xmodmap". First make sure your DISPLAY variable is set correctly and the try

xmodmap -e "keysym Delete = Delete"

This should make the Delete key send a real Delete. If I'm right Midnight Commander should be happy. You can check what your current keyboard config is with "xmodmap -pk | more" this might be useful too.
Never preceed any demonstration with anything more predictive than "watch this"
Mark Grant
Honored Contributor

Re: stty delete ^? ?

By teh way, if that last one doesn't work, try

xmodmap -e "keysym BackSpace = Delete"
Never preceed any demonstration with anything more predictive than "watch this"
Denver Osborn
Honored Contributor

Re: stty delete ^? ?

I'm not sure how you'd use stty to do what you need. Why not use an editor from the command line to make your syntax changes?

set -o vi


-denver

Mark Grant
Honored Contributor

Re: stty delete ^? ?

Out of interest David, whilst trying to get the KeySyms correct in my previous answer I have accidently managed to turn my delete key into one that works like you want. I don't seem to be able to get it back again :) SO if you want to swap machines with me, I think we'll both be happy!
Never preceed any demonstration with anything more predictive than "watch this"
Jeroen Peereboom
Honored Contributor
Solution

Re: stty delete ^? ?

David,

After having a stroll, I figured out it probably had nothing to do with stty. But other people already said that.

(I think stty goes back to the real teletypes. Some keypresses don't make it to the program at all, but are captured by stty, termio or whatever. But that's only the way I look at it and how I understand it.)

I just had a look at Midnight Commander on Linux (I currently have no access to HP-UX).
Under the pull-down menu 'Options' you can learn the keys. You have to press all keys Midnight Commander uses and each key press marks a key as OK. Then you are probably left with the [Delete key} unmarked. Move the cursor to it and press the key. It will mark it as such. I tested it switching the Insert and the Del key.

Hope this works on HP-UX too.

JP.
Rory R Hammond
Trusted Contributor

Re: stty delete ^? ?

Dave

By reading the thread I am a little un clear as what the problem is but this is my take
the DELETE key returns ^?. Instead of deleting a the a character.



You can set the delete key to work for the ^? by editing the users .profile

you have to use a special key enter to enter ^? into the profile
Control V and then Control? will create the line.


stty erase ^V^?

Rory
There are a 100 ways to do things and 97 of them are right
David_246
Trusted Contributor

Re: stty delete ^? ?

Hi Rory,

The initial question is totaly different; read my quote :
# ------------------------------------------
I am looking for an ssty definable function that removes a character after the current cursor position.

Just as backspace does it in front of the current cursor position.
# ------------------------------------------

I already found out on unix.com that this is not possible. Don't know what Mark did, I do know he has a problem :)

Regs David
@yourservice
Mark Grant
Honored Contributor

Re: stty delete ^? ?

Hey David,

I thought,"which will be quicker, finding the correct xmodmap key symbols or logging out of X and then loggin in again".

Guess which one I chose.
Never preceed any demonstration with anything more predictive than "watch this"
Bill Hassell
Honored Contributor

Re: stty delete ^? ?

The problem is that command lines do not have a 'future' key. If you are in a shell, then there are no characters to right of what you are typing. Of course, you can go behind the shell's back and move the cursor around on the screen, but this is only cosmetic. The shell knows nothing about what you did. The reason that the CDE editor can do this is that it has nothing to do with Unix...it is an application program and every keystroke is defined by the program. So this is totally unique to the CDE editor and has no meaning outside that program.

stty as mentioned, is a driver interface and can take a specific command string action based on certain characters. But erasing characters to the right on a command line is meaningless, thus the lack of information on how to do this.

Now menu programs are not command lines. They bounce all over the screen, just like vi. And the programmer has the choice to create the behavior you described. The characters are read one at a time, decoded and then the appropriate terminal-specific action taken. For instance, you can clear characters to the right by using the capname associated with clr_eol (see man terminfo) and typing the tput command:

tput el

What this command does is to use the Curses library to look in the terminfo database, and using the $TERM value, request the code for clear-to-EOL. Notre that the codes will be very different for different terminals. Try this:

$ TERM=hp tput el | xd -xc
0000000 1b4b
1b K
$ TERM=wy50 tput el | xd -xc
0000000 1b74
1b t
$ TERM=vt100 tput el | xd -xc
0000000 1b5b 304b
1b [ 0 K

So depending on the type of terminal you have, the codes will be different. But none of this applies if you are running a special program such as an Xwindow editor. These programs define everything and usually ignore anything in stty (they read characters in raw mode).


Bill Hassell, sysadmin
Jeroen Peereboom
Honored Contributor

Re: stty delete ^? ?

David,

a correction on my last reply.
To define a key in MC, move to the corresponding menu-item, press and next press your desired key once, wait for a moment and press it again.

Are you still searching for a generic solution, or is it just Midnight Commander?

JP.