[haiku] Re: Nonstandard CSI code?

  • From: Siarzhuk Zharski <zharik@xxxxxx>
  • To: haiku@xxxxxxxxxxxxx
  • Date: Tue, 02 Jul 2013 08:32:02 +0200

Hi Pete,

pete.goodeve@xxxxxxxxxxxx писал 02.07.2013 00:05:
I'm wondering why Haiku seems to use Control Sequence Introducer characters that I can't find (currently) used by any other system. I was trying to

Both termcap and terminfo databases on the current nightly Haikus are inherited from ncurses' 5.9 one with only two changes related to 256 colors support in xterm (just because the other World is not ready to xterm-256color ATM).

use a Perl app, suggested to me by someone, that expects arrow-key commands in the usual form "<esc>[A", or whatever. It doesn't work, because it turns
out the sequence provided by Haiku is "<esc>OA"!

The app should be blamed, because it must to call local termcap/terminfo for correct control sequences before starting to communicate with user. In opposite case it can work only with those terminals that implement cursor movements in vt52 style.

Furthermore, I can't figure out where the sequence is actually being
generated from the B_UP_ARROW, etc., codes from the keymap.  I assumed

They are hard-coded in the VTkeymap.h to ones, corresponding to ncurses's xterm.

that /etc/termcap was in control, but printenv tells me that TERM=xterm,
and termcap has that aliased to 'xterm-new'.  Looking at that section,
it is indeed "ku=\EOA", but editing those values to the standard doesn't
seem to affect anything!

termcap/terminfo are practical not relevant to Terminal application, especially to application emulating only single terminal type like Haiku's Temrinal. It is almost impossible that xterm's control codes will be changed some day in the future so we can optimize it do not calling every start time to local termcap/terminfo databases. So, in other words - termcap/terminfo are not for the Terminal but for applications working inside of it. Those applications are obliged to look up for correct control sequences before starting it's communication.

What's going on?

I hope my explanations have helped you to understand it. ;-)

Pete Goodeve писал 02.07.2013 04:00:
Seems to me that sticking to ANSI would be an extremely good idea.

Over my dead body! :-D I have spend lot of evenings during the last winter fixing xterm-256color emulation and still have nightmares about having to start fixing it again. ;-)

Unless someone has a good reason otherwise, I'll file a ticket.

Or just attach the patch into the ticket #8482, that makes it configurable in the Terminal settings file. ;-) The bad news here that Preferences UI is still waiting for refactoring and profiles implementation, so you have to invent the way of switching this option on the fly that everybody like.

Anyway, if a program hard-codes an escape sequence, it is bound not to
work somewhere. The whole termcap/terminfo mess exists to "solve" the
problem.

True, but if it codes ANSI, and the OS supplies ANSI...

Haiku Terminal emulates xterm-256color not ansi.

Otherwise it has to find some way to get the info, and neither libtermcap nor
libterminfo appears to be available by default in Haiku.

ncurses lib provides both libtermcap and libterminfo functionality for applications. Note that starting hrev45705 all system applications are switched to use terminfo and termcap is going to go away as soon as al optional packages will be recompiled.

--
Kind Regards,
   S.Zharski


Other related posts: