fix(cli): write editor draft to prompt.md so syntax highlighting works
Base CLI was handing prompt_toolkit's Buffer.open_in_editor() a default config — Buffer.tempfile_suffix and .tempfile both empty — so it created /tmp/tmpXXXXXX with no extension. nano/vim/helix all key syntax highlighting off the file extension, so the buffer rendered plain. The TUI already writes to <mkdtemp>/prompt.md and gets full markdown highlighting + a sensible title bar. Set buffer.tempfile = 'prompt.md' on the TextArea so prompt_toolkit's complex-tempfile path produces <mkdtemp>/prompt.md to match. shutil.rmtree cleanup is built-in.
This commit is contained in:
6
cli.py
6
cli.py
@@ -9783,6 +9783,12 @@ class HermesCLI:
|
||||
completer=_completer,
|
||||
),
|
||||
)
|
||||
# Match the TUI's editor handoff: the temp file lands at
|
||||
# <mkdtemp>/prompt.md so vim/nano/helix pick up markdown syntax
|
||||
# highlighting from the .md extension and the title bar reads
|
||||
# "prompt.md" instead of a random "tmpXXXXXX". prompt_toolkit's
|
||||
# complex-tempfile path takes care of cleanup via shutil.rmtree.
|
||||
input_area.buffer.tempfile = 'prompt.md'
|
||||
|
||||
# Dynamic height: accounts for both explicit newlines AND visual
|
||||
# wrapping of long lines so the input area always fits its content.
|
||||
|
||||
Reference in New Issue
Block a user