[haiku] Re: Nonstandard CSI code?

  • From: Jerry Babione <jerry.babione@xxxxxxxxx>
  • To: "haiku@xxxxxxxxxxxxx" <haiku@xxxxxxxxxxxxx>
  • Date: Tue, 2 Jul 2013 11:13:49 -0500

Pete,

Below is your quote concerning Arrow Key Command Returns.

The codes you noted as standard originated with Microsoft's ANSI.SYS.
 However, they were not and have never been Certified by the American
National Standards Institute.  The secondary sequencing "Noted in the
TERMCAP" came from the 1978 DEC international keyboard configuration for
the VT-100 and subsequent models.  It is more widely used but not a
popular.  So, the ASC II (updated in 1986) listed the DEC codes as
standard.  The Microdoft Windows 1252 Codes are more familiar because of
Windows popularity and distribution.

Truly it boils down to choice.  Microsoft has always gone it's own way and
tried, to impose its will on everyone.

I took a College course a few years ago to pickup another language and
found text books that were not POSIX compliant. They were using Microsoft's
Visual Basic Compiler (Not the Free Version Either) as the STANDARD for
libraries.  When confronted the professor said that Windows was what his
classroom was based in.  I promptly called the Dean.  I'd been in the Army
with him and reported what happened.  Two weeks later the Professor
corrected the syllabus.

-------------------------------------------------------------------------------------------------------
Hi,
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
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"!

(A simple verification is to use "od -c", type some arrow keys (then
<enter> and ^D) and see what's generated.  Even BeOS produces the expected
"[" rather than "O".)

Wikipedia makes no mention of any alternative sequence like that.

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
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!  Nor does setting TERM=ansi, which seems to
still have the standard codes.



On Tue, Jul 2, 2013 at 1:32 AM, Siarzhuk Zharski <zharik@xxxxxx> wrote:

> 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
>
>
>


-- 
Jerry Babione
Founder-Just Plain Folks Org. Inc.

Other related posts: