replace textinput with tui-textarea
The popup used for text input is fine in most cases but generates many requests for features in the multiline case, particularly the commit message.
There are several open requests on this. Rather than a piecemeal approach of adding bits and pieces I think it would be better to use a plugin component that offers
- line split and join
- undo
- full multiline edit
- cut / paste
- .....
tui-textarea https://github.com/rhysd/tui-textarea is just such a component
I have done an experiment to see how easy it would be to drop in. Its pretty straightforward. Took a couple of hours
unless you think this is a completely stupid idea I will give it a less hacky go. You could then clone if from my repo and see what you think. The UI looks the same, its just that the multiline textinput supports full edit.
I also have a couple of points to discuss about it in terms of what keys should do what. But I want to see if you think this is at least a possibility before engaging is further debate.
PS - are you aware of the whole ratatui thing. https://github.com/tui-rs-revival/ratatui
unless you think this is a completely stupid idea I will give it a less hacky go
if it can be used in gitui without changing a ton of keys I am in 💪
are you aware of the whole ratatui thing
yeah I just updated today to ratatui: 904885e
The main question re keys. In the commit edit window the behavior of the 'enter' key.
The 'natural' thing for an edit window is for this to break a line / add a new line. However gituis natural workflow for commit is
- 'c'
- 'switch to ratatui'
- 'ENTER'
which closes the dialog and does the commit. I can make that work, then left with what should the break line be?
- ctrl-Enter
- ctrl-M (its tui-textarea default)
They are not obvious though. I will add a 'help' option I think.
Second question
Why is there all that warning stuff about commit message length. What rules are you enforcing and where do they come from, since I need to do the same thing- I think
Hey @pm100 - re the commit message length warning, see https://github.com/extrawurst/gitui/issues/478
which closes the dialog and does the commit. I can make that work, then left with what should the break line be?
* ctrl-Enter * ctrl-M (its tui-textarea default)
FWIW as a relative gitui newcomer, I would think, as you suggest, unmodified Enter should behave exactly as now. No point in befuddling current users.
I don't like either of your proposed newline-entering shortcuts. ctrl-Enter is used in many other apps to submit (eg. here in github issues!). ctrl-M seems a bit obscure to me.
I would suggest SHIFT+Enter. It's fairly commonly used for this purpose IIRC. It's actually the first one I tried in gitui when I realised (counter to my expectations) that Enter submitted the dialogue.
I am with the SHIFT + Enter 👍
@pm100 do you want to work in this?
My problem is that I am waiting for the owner of tui textarea to accept a PR. I have prodded a couple of times but got no response. I have the changes to Gitui basically working, but off my own fork of textarea.
From: extrawurst @.> Sent: Friday, August 11, 2023 3:03:32 AM To: extrawurst/gitui @.> Cc: pm100 @.>; Mention @.> Subject: Re: [extrawurst/gitui] replace textinput with tui-textarea (Issue #1662)
@pm100https://github.com/pm100 do you want to work in this?
— Reply to this email directly, view it on GitHubhttps://github.com/extrawurst/gitui/issues/1662#issuecomment-1674496595, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AADXODZ273VNFZBDJCTPTADXUX7PJANCNFSM6AAAAAAXETRHG4. You are receiving this because you were mentioned.Message ID: @.***>
We'll need the author of tui-textarea to update the version on crates.io too. The last version there still has dependencies to the deprecated tui-ts crate. I've opened an issue there a while ago and haven't got any response since then.
Without this update it's impossible to publish the new version on crates.io because they don't accept dependencies from outside crates.io packages
There are quite a few things I would like to change about that package. I was thinking about created a tui widgets repo. Add textarea, with fixes, plus tui menu, which is another semi abandoned tui project
From: Ammar Abou Zor @.> Sent: Friday, August 11, 2023 11:15:20 AM To: extrawurst/gitui @.> Cc: pm100 @.>; Mention @.> Subject: Re: [extrawurst/gitui] replace textinput with tui-textarea (Issue #1662)
We'll need the author of tui-textarea to update the version on crates.io too. The last version there still have dependencies to the deprecated tui-ts crate. I've opened an issue there a while ago and haven't got any response since then. Without this update it's impossible to publish the new version on crates.io because they don't accept dependencies from outside crates.io packages
— Reply to this email directly, view it on GitHubhttps://github.com/extrawurst/gitui/issues/1662#issuecomment-1675186118, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AADXOD5MIX7V244Q67G3WDDXUZZDRANCNFSM6AAAAAAXETRHG4. You are receiving this because you were mentioned.Message ID: @.***>
A new version of text-area has finally arrived. I think this can be implemented now
resuming work on this now, watch this space
@AmmarAbouZor @extrawurst see pr #1937
Work completed , now only changes one file, but it is stuck on the ratatui version issue see #1959
note that this will also fix #1699 as tui-textarea has full support for all language types
and #1333
Closed via #2051