Skip to content

Use /bin/sh to launch editor (proper shell quoting for editor)#265

Open
JacksonChen666 wants to merge 2 commits into
RasmusLindroth:masterfrom
JacksonChen666:fix/editor-sh
Open

Use /bin/sh to launch editor (proper shell quoting for editor)#265
JacksonChen666 wants to merge 2 commits into
RasmusLindroth:masterfrom
JacksonChen666:fix/editor-sh

Conversation

@JacksonChen666

Copy link
Copy Markdown

#96 (comment)

I solved it in another way, but thank you for the pull request :)

@RasmusLindroth Your solution (assuming here) does it wrong when having to deal with escaped characters (spaces). Probably better to leave it up to the shell than do it yourself in a way that doesn't work for all.

Because my neovim config does stuff I don't want for composing toots, I have do :set tw=0 every time I open the editor. I had an idea, it's to do nvim -c ":set tw=0" but tut interprets the space between set and tw=0 to be a separate argument, basically making it impossible for my solution to work.

tut/ui/open.go

Line 89 in 33d7cd8

parts := strings.Split(editor, " ")

That was my somewhat ranty rant. This PR is pretty much this but rebased so that it works on the master branch.

Also, I tested it, now my thing works. I'm not sure of other scenarios where it doesn't work (or works against the user).

(Questions welcome, although you should read the quoted text for rationale. I am sending this in quite a hurry because I already lost a previous version of my comment, it's nearly midnight and i'm kinda annoyed, so let me know of any little imperfections)

JacksonChen666 and others added 2 commits May 9, 2023 23:03
RasmusLindroth#96
Co-authored-by: Jez Cope <j.cope@erambler.co.uk>
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