Skip to content

Fix view/edit to support multi-word PAGER/EDITOR#1

Merged
kooler merged 1 commit intokooler:mainfrom
secsaba:bugfix-view
Apr 7, 2026
Merged

Fix view/edit to support multi-word PAGER/EDITOR#1
kooler merged 1 commit intokooler:mainfrom
secsaba:bugfix-view

Conversation

@secsaba
Copy link
Copy Markdown
Contributor

@secsaba secsaba commented Apr 3, 2026

Summary

  • Fix viewFileCmd and editFileCmd to handle multi-word environment variables (e.g. EDITOR="code --wait") by splitting with strings.Fields
  • Consolidate duplicated logic into a shared externalCmd helper
  • Handle edge case where env var is set to whitespace-only

Test plan

  • Set EDITOR="vim" and verify edit works
  • Set EDITOR="code --wait" and verify edit works with multi-word command
  • Set PAGER="less -R" and verify view works with flags
  • Unset EDITOR/PAGER and verify fallbacks (vi/less) work
  • Set EDITOR=" " and verify fallback is used

Consolidate viewFileCmd and editFileCmd into a shared externalCmd helper
that splits the env var with strings.Fields, so commands like
EDITOR="code --wait" work correctly.
@kooler
Copy link
Copy Markdown
Owner

kooler commented Apr 7, 2026

Thank you, good improvement! Merging.

@kooler kooler merged commit e06eb8b into kooler:main Apr 7, 2026
1 check passed
@kooler kooler mentioned this pull request Apr 7, 2026
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