Skip to content
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

replace textinput with tui-textarea #1662

Closed
pm100 opened this issue Apr 19, 2023 · 15 comments
Closed

replace textinput with tui-textarea #1662

pm100 opened this issue Apr 19, 2023 · 15 comments
Milestone

Comments

@pm100
Copy link
Contributor

pm100 commented Apr 19, 2023

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

@extrawurst
Copy link
Owner

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

@pm100
Copy link
Contributor Author

pm100 commented Apr 19, 2023

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

@crispinb
Copy link

Hey @pm100 - re the commit message length warning, see #478

@crispinb
Copy link

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.

@rakibulhaq
Copy link

I am with the SHIFT + Enter 👍

@extrawurst
Copy link
Owner

@pm100 do you want to work in this?

@pm100
Copy link
Contributor Author

pm100 commented Aug 11, 2023 via email

@AmmarAbouZor
Copy link
Contributor

AmmarAbouZor commented Aug 11, 2023

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

@pm100
Copy link
Contributor Author

pm100 commented Aug 12, 2023 via email

@AmmarAbouZor
Copy link
Contributor

A new version of text-area has finally arrived. I think this can be implemented now

@pm100
Copy link
Contributor Author

pm100 commented Oct 7, 2023

resuming work on this now, watch this space

@pm100
Copy link
Contributor Author

pm100 commented Oct 24, 2023

@AmmarAbouZor @extrawurst see pr #1937

@pm100
Copy link
Contributor Author

pm100 commented Nov 23, 2023

Work completed , now only changes one file, but it is stuck on the ratatui version issue see #1959

@pm100
Copy link
Contributor Author

pm100 commented Nov 23, 2023

note that this will also fix #1699 as tui-textarea has full support for all language types

and #1333

@extrawurst extrawurst added this to the v0.25 milestone Feb 12, 2024
This was referenced Feb 13, 2024
@extrawurst
Copy link
Owner

Closed via #2051

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants