bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] aplwrap: bell & ANSI controls


From: Juergen Sauermann
Subject: Re: [Bug-apl] aplwrap: bell & ANSI controls
Date: Wed, 10 Sep 2014 18:40:28 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.0

Hi,

I changed GNU APL to use libncurses for figuring Input and output ESC sequences if configured to do so.
This should make GNU APL terminal independent as proposed by David.

The input (keyboard → APL) and output (APL → screen) can be configured separately in the preferences file.
The reason is that on my box the escape sequences for output seem to work while the 
escape sequences for input
reported by curses were different from the esc sequences sent by the keyboard. The output sequences for colors
as reported by curses were not optimal (one can set foreground and background colors in one ESC sequence but
curses would use two, one for the foreground and one for the background).

For the above reason the the GNU APL default is still ANSI and not ncurses.

But now the input ESC sequences can be configured as well, and if ncurses is configured for output
then the cursor positioning sequences (not not only the color sequences) will use it.

SVN 467.

/// Jürgen


On 09/08/2014 08:54 PM, David B. Lamkins wrote:
I wrote an ANSI terminal emulator decades ago. It's not a small task.

Even if you take a small subset of the control codes, there are still
some tricky architectural issues to consider w.r.t. how a screen-based
console would function within the transcript-based model presented by
aplwrap.

If you've seen Dyalog's Linux offering: they've dealt with this by
offering a separate mode (and window) for screen-based output.

I'd have to give some more thought to this...

In the meantime: I'll reiterate Chris's comment about being aware of the
TERM environment variable. This, together with shelling out to tput to
get terminal-appropriate control codes, can be used to make your program
support a wide variety of terminals; not just ANSI-compatible. Of course
you'll need to provide a fallback for the case where tput tells you that
your terminal doesn't possess the requested capability...

Chris: It might be a good idea to pick a glyph other than blank as a
substitution character. U+FFFD seems like a good choice:

http://en.wikipedia.org/wiki/Specials_%28Unicode_block%29

Re: Bell not working: just a misplaced line:

diff --git a/src/txtbuf.c b/src/txtbuf.c
index a98cf23..21020b1 100644
--- a/src/txtbuf.c
+++ b/src/txtbuf.c
@@ -52,8 +52,8 @@ tagged_insert (char   *text,
       ptr = g_utf8_next_char (ptr);
       if (!g_unichar_isprint (c) && *op != '\n') {
 	gint cl = ptr - op;
-	for (int i = 0; i < cl; i++) *op++ = ' ';
 	if (*op == '\a') gdk_beep ();
+	for (int i = 0; i < cl; i++) *op++ = ' ';
       }
     }
   }






reply via email to

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