Commit 7e0c881
committed
feat(repl): session-context toolbar + completion/popup polish
Adds the bottom-toolbar feature from the original plan plus the
last round of UX polish on the prompt_toolkit candidate popup
that we shaved down through testing:
- **Bottom toolbar** shows the running RF version and the cwd at
all times — orientation info that's useful when juggling several
venvs / project directories.
- **Esc** closes the candidate popup and reverts any preview text
that arrow-navigation had pinned, restoring the user's literal
pre-popup buffer. Bound only when the popup is open
(`has_completions` filter) so Esc keeps its Alt-chord prefix
role everywhere else.
- **Enter** on a highlighted candidate accepts it (popup closes,
preview becomes permanent). For keyword completions Enter also
cleans up the cell — deletes any leftover text after the cursor
in the same cell (so a mid-cell completion replaces the whole
keyword) and appends a cell separator if no argument follows.
- **Tab** is smart: cycles through the popup when one is open,
inserts a cell separator in argument context, opens the popup
otherwise.
- **Multi-line history** survives a session restart as one entry
(newlines are escaped to `\\n` on disk so the file stays
readline-compatible).
- **Mid-keyword preview** renders cleanly — `${Lo}` cursor before
`o`, picking `Log To Console` now shows `Log To Console`, not
`Log To Consoleog` (we trim the forward-cell tail from the
state's `original_document` before prompt_toolkit applies the
preview).
- **TEXT_FRAGMENT** in compound variable lookups (`${PREFIX_${X}}`)
renders with the variable-name colour, not the argument colour,
so the eye reads the whole concatenated name as one identifier.
- **EOL / EOS** tokens from Robot's tokenizer are dropped from the
rendered fragments — `\\n` inside a fragment would otherwise show
as `^J` at the end of every multi-line buffer line.
- **Trailing whitespace** is padded out to the document's actual
length so the cursor stays in sync with the buffer (was sticking
at column 0 when the user kept typing spaces).
- **`_completion.py`** is consolidated — `candidates_for()` is now
a thin projection over `candidates_for_rich()`, ~200 lines of
duplicated helpers removed (was an artefact of how the rich
variant was added in the previous commit).
- **`CELL_SEPARATOR`** + **`find_cell_end()`** added to
`_completion.py` as named constants and a shared helper, used by
the smart-Tab / Enter-cleanup paths.1 parent c891215 commit 7e0c881
6 files changed
Lines changed: 777 additions & 302 deletions
File tree
- docs/03_reference
- packages/repl/src/robotcode/repl
- _input
- tests/robotcode/repl
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
169 | 180 | | |
170 | 181 | | |
171 | 182 | | |
| |||
0 commit comments