Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key bindings for DEC VT-320 terminal #38

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ There's an article documenting how this is possible

![Lotus 1-2-3 for Linux](https://lock.cmpxchg8b.com/img/123linux.png)

# Keybindings for real DEC VT320 terminal

If you use a physical DEC VT320 there will be a remapping for some function keys to enable the navigation through multiple-sheet files. These are remapped keys:

- **SHIFT + F20**: go to the next sheet (equivalent to **CTRL + PgUp** on PC)
- **SHIFT + F19**: go to the previous sheet (equivalent to **CTRL + PgDn** on PC)
- **SHIFT + F11**: equivalent to **ESC**

## Building

### Dependencies
Expand Down
15 changes: 15 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,21 @@ int main(int argc, char **argv, char **envp)

setchrclass("ascii");

// Enable emulation of CTRL+PgUp and CTRL+PgDn on physical DEC VT320 terminal
// DEC's Shift+F20 -> Ctrl+PgUp (Go to next sheet)
// DEC's Shift+F19 -> Ctrl+PgDn (Go to previous sheet)
// DEC's Shift+F11 -> ESC
// DEC's Shift+F6 -> ESC
// docs: https://www.vt100.net/docs/vt510-rm/DECUDK.html
char *term = getenv("TERM");
if (term[0]=='v' && term[1]=='t') {
setenv("TERM", "vt100", 1);
printf("\033P1;1;1|34/1b5b353b357e\033\\"); // '|34/' = F20
printf("\033P1;1;1|33/1b5b363b357e\033\\"); // '|33/' = F19
printf("\033P1;1;1|17/1b\033\\"); // '|17/' = F6
printf("\033P1;1;1|23/1b\033\\"); // '|23/' = F11
}

// Disable the banner by default, it can be re-enabled via -b.
banner_printed = true;

Expand Down