Skip to content

feat(compat-editor): Save As prompt when launched without a filename#56

Merged
rizukirr merged 1 commit into
mainfrom
fix/editor-save-as
Jun 13, 2026
Merged

feat(compat-editor): Save As prompt when launched without a filename#56
rizukirr merged 1 commit into
mainfrom
fix/editor-save-as

Conversation

@rizukirr

@rizukirr rizukirr commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Summary

The example editor's Ctrl-S was a silent no-op when launched without a filename (./editor with no argument → g_filename == NULLsave_file() returned immediately). Add a minimal Save As prompt.

Behavior

  • Ctrl-S with no filename → a Save as: prompt on the status line. Type a path, Enter saves and adopts the name (subsequent saves go straight to it); Esc or an empty name cancels.
  • Ctrl-S with a filename (launched as ./editor file.txt) → unchanged, saves in place.

Notes

  • New static prompt_filename() runs a small input loop using the editor's existing tb_* idiom; no new dependencies.
  • The white-box buffer test references it so the -Werror -Wunused-function build stays clean.

Testing

  • ctest → 100% passed, 37 tests.
  • editor + test_compat_editor build clean under -Werror on gcc and clang (scalar lane); clang-format clean.

Pressing Ctrl-S with no filename was a silent no-op (g_filename == NULL). Add a
minimal status-line 'Save as:' prompt: type a path, Enter saves and adopts the
name, Esc (or empty) cancels. Reference the new static prompt_filename from the
white-box test so -Werror -Wunused-function stays satisfied.
@rizukirr rizukirr merged commit 66af1a6 into main Jun 13, 2026
21 checks passed
@rizukirr rizukirr deleted the fix/editor-save-as branch June 13, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant