Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: The old backspace/delete problem



On Jan 19,  2:22pm, Peter Stephenson wrote:
} Subject: Re: The old backspace/delete problem
}
} Boyd Adamson wrote:
} > alias ^?='stty erase ^?'
} > alias ^H='stty erase ^H'
} > 
} > Any ideas on how we could do this sort of auto-detection in zsh?
} 
} It's doable; there's a slight catch, but I think I've managed to make it
} almost invisible to the user.

That's a pretty cute trick, Peter.  I think it still runs into problems
with "ttyctl -f", though?

I have this little function in my .zlogin file:

    function stty_backspace {
	local bs
	while (( #bs != 8 && #bs != 127 ))
	do
	    print -n 'Press backspace: '
	    read -k 1 bs || return 1
	    print -nP '\r%E'
	done
	stty erase "$bs"
    }

I invoke that (still in .zlogin) if various other tests for the type
of terminal and host operating system fail to intuit the correct value.
(Those tests are dependent on knowledge of hardware/OSs on my LAN, so
it's not useful to post them here.)

This means that I sometimes get an extra prompt on login, but it also
means that I can be sure to run it before ttyctl.

I like your idea better, though.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



Messages sorted by: Reverse Date, Date, Thread, Author