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.
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.