Create immediate mode for Editor prompt#271
Open
kurtbuilds wants to merge 1 commit intomikaelmello:mainfrom
Open
Create immediate mode for Editor prompt#271kurtbuilds wants to merge 1 commit intomikaelmello:mainfrom
kurtbuilds wants to merge 1 commit intomikaelmello:mainfrom
Conversation
|
I did not review this PR, but would like to use the same functionality. This PR looks stale. Is there anything I can do help it progress? |
Author
|
@mikaelmello any thoughts? it looks like this repo isn't receiving love lately (failing tests + last commit 6 months ago). let me know if there's a way to help. |
lorenzleutgeb
added a commit
to radicle-dev/heartwood
that referenced
this pull request
Jul 16, 2025
`radicle-term` includes quite a lot of rather "low-level" logic to spawn the preferred editor of the user. In particular, this logic is platform-dependent and only works on Unix-like platforms. Also, `radicle-term` already depends on `inquire` which features an editor prompt. It is a cross-platform solution to spawn the editor. This commit changes the implementation of `Editor` to be a wrapper of `inquire::Editor`, keeping the interface mostly intact. Downsides: - We cannot edit a file "in place" this way, instead we have to read it, as `inquire` only supports editing temporary files. This can also be viewed as a benefit, as we lessen the risk of corruption of these files. - `inquire::Editor` contains borrows, so it is quite cumbersome to extend it with a custom mechanism for looking up the preferred editor. The lookup logic was kept, but needs to be invoked by the caller. In the future we might consider just using the logic provided by `inquire` or requesting a change to `inquire`. - The prompt is a bit strange. It does not show the current state of the output, see <mikaelmello/inquire#280> and <mikaelmello/inquire#271>.
lorenzleutgeb
added a commit
to radicle-dev/heartwood
that referenced
this pull request
Jul 17, 2025
`radicle-term` includes quite a lot of rather "low-level" logic to spawn the preferred editor of the user. In particular, this logic is platform-dependent and only works on Unix-like platforms. Also, `radicle-term` already depends on `inquire` which features an editor prompt. It is a cross-platform solution to spawn the editor. This commit changes the implementation of `Editor` to be a wrapper of `inquire::Editor`, keeping the interface mostly intact. Downsides: - We cannot edit a file "in place" this way, instead we have to read it, as `inquire` only supports editing temporary files. This can also be viewed as a benefit, as we lessen the risk of corruption of these files. - `inquire::Editor` contains borrows, so it is quite cumbersome to extend it with a custom mechanism for looking up the preferred editor. The lookup logic was kept, but needs to be invoked by the caller. In the future we might consider just using the logic provided by `inquire` or requesting a change to `inquire`. - The prompt is a bit strange. It does not show the current state of the output, see <mikaelmello/inquire#280> and <mikaelmello/inquire#271>.
lorenzleutgeb
added a commit
to radicle-dev/heartwood
that referenced
this pull request
Jul 23, 2025
`radicle-term` includes quite a lot of rather "low-level" logic to spawn the preferred editor of the user. In particular, this logic is platform-dependent and only works on Unix-like platforms. Also, `radicle-term` already depends on `inquire` which features an editor prompt. It is a cross-platform solution to spawn the editor. This commit changes the implementation of `Editor` to be a wrapper of `inquire::Editor`, keeping the interface mostly intact. Downsides: - We cannot edit a file "in place" this way, instead we have to read it, as `inquire` only supports editing temporary files. This can also be viewed as a benefit, as we lessen the risk of corruption of these files. - `inquire::Editor` contains borrows, so it is quite cumbersome to extend it with a custom mechanism for looking up the preferred editor. The lookup logic was kept, but needs to be invoked by the caller. In the future we might consider just using the logic provided by `inquire` or requesting a change to `inquire`. - The prompt is a bit strange. It does not show the current state of the output, see <mikaelmello/inquire#280> and <mikaelmello/inquire#271>.
lorenzleutgeb
added a commit
to radicle-dev/heartwood
that referenced
this pull request
Sep 13, 2025
`radicle-term` includes quite a lot of rather "low-level" logic to spawn the preferred editor of the user. In particular, this logic is platform-dependent and only works on Unix-like platforms. Also, `radicle-term` already depends on `inquire` which features an editor prompt. It is a cross-platform solution to spawn the editor. This commit changes the implementation of `Editor` to be a wrapper of `inquire::Editor`, keeping the interface mostly intact. Downsides: - We cannot edit a file "in place" this way, instead we have to read it, as `inquire` only supports editing temporary files. This can also be viewed as a benefit, as we lessen the risk of corruption of these files. - `inquire::Editor` contains borrows, so it is quite cumbersome to extend it with a custom mechanism for looking up the preferred editor. The lookup logic was kept, but needs to be invoked by the caller. In the future we might consider just using the logic provided by `inquire` or requesting a change to `inquire`. - The prompt is a bit strange. It does not show the current state of the output, see <mikaelmello/inquire#280> and <mikaelmello/inquire#271>.
lorenzleutgeb
added a commit
to radicle-dev/heartwood
that referenced
this pull request
Sep 21, 2025
`radicle-term` includes quite a lot of rather "low-level" logic to spawn the preferred editor of the user. In particular, this logic is platform-dependent and only works on Unix-like platforms. Also, `radicle-term` already depends on `inquire` which features an editor prompt. It is a cross-platform solution to spawn the editor. This commit changes the implementation of `Editor` to be a wrapper of `inquire::Editor`, keeping the interface mostly intact. Downsides: - We cannot edit a file "in place" this way, instead we have to read it, as `inquire` only supports editing temporary files. This can also be viewed as a benefit, as we lessen the risk of corruption of these files. - `inquire::Editor` contains borrows, so it is quite cumbersome to extend it with a custom mechanism for looking up the preferred editor. The lookup logic was kept, but needs to be invoked by the caller. In the future we might consider just using the logic provided by `inquire` or requesting a change to `inquire`. - The prompt is a bit strange. It does not show the current state of the output, see <mikaelmello/inquire#280> and <mikaelmello/inquire#271>.
lorenzleutgeb
added a commit
to radicle-dev/heartwood
that referenced
this pull request
Sep 24, 2025
`radicle-term` includes quite a lot of rather "low-level" logic to spawn the preferred editor of the user. In particular, this logic is platform-dependent and only works on Unix-like platforms. Also, `radicle-term` already depends on `inquire` which features an editor prompt. It is a cross-platform solution to spawn the editor. This commit changes the implementation of `Editor` to be a wrapper of `inquire::Editor`, keeping the interface mostly intact. Downsides: - We cannot edit a file "in place" this way, instead we have to read it, as `inquire` only supports editing temporary files. This can also be viewed as a benefit, as we lessen the risk of corruption of these files. - `inquire::Editor` contains borrows, so it is quite cumbersome to extend it with a custom mechanism for looking up the preferred editor. The lookup logic was kept, but needs to be invoked by the caller. In the future we might consider just using the logic provided by `inquire` or requesting a change to `inquire`. - The prompt is a bit strange. It does not show the current state of the output, see <mikaelmello/inquire#280> and <mikaelmello/inquire#271>.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Using a tool like
git, there is an "immediate" mode for the commit message, where runninggit commitimmediately opens up the editor, without displaying a prompt, it aborts if the editor quits without saving, and then it displays the message.Right now,
promptonly works with the intermediary step of pressing e to open the editor.This adds another function
prompt_immediate()for users that want functionality more similar to howgit commitworks.