bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] Gnu APL and ANSI escape sequences


From: Frederick H. Pitts
Subject: Re: [Bug-apl] Gnu APL and ANSI escape sequences
Date: Mon, 17 Feb 2014 12:48:16 -0600

Hello Juergen,

        Yes, escape sequences can be sent to the terminal through the normal
interpreter, ⎕ and ⍞ output mechanisms but there are currently
limitations with all three.  Normal interpreter and ⎕ output appends a
new-line character that prevents the programmer from maintaining cursor
positon control when using relative (as opposed to absolute) cursor
positioning escape sequences. (To see this, exercise function TEST1 of
attached file in a xterm or equivalent.  The '+' signs should be aligned
above the 'O' in the center of the screen, not at the left margin.)  ⍞
output does not have this limitation. (To see, exercise function TEST2.)
However ⍞ output appends consecutive ⍞ outputs in the QUOTE-QUAD-PROMPT
buffer which causes undesirable side effects with ⍞ input. (To see,
exercise function TEST3.  Ideally the displayed prompt string should
read 'IS THE QUOTE-QUAD-PROMPT?', not fragments of escape sequences,
previous ⍞ output and 'IS THE QUOTE-QUAD-PROMPT?'.)

        I realize that ⍞ was not designed to work with ANSI escape sequences
and the TEST3 behavior is not surprising. However, if there were a
mechanism to select between "appending to" versus "replacing" the
contents of the QUOTE-QUAD-PROMPT buffer with the last ⍞ output, all
would be well as long as the last ⍞ output before ⍞ input is escape
sequence free.  I have demonstrated this to myself by replacing the
append method invocation with an assignment in the C++ code.

Regards,

Fred

On Mon, 2014-02-17 at 15:00 +0100, Juergen Sauermann wrote:
> Hi Fred,
> 
> I believe you simply need to create the sequence and insert it into
> the other text as appropriate, eg:
> 
>       ESCSEQ←(⎕UCS 27),'[0;35;48m'    ⍝ RED foreground
> 
>       'Hello',ESCSEQ,'World'
> HelloWorld
> 
> Note that ⎕UCS is more portable than ⎕AV or ⎕AF.
> 
> /// Jürgen
> 
> 
> On 02/14/2014 10:04 PM, Frederick H. Pitts wrote:
> 
> > Gentle people,
> > 
> >     Is there a way for a Gnu APL program to send ANSI escape sequences to
> > the terminal in which the iterpreter is running? 
> > 
> >     If not, I wish to propose the following:  The ⍞ handling be extended by
> > implementing an alternative mode where only the content of the last
> > assign to ⍞ be retained in quote-quad-prompt instead of appending the
> > content of all consecutive assigns up to the point ⍞ is referenced. In
> > the alternative mode quote-quad-prompt should be emptied when ⍞ is
> > referenced, just like it is currently.  The alternative mode could be
> > activated by setting a boolean control flag (e.g., ⎕QQ ← 1 or maybe
> > adding another element to ⎕FC).  As the ⍞ handling currently works,
> > assigning a ANSI escape sequence to ⍞ produces the desired result on the
> > screen, but as soon as one references ⍞ (even after assigning a
> > character vector not containing escape sequences) garbage appears in the
> > user's response.
> > 
> >     Please find attached ANSI_TEST.apl.gz.  The file demonstrates the above
> > issue.
> > 
> >     If there is a way for Gnu APL to send escape sequences to its terminal,
> > please let me know and I apologize for wasting your time.
> > 
> > Regards
> > 
> > Fred
> > Retired Chemical Engineer
> 

Attachment: ANSI.apl.gz
Description: GNU Zip compressed data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]