added macro support

This commit is contained in:
Hermes Agent
2026-08-16 21:39:18 +00:00
parent e407c064bf
commit b9471a89fb
8 changed files with 2533 additions and 16 deletions

View File

@@ -40,6 +40,10 @@ database with the `.agnd` extension.
clickable function-key commands, and an in-app help screen.
- Application-wide Preferences plus per-document settings for themes, display and
locale conventions, autosave, confirmations, dates, filing, Trash, and backups.
- Document-local Agenda-style macros: literal keystroke playback, brace commands,
persistent variables, branches, loops, calls, prompts and menus, AUTOEXEC,
key bindings, and a Learn recorder. The responsive macro editor adds syntax
highlighting and key capture without sanding away the unusual original language.
## Build and run
@@ -99,6 +103,7 @@ or build failure stops the gate.
| `F10` or `m` | Command menu |
| `r` | Edit prerequisites for the selected item |
| `/` | Search the current view |
| `Ctrl-G` | Macro Manager / stop and save a Learn recording |
| `h` / `l` | Previous / next saved view (`[` / `]` are aliases) |
| `Ctrl-S` | Save/checkpoint |
| `?` or `F1` | Help |
@@ -149,6 +154,64 @@ Use `F10`, then `b` to create a consistent sibling backup named
`document.agnd.bak`, or enable backup-on-open. Use `F10`, then `t` to empty Trash.
Permanent operations request confirmation unless that preference is disabled.
## Macros and Learn recording
Press `Ctrl-G` to open the Macro Manager. Its layout and primary keys follow
Agenda 2.0: `Insert` adds, `F2` edits, `Enter` runs, `F7` starts Learn recording,
plain `a` appends a recording, `F6` attaches a key, and `F4`/`Delete` removes.
Clicking a macro selects it. While Learn is active, Rogue Agenda shows a `LEARN`
indicator and records the real keys you use throughout the application; press
`Ctrl-G` anywhere to stop and save. The historical `Alt-F3` and `Shift-F7`
combinations remain aliases when a terminal can transmit them.
The first command names the macro. Everything outside braces is played as literal
typing, while entries inside braces represent keys or commands. For example:
```text
{capturetask}
n
{inputtext;What needs doing?;%task}
{type;%task}
{enter}
```
This opens New Item, asks a question, types the answer into the still-open item
editor, and saves it. Newlines and indentation in macro source are for readability
and are not played. The language is case-insensitive.
The implementation covers the original command families:
- Keys and highlight control, including repeat counts: `{enter;2}`, `{altf6}`,
`{ctlpgup}`, `{shftab}`, and `{selection;setting}`.
- Variables and strings: `{defstr}`, `{defint}`, `{deffloat}`, `{let}`, `{clear}`,
`{undef}`, `{append}`, `{find}`, `{length}`, `{leftstr}`, `{midstr}`, and
`{rightstr}`. Local names begin with `%`; persistent document globals use `%%`.
- Control flow: `{branch}`, `{call}`, `{for}`, `{goto}`, `{if}`, `{ifeq}`,
`{ifkey}`, `{ifnoteq}`, `{label}`, `{onbreak}`, `{onerror}`, `{return}`, and
`{quit}`.
- Interaction: `{alert}`, `{getkey}`, `{inputcat}`, `{inputfile}`, `{inputtext}`,
`{largebox}`, `{lotusmenu}`, and `{rollmenu}`.
- Agenda special variables such as `#DATE`, `#TIME`, `#FILENAME`, `#VIEWNAME`,
`#HIGHLIGHT_VALUE`, `#MARK_COUNT`, `#ARGCOUNT`, and `#ASCII(nnn)`.
The DOS screen-pacing directives (`DEBUGON`/`DEBUGOFF`, `SPEED`, and the
`WINDOWS*` commands) are accepted but have no visual effect in the continuously
redrawn TUI. `#CLIPBOARD` is reserved but remains empty until Rogue Agenda gains
an application-owned copy/cut buffer.
`AUTOEXEC` runs automatically when its document opens. Global `%%` variables are
stored in the `.agnd` database. `Ctrl-C` interrupts a running macro or invokes its
`{onbreak}` handler. Macro-created prompts and menus support both keyboard and
mouse operation.
The editor is a responsive, near-full-screen reinterpretation of Agenda's note-
style Macro Editor. `Enter` adds a line, `F5` or `Ctrl-S` saves, `Esc` cancels,
and `Ctrl-V` captures the next pressed key as source notation. The same `Ctrl-V`
shortcut captures a key in the F6 binding field. `Alt-=` remains an optional
historical alias. Commands, labels,
local/global/special variables, numbers, comments, delimiters, and syntax errors
have distinct colors.
## Designing live views
Open the View Manager with `F8`. Press `n` to create a view, `e` to edit one,