Skip to content

Support Default Editor Setting In Windows#1454

Open
bkiran6398 wants to merge 4 commits intomainfrom
DXCDT-1481/windows_default_editor
Open

Support Default Editor Setting In Windows#1454
bkiran6398 wants to merge 4 commits intomainfrom
DXCDT-1481/windows_default_editor

Conversation

@bkiran6398
Copy link
Contributor

@bkiran6398 bkiran6398 commented Mar 3, 2026

🔧 Changes

Adds platform-specific argument parsing for the EDITOR environment variable to allow setting default on Windows.

  • On Windows: uses the native CommandLineToArgvW API to correctly handle backslash paths and quoted paths with spaces
  • On Unix: continues using go-shellquote for POSIX shell quoting
  • Platform-specific implementations via Go build tags (editor_windows.go, editor_unix.go)
README updates:
  • Documents default editors (vim on Linux/macOS, notepad on Windows)
  • Adds Windows-specific instructions for setting EDITOR in PowerShell and Command Prompt

📚 References

🔬 Testing

Automated tests added for both platforms covering:

  • Simple editor names, Paths with spaces in quotes, Multiple flags, Edge cases

Manual testing performed on a Windows machine:

  • Verified editor launches correctly in both PowerShell and Command Prompt for single-session and persistent (across sessions) configurations
  • Tested with editor paths containing spaces in both shells

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

bkiran6398 and others added 4 commits March 3, 2026 14:15
- Added `parseEditorArgs` function for Windows and POSIX systems to handle command line arguments for text editors.
- Created `editor_windows.go` and `editor_unix.go` files to separate platform-specific implementations.
- Introduced tests in `editor_windows_test.go` and `editor_unix_test.go` to ensure correct parsing behavior across different scenarios.
- This change enhances compatibility with various text editors by correctly interpreting command line arguments, improving user experience.
- Clarified the default text editor settings for Linux/macOS and Windows.
- Added examples for setting the `EDITOR` environment variable in PowerShell and Command Prompt on Windows.
- Ensured instructions are clear for both terminal and non-terminal editors.
- Updated the Notepad++ and Visual Studio Code paths to a more generic format.
@bkiran6398 bkiran6398 marked this pull request as ready for review March 6, 2026 10:20
@bkiran6398 bkiran6398 requested a review from a team as a code owner March 6, 2026 10:20
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