-
-
Notifications
You must be signed in to change notification settings - Fork 608
Multiline commit message #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiline commit message #114
Conversation
71deeda
to
f444086
Compare
f444086
to
d5171a7
Compare
d5171a7
to
2fe08df
Compare
2fe08df
to
f74b1ee
Compare
Adds support for editing commit messages in an external editor. It read the GIT_EDITOR, VISUAL, EDITOR environment variables in turn (in the same order git does natively) and tries to launch the specified editor. If no editor is found, it falls back to "vi" (same as git). If vi is not available, it will fail with a message.
f74b1ee
to
50b0222
Compare
The summary of this PR pretty much boils down to the commit message of the commit:
|
wooohhooooooo!! Thank you @jonstodle 🙏 |
closes #46 |
Pressing `e` while looking at a file in the _Status_ view will launch an external editor with the current file opened. The editor chosen is determined by the default logic introduced in gitui-org#114. An improvement to this in the future could be launching at the specific line at which the _Diff_ view is focused, but that seems to require a change in `FileDiff` which is a change bigger than this PR. Fixes gitui-org#166
Pressing `e` while looking at a file in the _Status_ view will launch an external editor with the current file opened. The editor chosen is determined by the default logic introduced in gitui-org#114. An improvement to this in the future could be launching at the specific line at which the _Diff_ view is focused, but that seems to require a change in `FileDiff` which is a change bigger than this PR. Fixes gitui-org#166
Pressing `e` while looking at a file in the _Status_ view will launch an external editor with the current file opened. The editor chosen is determined by the default logic introduced in #114. An improvement to this in the future could be launching at the specific line at which the _Diff_ view is focused, but that seems to require a change in `FileDiff` which is a change bigger than this PR. Fixes #166
This intends to implement a way to enter multi-line commit messages. Ref #46
This adds support for opening a file in an external editor, writing the commit message and saving it to the file, and the use the entered message as the commit message. This works in much the same way git does by default.
This PR at, in it's current state is not ready for merging. There are a few issues which will need to be resolved first and I hope to get some feedback on how to solve these. They are as follows:
gitui will capture key stroke events and prevent them from being passed on to the editor
The background thread spawned by gitui will continue to run and capture key strokes while the external editor is in use. I see mainly three ways of solving this:
gitui needs to redraw everything when returning from editor
Because both gitui and vim uses the alternative screen feature, gitui will need to redraw it's whole UI when returning from the editor as the incremental updates tui usually does means some parts of the UI never gets set to it's correct state. If a part of gitui never changes, the "regular" shell underneath will "show through".
It seems the only way to make tui redraw the whole screen is to both clear the current screen, but also reset the stored previous buffer. Resetting all the stored buffers is something tui doesn't allow consumers to do (as far as I can see), except for one instance:
resize
. This function will reset all the internal buffers and force a redraw of the whole screen.resize
is currently used to enforce a redraw. (Might be worth considering opening an issue upstream to enable forcing a complete redraw of the UI).A big downside with current implementation of this is that it introduces a mutable static variable, which means it also introduces
unsafe
(the forbid unsafe directive has been commented out). This might be worked around by usinglazy_static
, but I haven't investigated that in any way.The reason for the mutable static is the introduction of a new channel, global to the app, which let's different parts of the app send command requests to the main loop. In this case it's a request for a full redraw of the UI, but this could be useful for other commands later (but with a better implementation of how to share the sender).
This PR is not based on a very recent commit because master would not build on stable for me, so I kept it at 0.5.0-ish. I will rebase it at a later point.