Re: Simple EDT or TPU init file

From: Fred Bach (music_at_triumf.ca)
Date: 12/14/04


Date: Tue, 14 Dec 2004 13:37:43 -0800
To: Big John <john.powers@airwidesolutions.com>

Big John,

   Thank you for your TPU insight. I don't do much TPU.

   I copied your code directly into SIMPLE.TPU in my login
   directory. Right now my SIMPLE symbol is:

  SIMPLE == "edit/tpu/read/command=SYS$LOGIN:SIMPLE.TPU/noinit/nosection/nojournal"

   There are a couple of problems.

   First, using SHOW TERMINAL/FULL I find the keypad is usually
   in numeric mode by default to start with. It needs to be in
   application mode before you call SIMPLE or else the keypad
   doesn't work and you can't get out except with a CONTROL-Y.

   Second, if you type enough of the undefined keys, there is a
   buffer that gets full somewhere and the terminal beeps and
   nothing happens each time you hit another key, even a legit
   key. This requires me to clear the communications on my
   VT300 X-window on my PC via the Commands pulldown menu, and
   that causes the cursor to show up again. Perhaps the
   type-ahead buffer needs to be zero?? Something needs to be
   done to throw those keys away properly and to make sure they
   do not pile up.

   Unlike the original request, it would be nice if SIMPLE could
   fill the existing screen whatever length / width it is. We
   should pick the screen lengths and widths from the existing DCL
   window size before SIMPLE is called. It would still work for
   the size of screen originally specified by the original poster.

   Clearly we need to put the necessary DCL setup commands into
   a tidy foolproof little .COM file, SIMPLE.COM . What setup
   commands do you advise? And if one has to change something
   at the DCL level, perhaps one should put it back after SIMPLE
   has finished.

   Thanks in advance.

  .. fred bach .. music@triumf.ca

Big John wrote:

> Peter Weaver wrote
>
>
>>Mike Buchanan wrote:
>>
>>>...
>>>1) Can I make the cursor invisible?
>>>...
>>
>>The only way I can think of doing this depends on how good your
>
> terminal
>
>>emulator is;
>>
>>$ esc[0,8]=27
>>$ write sys$output "''esc'[?25l"
>>$ assign sys$command sys$input/user_mode
>>$ edit/tpu/nosec/comm=sys$login:simple.tpu 'P1
>>$ write sys$output "''esc'[?25h"
>>
>>--
>
>
> This is fine, but you can do it very simply, entirely within the TPU
> command. This would make it much easier to set up if you do decide
> to use the callable TPU directly, instead of spawning out. There
> are two ways to do it. The 'proper' way would be to set the window
> not to translate escape sequences, but put them straight out, with a
> command like:
> set (TEXT, main_window, NO_TRANSLATE)
> - then copy_text the escape sequence, and update the window.
>
> However here, there is a simpler solution. Since we are not trapping
> messages, but splashing them unaltered straight on to the screen, we
> can output the escape sequences with a couple of MESSAGE commands.
>
> (There, I believe I said before that it was a much better idea to
> start from scratch and build, instead of stripping down the EVE
> section :-).
>
> So all you need to do, after you have mapped the window to the
> buffer is to add the line..
> message (ascii(27)+"[?25l");
> .. and change the kp1 key to execute the 2-command sequence..
> message(ascii(27)+'[?25h');QUIT (OFF,1)
> .. to switch the cursor back on when exiting.
>
>
> One other point worth mentioning..
>
> If you don't care about the cursor position, then you can move the
> screen about more simply with the SCROLL command instead of the
> MOVE_VERTICAL command. SCROLL changes the editing point by leaving
> the cursor position unchanged on the screen and adjusting the file
> window display. This is exactly what you want here, and you do not
> need to adjust the cursor to the top/bottom before moving up/down
> a line, making the whole thing simpler.
>
> Also, SCROLL does not report an error if you scroll too far.
> (Instead it returns a value of the amount actually scrolled, if you
> need it. It's a shame, I think, that MOVE_VERTICAL does not do the
> same). Thus, you will not need any on_error processing, so you can
> simplify it further by removing the SIMPLE_MOVE procedure.
>
>
> So here is a really cool stripped down version of SIMPLE.TPU that
> displays the file, moves the display, and hides the cursor..
>
>
> input_file := GET_INFO (COMMAND_LINE, "file_name");
> main_buffer:= CREATE_BUFFER ("main", input_file);
>
> position (BEGINNING_OF (main_buffer));
> main_window := create_window(1,21,off);
>
> the_key_map := create_key_map ("user_keys");
> the_key_map_list := create_key_map_list ("the_keylist", the_key_map);
>
> set (UNDEFINED_KEY, the_key_map_list, "return");
> set (KEY_MAP_LIST, the_key_map_list, main_buffer);
> set (SELF_INSERT, the_key_map_list, OFF);
>
> MAP (main_window,main_buffer);
> message (ascii(27)+"[?25l");
>
> !
> define_key ("message(ascii(27)+'[?25h');QUIT (OFF,1)", kp1,
> the_key_map);
> define_key ("scroll (current_window, 1)", kp2, the_key_map);
> define_key ("scroll (current_window, -1)", kp8, the_key_map);
> define_key ("scroll (current_window, 20)", kp6, the_key_map);
> define_key ("scroll (current_window, -20)",kp4, the_key_map);
> define_key ("scroll (current_window, 1)", down, the_key_map);
> define_key ("scroll (current_window, -1)", up, the_key_map);
> !
>
> Cheers, John --
>



Relevant Pages

  • Re: Simple EDT or TPU init file
    ... Over the holiday period, I was thinking about TPU (well, what else ... Thus we have 2 define_key commands for each command, ... > that causes the cursor to show up again. ... define_key ("scroll (current_window, 1)", ...
    (comp.os.vms)
  • Re: In vim, how do I scroll one screen line upward and downwards?
    ... How do I scroll the displayed text 1 line down without moving the ... the display while keeping the cursor fixed w.r.t. the window rather than ... The z prefix is used for a number of different sets of commands. ...
    (comp.editors)
  • Re: Need some help with development.
    ... and uses "scroll" ... commands where possible. ... The trick here is that different terminals ... so ncurses reads the termcap ...
    (rec.games.roguelike.development)
  • Voice-activated macros for doing stuff in Windows
    ... Voice commands would rule. ... #edit after click ... "line":#select line under pointer ... "angle":#put angle marks around text left of cursor, ...
    (alt.comp.hardware.pc-homebuilt)
  • Re: Vi retaining cursor position until after escape from insert mode
    ... both --j and!|j might be abbreviations ... cursor positioning which is not vi-compatible. ... line-wise ex commands try to be more character-wise. ... So does plain escape even after entering the empty text. ...
    (comp.editors)