comp.lang.ada
 help / color / mirror / Atom feed
* Escape codes
@ 2003-03-14 21:56 J.Matthews
  2003-03-14 23:01 ` tmoran
  2003-03-15  2:15 ` Jeffrey Carter
  0 siblings, 2 replies; 19+ messages in thread
From: J.Matthews @ 2003-03-14 21:56 UTC (permalink / raw)


Can anyone explain why this doesn't work.
I am fairly new to ADA and would appreciate the help!

with ada.text_io;
use ada.text_io;

procedure ClearScreen is

begin

    Put (Item => ASCII.ESC);
    Put (Item => "[2J");

end ClearScreen;


It's meant to clear the screen but all it does is display a small left arrow
then [2J


Thanks in advance.





^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Escape codes
  2003-03-14 21:56 Escape codes J.Matthews
@ 2003-03-14 23:01 ` tmoran
  2003-03-15  2:15 ` Jeffrey Carter
  1 sibling, 0 replies; 19+ messages in thread
From: tmoran @ 2003-03-14 23:01 UTC (permalink / raw)


>    Put (Item => ASCII.ESC);
>    Put (Item => "[2J");
>It's meant to clear the screen but all it does is display a small left arrow
>then [2J
  Just as the image for '[' is a vertical line on the left and two short
horizontal lines at top and bottom, the image for Esc is a small left
arrow.  If you want Esc to not be displayed, but rather to perform a
control action, you'll need a terminal or terminal driver that does that
special handling for Esc.  As you see, not all do.  Some versions of DOS
and Windows allow you to run Ansi.sys and get the Ansi control effect you
want.  Not all.



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Escape codes
  2003-03-14 21:56 Escape codes J.Matthews
  2003-03-14 23:01 ` tmoran
@ 2003-03-15  2:15 ` Jeffrey Carter
  1 sibling, 0 replies; 19+ messages in thread
From: Jeffrey Carter @ 2003-03-15  2:15 UTC (permalink / raw)


J.Matthews wrote:
 > Can anyone explain why this doesn't work. I am fairly new to ADA and
 > would appreciate the help!
 >
 > with ada.text_io; use ada.text_io;
 >
 > procedure ClearScreen is
 >
 > begin
 >
 >   Put (Item => ASCII.ESC);
 >   Put (Item => "[2J");
 >
 > end ClearScreen;
 >
 > It's meant to clear the screen but all it does is display a small
 > left arrow then [2J

This has nothing to do with Ada. Your display does not recognize ANSI 
escape sequences.

Note that you can write this as

Put (Ascii.Esc & "[2J");

-- 
Jeff Carter
"That was the most fun I've ever had without laughing."
Annie Hall




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Escape Codes
@ 2007-03-05 12:20 Martin Krischik
  2007-03-05 12:53 ` Georg Bauhaus
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Martin Krischik @ 2007-03-05 12:20 UTC (permalink / raw)


Hello,

I know it's not an Ada question but you guys are my last hope as I 
googled until my fingers bleed.

Now I know that xterm will send <esc>[A on the up key and <esc>[B in the 
down key but could not find any informations on all the other keys - 
like page up page down. There must be a list somewhere. I mean an easy 
to understand human readable list - which termcap isn't.

Can anybody give me a pointer?

Martin



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Escape Codes
  2007-03-05 12:20 Escape Codes Martin Krischik
@ 2007-03-05 12:53 ` Georg Bauhaus
  2007-03-05 13:16   ` Thomas Dickey
  2007-03-05 13:12 ` brian.b.mcguinness
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: Georg Bauhaus @ 2007-03-05 12:53 UTC (permalink / raw)


On Mon, 2007-03-05 at 13:20 +0100, Martin Krischik wrote:
> Hello,
> 
> I know it's not an Ada question but you guys are my last hope as I 
> googled until my fingers bleed.
> 
> Now I know that xterm will send <esc>[A on the up key and <esc>[B in the 
> down key but could not find any informations on all the other keys - 
> like page up page down. There must be a list somewhere. I mean an easy 
> to understand human readable list - which termcap isn't.
> 
> Can anybody give me a pointer?
> 

My manpage says,
 Xterm Control Sequences (this is the file ctlseqs.ms)

which
http://www.thrysoee.dk/xtermcontrol/ says,
is in the xterm distribution.

HTH





^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Escape Codes
  2007-03-05 12:20 Escape Codes Martin Krischik
  2007-03-05 12:53 ` Georg Bauhaus
@ 2007-03-05 13:12 ` brian.b.mcguinness
  2007-03-05 13:22   ` Thomas Dickey
  2007-03-05 14:03   ` Martin Krischik
  2007-03-05 13:24 ` Markus E Leypold
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 19+ messages in thread
From: brian.b.mcguinness @ 2007-03-05 13:12 UTC (permalink / raw)


Google for ANSI escape sequences

Results include:

http://www.dee.ufcg.edu.br/~rrbrandt/tools/ansi.html
http://isthe.com/chongo/tech/comp/ansi_escapes.html
http://en.wikipedia.org/wiki/ANSI_escape_code

--- Brian




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Escape Codes
  2007-03-05 12:53 ` Georg Bauhaus
@ 2007-03-05 13:16   ` Thomas Dickey
  0 siblings, 0 replies; 19+ messages in thread
From: Thomas Dickey @ 2007-03-05 13:16 UTC (permalink / raw)


Georg Bauhaus <bauhaus@arcor.de> wrote:
> On Mon, 2007-03-05 at 13:20 +0100, Martin Krischik wrote:
>> Hello,
>> 
>> I know it's not an Ada question but you guys are my last hope as I 
>> googled until my fingers bleed.
>> 
>> Now I know that xterm will send <esc>[A on the up key and <esc>[B in the 
>> down key but could not find any informations on all the other keys - 
>> like page up page down. There must be a list somewhere. I mean an easy 
>> to understand human readable list - which termcap isn't.
>> 
>> Can anybody give me a pointer?
>> 

> My manpage says,
>  Xterm Control Sequences (this is the file ctlseqs.ms)

> which
> http://www.thrysoee.dk/xtermcontrol/ says,
> is in the xterm distribution.

xterm supports ANSI color, VT220 emulation and UTF-8
There's an faq at
	http://invisible-island.net/xterm/xterm.faq.html
	ftp://invisible-island.net/xterm/

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Escape Codes
  2007-03-05 13:12 ` brian.b.mcguinness
@ 2007-03-05 13:22   ` Thomas Dickey
  2007-03-05 14:03   ` Martin Krischik
  1 sibling, 0 replies; 19+ messages in thread
From: Thomas Dickey @ 2007-03-05 13:22 UTC (permalink / raw)


brian.b.mcguinness@lmco.com wrote:
> Google for ANSI escape sequences

> Results include:

> http://www.dee.ufcg.edu.br/~rrbrandt/tools/ansi.html

	This one is describing the M$ console emulator.

> http://isthe.com/chongo/tech/comp/ansi_escapes.html

	...the same for this one.

> http://en.wikipedia.org/wiki/ANSI_escape_code

	...much of this - the same.  There are several technical errors
	on the page, including equating ANSI x3.64 and ISO-6429.

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Escape Codes
  2007-03-05 12:20 Escape Codes Martin Krischik
  2007-03-05 12:53 ` Georg Bauhaus
  2007-03-05 13:12 ` brian.b.mcguinness
@ 2007-03-05 13:24 ` Markus E Leypold
  2007-03-05 15:47 ` Ali Bendriss
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 19+ messages in thread
From: Markus E Leypold @ 2007-03-05 13:24 UTC (permalink / raw)



Martin Krischik <krischik@users.sourceforge.net> writes:

> Hello,
>
> I know it's not an Ada question but you guys are my last hope as I
> googled until my fingers bleed.
>
> Now I know that xterm will send <esc>[A on the up key and <esc>[B in
> the down key but could not find any informations on all the other keys
> -
> like page up page down. There must be a list somewhere. I mean an easy
> to understand human readable list - which termcap isn't.
>
> Can anybody give me a pointer?
>
> Martin

http://www.xfree86.org/current/ctlseqs.html.

Dependend on what you really want to do with that information, you can
find out empirically about the sequences emitted on pressing certain
keys by piping them into 'hexdump -b'.

Regards -- Markus





^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Escape Codes
  2007-03-05 13:12 ` brian.b.mcguinness
  2007-03-05 13:22   ` Thomas Dickey
@ 2007-03-05 14:03   ` Martin Krischik
  2007-03-05 14:50     ` Markus E Leypold
  2007-03-05 14:58     ` Thomas Dickey
  1 sibling, 2 replies; 19+ messages in thread
From: Martin Krischik @ 2007-03-05 14:03 UTC (permalink / raw)


brian.b.mcguinness@lmco.com schrieb:
> Google for ANSI escape sequences
> 
> Results include:
> 
> http://www.dee.ufcg.edu.br/~rrbrandt/tools/ansi.html
> http://isthe.com/chongo/tech/comp/ansi_escapes.html
> http://en.wikipedia.org/wiki/ANSI_escape_code

None of which will tell you which sequence the terminal sends when i.E. 
you press the <Home> or <End> key :-(.

But Georg's hint to search for "Xterm Control Sequences" turned up 
http://sunsite.ualberta.ca/Documentation/Gnu/screen-3.9.4/html_chapter/screen_11.html 
which does :-):

Home                 kh         stuff \033[1~
End                  kH         stuff \033[4~
Insert               kI         stuff \033[2~
Delete               kD         stuff \033[3~
Page up              kP         stuff \033[5~
Page down            kN         stuff \033[6~

With Regards

Martin



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Escape Codes
  2007-03-05 14:03   ` Martin Krischik
@ 2007-03-05 14:50     ` Markus E Leypold
  2007-03-06  7:47       ` Martin Krischik
  2007-03-05 14:58     ` Thomas Dickey
  1 sibling, 1 reply; 19+ messages in thread
From: Markus E Leypold @ 2007-03-05 14:50 UTC (permalink / raw)



Martin Krischik <krischik@users.sourceforge.net> writes:

> brian.b.mcguinness@lmco.com schrieb:
>> Google for ANSI escape sequences
>> Results include:
>> http://www.dee.ufcg.edu.br/~rrbrandt/tools/ansi.html
>> http://isthe.com/chongo/tech/comp/ansi_escapes.html
>> http://en.wikipedia.org/wiki/ANSI_escape_code
>
> None of which will tell you which sequence the terminal sends when
> i.E. you press the <Home> or <End> key :-(.
>
> But Georg's hint to search for "Xterm Control Sequences" turned up
> http://sunsite.ualberta.ca/Documentation/Gnu/screen-3.9.4/html_chapter/screen_11.html
> which does :-):
>
> Home                 kh         stuff \033[1~
> End                  kH         stuff \033[4~
> Insert               kI         stuff \033[2~
> Delete               kD         stuff \033[3~
> Page up              kP         stuff \033[5~
> Page down            kN         stuff \033[6~

My Xterm produces ^[[H~ for HOME and ^[[F~ for END.

You can check that by either pressing ^V and the key in the shell (if
you have readline) or by using cat.

Regards -- Markus




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Escape Codes
  2007-03-05 14:03   ` Martin Krischik
  2007-03-05 14:50     ` Markus E Leypold
@ 2007-03-05 14:58     ` Thomas Dickey
  1 sibling, 0 replies; 19+ messages in thread
From: Thomas Dickey @ 2007-03-05 14:58 UTC (permalink / raw)


Martin Krischik <krischik@users.sourceforge.net> wrote:

> But Georg's hint to search for "Xterm Control Sequences" turned up 
> http://sunsite.ualberta.ca/Documentation/Gnu/screen-3.9.4/html_chapter/screen_11.html 
> which does :-):

It gives information which may be useful.
However - screen's documentation tells what screen tries to send,
provided that it knows what the underlying terminal is sending.
If it doesn't know, it can't translate.

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Escape Codes
  2007-03-05 12:20 Escape Codes Martin Krischik
                   ` (2 preceding siblings ...)
  2007-03-05 13:24 ` Markus E Leypold
@ 2007-03-05 15:47 ` Ali Bendriss
  2007-03-05 16:47 ` Adam Beneschan
  2007-03-05 18:51 ` Jeffrey R. Carter
  5 siblings, 0 replies; 19+ messages in thread
From: Ali Bendriss @ 2007-03-05 15:47 UTC (permalink / raw)
  To: comp.lang.ada

Dear Martin,

Not sure it will answer what your are looking for,
but if you are working on X11 you may have a look to xmodmap and xev as well.

On Monday 05 March 2007 12:20, Martin Krischik wrote:
> Hello,
>
> I know it's not an Ada question but you guys are my last hope as I
> googled until my fingers bleed.
>
> Now I know that xterm will send <esc>[A on the up key and <esc>[B in the
> down key but could not find any informations on all the other keys -
> like page up page down. There must be a list somewhere. I mean an easy
> to understand human readable list - which termcap isn't.
>
> Can anybody give me a pointer?
>
> Martin
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada-france.org
> http://www.ada-france.org/mailman/listinfo/comp.lang.ada

-- 
Ali



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Escape Codes
  2007-03-05 12:20 Escape Codes Martin Krischik
                   ` (3 preceding siblings ...)
  2007-03-05 15:47 ` Ali Bendriss
@ 2007-03-05 16:47 ` Adam Beneschan
  2007-03-05 21:32   ` Thomas Dickey
  2007-03-05 18:51 ` Jeffrey R. Carter
  5 siblings, 1 reply; 19+ messages in thread
From: Adam Beneschan @ 2007-03-05 16:47 UTC (permalink / raw)


On Mar 5, 4:20 am, Martin Krischik <krisc...@users.sourceforge.net>
wrote:
> Hello,
>
> I know it's not an Ada question but you guys are my last hope as I
> googled until my fingers bleed.
>
> Now I know that xterm will send <esc>[A on the up key and <esc>[B in the
> down key but could not find any informations on all the other keys -
> like page up page down. There must be a list somewhere. I mean an easy
> to understand human readable list - which termcap isn't.
>
> Can anybody give me a pointer?

I haven't tried this, but would looking for a VT100 or VT220 manual
help?  The escape sequences are, I believe, some sort of ANSI standard
which those terminals followed (at least for most keys; there may be
some unusual keys that DEC developed its own nonstandard sequences
for).  I'm just going from memory here.

                              -- Adam





^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Escape Codes
  2007-03-05 12:20 Escape Codes Martin Krischik
                   ` (4 preceding siblings ...)
  2007-03-05 16:47 ` Adam Beneschan
@ 2007-03-05 18:51 ` Jeffrey R. Carter
  2007-03-06  3:16   ` Brian May
  5 siblings, 1 reply; 19+ messages in thread
From: Jeffrey R. Carter @ 2007-03-05 18:51 UTC (permalink / raw)


Martin Krischik wrote:
> 
> Now I know that xterm will send <esc>[A on the up key and <esc>[B in the 
> down key but could not find any informations on all the other keys - 
> like page up page down. There must be a list somewhere. I mean an easy 
> to understand human readable list - which termcap isn't.

Why not write a little program and compile your own list?

-- 
Jeff Carter
"If you think you got a nasty taunting this time,
you ain't heard nothing yet!"
Monty Python and the Holy Grail
23



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Escape Codes
  2007-03-05 16:47 ` Adam Beneschan
@ 2007-03-05 21:32   ` Thomas Dickey
  0 siblings, 0 replies; 19+ messages in thread
From: Thomas Dickey @ 2007-03-05 21:32 UTC (permalink / raw)


Adam Beneschan <adam@irvine.com> wrote:
> On Mar 5, 4:20 am, Martin Krischik <krisc...@users.sourceforge.net>
> wrote:
>> Hello,
>>
>> I know it's not an Ada question but you guys are my last hope as I
>> googled until my fingers bleed.
>>
>> Now I know that xterm will send <esc>[A on the up key and <esc>[B in the
>> down key but could not find any informations on all the other keys -
>> like page up page down. There must be a list somewhere. I mean an easy
>> to understand human readable list - which termcap isn't.
>>
>> Can anybody give me a pointer?

> I haven't tried this, but would looking for a VT100 or VT220 manual
> help?  The escape sequences are, I believe, some sort of ANSI standard

no - there's apparently no standard for the strings that function-keys
send (aside from terminal-specific stuff).

> which those terminals followed (at least for most keys; there may be
> some unusual keys that DEC developed its own nonstandard sequences
> for).  I'm just going from memory here.

DEC was reasonably consistent - function keys are formed as control
strings that could be echoed to the terminal and either ignored, or
(as with cursor keys) do something useful.

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Escape Codes
  2007-03-05 18:51 ` Jeffrey R. Carter
@ 2007-03-06  3:16   ` Brian May
  2007-03-06 12:00     ` Thomas Dickey
  0 siblings, 1 reply; 19+ messages in thread
From: Brian May @ 2007-03-06  3:16 UTC (permalink / raw)


>>>>> "Jeffrey" == Jeffrey R Carter <jrcarter@acm.org> writes:

    Jeffrey> Why not write a little program and compile your own list?

Just run cat, and push the function key. On my system F1 comes out at
"^[OP". Replace ^[ with escape.

Just be warned that there are different standards. xterm might be
different to console, different xterms might be different, etc (at
least they were in Linux last I tried).

Also there is this mode (which unfortunately I suspect is obsolete
because it breaks UTF-8 compatibility), copied from the xterm man
page:

       eightBitInput (class EightBitInput)
               If "true", Meta characters (a single-byte character  combined
               with  the  keys  modifier key) input from the keyboard are pre-
               sented as a single character with the  eighth  bit  turned  on.
               The  terminal is put into 8-bit mode.  If "false", Meta char-
               acters are converted into a  two-character  sequence  with  the
               character  itself  preceded by ESC.  On startup, xterm tries to
               put the terminal into 7-bit mode.  The metaSendsEscape resource
               may override this.  The default is "true."

-- 
Brian May <bam@snoopy.apana.org.au>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Escape Codes
  2007-03-05 14:50     ` Markus E Leypold
@ 2007-03-06  7:47       ` Martin Krischik
  0 siblings, 0 replies; 19+ messages in thread
From: Martin Krischik @ 2007-03-06  7:47 UTC (permalink / raw)


Markus E Leypold schrieb:

> You can check that by either pressing ^V and the key in the shell (if
> you have readline) or by using cat.

Ctrl-V - how long have I searched for such a function! But then I should 
have known - Vi used the same keystroke for the same purpose.

Anyway, this solves my problem neatly.

Martin



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Escape Codes
  2007-03-06  3:16   ` Brian May
@ 2007-03-06 12:00     ` Thomas Dickey
  0 siblings, 0 replies; 19+ messages in thread
From: Thomas Dickey @ 2007-03-06 12:00 UTC (permalink / raw)


Brian May <bam@snoopy.apana.org.au> wrote:
>>>>>> "Jeffrey" == Jeffrey R Carter <jrcarter@acm.org> writes:

>     Jeffrey> Why not write a little program and compile your own list?

> Just run cat, and push the function key. On my system F1 comes out at
> "^[OP". Replace ^[ with escape.

> Just be warned that there are different standards. xterm might be
> different to console, different xterms might be different, etc (at
> least they were in Linux last I tried).

> Also there is this mode (which unfortunately I suspect is obsolete
> because it breaks UTF-8 compatibility), copied from the xterm man
> page:

Not exactly - some users have keyboards that provide 8-bit characters
without having to use the meta-modifier as a shift key.  So eightBitInput
is still in use - just not for the original reason.

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2007-03-06 12:00 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-05 12:20 Escape Codes Martin Krischik
2007-03-05 12:53 ` Georg Bauhaus
2007-03-05 13:16   ` Thomas Dickey
2007-03-05 13:12 ` brian.b.mcguinness
2007-03-05 13:22   ` Thomas Dickey
2007-03-05 14:03   ` Martin Krischik
2007-03-05 14:50     ` Markus E Leypold
2007-03-06  7:47       ` Martin Krischik
2007-03-05 14:58     ` Thomas Dickey
2007-03-05 13:24 ` Markus E Leypold
2007-03-05 15:47 ` Ali Bendriss
2007-03-05 16:47 ` Adam Beneschan
2007-03-05 21:32   ` Thomas Dickey
2007-03-05 18:51 ` Jeffrey R. Carter
2007-03-06  3:16   ` Brian May
2007-03-06 12:00     ` Thomas Dickey
  -- strict thread matches above, loose matches on Subject: below --
2003-03-14 21:56 Escape codes J.Matthews
2003-03-14 23:01 ` tmoran
2003-03-15  2:15 ` Jeffrey Carter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox