dhansel / VersaTerm

A versatile DIY serial terminal
GNU General Public License v3.0
93 stars 23 forks source link

Question re trapping of function keys #3

Closed okwatts closed 9 months ago

okwatts commented 1 year ago

HI I have built 2 of these and quite like them for my retro hobby. I recently ran across a situation using a screen editor that uses the function keys to save and exit from it. This works under putty and Teraterm but doesn't under versaterm. Is this related to checking for F12 and are all F keys affected?

dhansel commented 1 year ago

As far as I know the VT100/VT102 standard did not include mappings for function keys, which is why VersaTerm does not include them either. TeraTerm and Putty also support other standards which I assume include the function keys.

If you know the ASCII sequence your editor expects for the function keys then you can use the keyboard macro function in VersaTerm to define the proper sequence: 1) press F11 (you will hear a single beep) 2) press the function key you want to re-define (best stick to F1-F10 since F11 and F12 have meaning in VersaTerm itself) 3) press the keyboard key sequence you want the function key to send 4) press F11 again (a double beep will indicate that the macro has been recorded)

Now every time you press the function key, VersaTerm will send that sequence. When you save your configuration the keyboard macros will be included.

Note that during step 3 you can send any ASCII code by pressing and holding the left ALT key and then typing the three-digit (decimal) ASCII code on the number keypad on your keyboard. For example: [hold down LEFT-ALT] 0 6 5 [release LEFT-ALT] will produce an upper-case A. This works at any time, not just when defining macros.

okwatts commented 1 year ago

Thanks for the quick response I will check this out and see. I have the source for the editor so that should help.

On Thu, Jun 8, 2023 at 5:22 AM David Hansel @.***> wrote:

As far as I know the VT100/VT102 standard did not include mappings for function keys, which is why VersaTerm does not include them either. TeraTerm and Putty also support other standards which I assume include the function keys.

If you know the ASCII sequence your editor expects for the function keys then you can use the keyboard macro function in VersaTerm to define the proper sequence:

  1. press F11 (you will hear a single beep)
  2. press the function key you want to re-define (best stick to F1-F10 since F11 and F12 have meaning in VersaTerm itself)
  3. press the keyboard key sequence you want the function key to send
  4. press F11 again (a double beep will indicate that the macro has been recorded)

Now every time you press the function key, VersaTerm will send that sequence. When you save your configuration the keyboard macros will be included.

Note that during step 3 you can send any ASCII code by pressing and holding the left ALT key and then typing the three-digit (decimal) ASCII code on the number keypad on your keyboard. For example: [hold down LEFT-ALT] 0 6 5 [release LEFT-ALT] will produce an upper-case A. This works at any time, not just when defining macros.

— Reply to this email directly, view it on GitHub https://github.com/dhansel/VersaTerm/issues/3#issuecomment-1582486127, or unsubscribe https://github.com/notifications/unsubscribe-auth/APALSOJXGSAKYXBKIKFHM23XKG7XHANCNFSM6AAAAAAY6DW77M . You are receiving this because you authored the thread.Message ID: @.***>

CygnusTM commented 11 months ago

I just discovered this project and wanted to chime in here as a relative old timer.

As far as I know the VT100/VT102 standard did not include mappings for function keys, which is why VersaTerm does not include them either.

The original VT100-series terminals had four function keys, PF1-PF4. As far as I recall, everything I've used with VT100 emulation (going back to the 80s) maps at least those four.

dhansel commented 11 months ago

Thanks for the info! I had another look at the manual and don't understand how I missed the PF1-PF4 keys before. To map F1/F2/F3/F4 to the corresponding sequences (ESC O P/Q/R/S) using macros:

  1. For F1 press: F11 F1 ESC O P F11
  2. For F2 press: F11 F2 ESC O Q F11
  3. For F3 press: F11 F3 ESC O R F11
  4. For F4 press: F11 F4 ESC O S F11

It shouldn't be hard to add the mapping natively. I'm currently away from home but will take a look when I get back.

dhansel commented 9 months ago

I finally got around to implementing support for the PF1-PF4 function keys on the VT100 keyboard (using F1-F4 on regular keyboards. In the latest version the correct sequences for those keys are now produced.