Skip to content

fix(editor): fall back to $EDITOR and defaults when $VISUAL is unset - #122

Merged
maxlandon merged 1 commit into
reeflective:masterfrom
dbactual:fix/getsystemeditor-fallback
Sep 30, 2026
Merged

maxlandon merged 1 commit into
reeflective:masterfrom
dbactual:fix/getsystemeditor-fallback

Conversation

@dbactual

Copy link
Copy Markdown
Contributor

Problem

getSystemEditor() in internal/editor/editor.go returned an empty string immediately when $VISUAL was unset, skipping the $EDITOR fallback and the vi/emacs default. This broke edit-and-execute-command (Ctrl-X Ctrl-E) with:

Editor error: failed to start editor: exec: no command

This is the common case, since most users set only $EDITOR.

Fix

Check each fallback in order (per the doc comments on editAndExecuteCommand in emacs.go and editAndExecute in vim.go) and return the first non-empty value; fall back to vi (or emacs when emacsDefault) only when both env vars are unset.

Testing

  • go build ./... passes (the package has no tests)
  • Manually verified: with VISUAL unset and EDITOR=vim, Ctrl-X Ctrl-E now opens vim

@dbactual
dbactual marked this pull request as ready for review September 27, 2026 15:05
getSystemEditor() returned an empty string when VISUAL was unset,
skipping the documented EDITOR fallback and vi/emacs default, which
broke edit-and-execute (Ctrl-X Ctrl-E) with 'exec: no command'.
@dbactual
dbactual force-pushed the fix/getsystemeditor-fallback branch from 1d68d49 to f2d6a09 Compare September 27, 2026 15:06
@codecov

codecov Bot commented Sep 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.82%. Comparing base (196a349) to head (f2d6a09).

Files with missing lines Patch % Lines
internal/editor/editor.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #122   +/-   ##
=======================================
  Coverage   39.82%   39.82%           
=======================================
  Files          60       60           
  Lines        9595     9594    -1     
=======================================
  Hits         3821     3821           
+ Misses       5680     5679    -1     
  Partials       94       94           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maxlandon

Copy link
Copy Markdown
Member

Thanks for the fix !

@maxlandon
maxlandon merged commit 8c6cfe7 into reeflective:master Sep 30, 2026
10 of 11 checks passed
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.

2 participants