How do I get an ESC character?

Post any comments, suggestions, annoyances or ideas for future releases here. Please do not post bug reports or questions here.
Post Reply
tom

How do I get an ESC character?

Post by tom »

I'm using an older version of zeus and I want to include a control character for page orientation on a hewlett packard printer.
CTRL+[ is the sequence, but zeus does not recognize the bracket while holding down the control key. I am using the brief ex emulator.
Any ideas?
Thanks
Tom
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Use the Options, Editor Options menu and in the general section make sure the Display Ctrl key codes option is set. Also make sure the key is not already mapped to some keyboard function.

If this still fails, the final option is to use a macro. The macro below inserts a page break character into the current file. Just change the macro to insert the appropriate character code:

Code: Select all

--
--        Name: Page Break Macro
--
--      Author: Jussi Jumppanen
--
--    Language: Lua Macro
--
-- Description: This is a simple Lua macro to insert a page break.
--
--  How To Run: All Zeus macros can be run using the macro execute menu
--              item or they can be bound to the keyboard or they can
--              be attached to the macro drop down or popup menus.
--

function key_macro()
  -- macro only works for documents
  local document = is_document()

  if document == 0 then
    message("This macro only works for document files!")
    beep()
    return
  end

  -- macro only works for read/write documents
  local locked = is_read_only()

  if locked == 1 then
    message("The current document is marked as read only!")
    beep()
    return
  end

  -- generate and insert a form feed character
  local character = string.format("%c", 12)
  MoveLineHome()
  print(character)
  Enter()
end

key_macro() -- run the macro
Jussi
AlanS

ESCape character

Post by AlanS »

Can't you also (on a Windows machine) just hold down the Alt key and type "012" on the keypad to generate an ESC character. I do it all the time for ? (155) and ? (171) and ? (172) and ? (0176). Use Zeus' ASCII chart to look 'em up!
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

Hi Alan,

You are 100% correct when you say the ESC character can be entered using the Alt key, the numeric key pad and typing in "012".

The trick is to make sure the NumLock is on, hold down the Alt key and then type in "012".

There is one minor isse and that is if the Zeus Trim lines of white space on save option is enabled any ESC characters at the end of a line is identified as whitespace and are removed :(

I think this could be consider a minor bug with Zeus as it should only be trimming tab and space characters from the ends of lines and not all characters less than 20 hex as it currently does.

This issue will be fixed in the next patch :)

Cheers Jussi
Post Reply