mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 13:25:51 +03:00
[GH-ISSUE #64] Feature request: textarea #43
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#43
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @uthng on GitHub (Mar 5, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/64
Hi,
I have just found your package. It is very interessting and I am trying to write an application with it.
I would like to know if there is any plan to create a texarea in the near future ?
Thanks.
NT
@rivo commented on GitHub (Mar 5, 2018):
Hi, glad you like it. I don't have concrete plans for a text area yet. I have been thinking about extending the
TextViewclass to make it editable. However, adding that would get me very close to implementing a full text editor:TextView's color/region tags somehowFormclass so editableTextViewobjects can also be included (e.g. this could break the horizontal layout)So it's not a minor thing to add. I could add an "on roadmap" label to this issue if this is something you definitely need. This would mean I will eventually add it. But it could then still be some time before that happens and I don't know how urgent your need is here. (See #23 for an example of an "on roadmap" feature.)
Do you have a specific use case where an
InputFieldis not enough?@uthng commented on GitHub (Mar 5, 2018):
I have intention to use tview to write several console applications. And in some of them, I need to modify a value under JSON format for example. I understand that it is not easy to but I think it is necessary when we edit some complexe data such as json, html etc. I have been thinking about making TextView to be editable. But I have not really entered in the code yet.
@rivo commented on GitHub (Mar 5, 2018):
For your own project, you could probably come up with something simple by using
TextView, intercepting key events withSetInputCapture(), and using regions and highlights to simulate a cursor.TextViewis already very complex. You can try to extend it but with so many things to consider -- and given that I have to maintain it in the long term -- I'm not sure I will merge any pull requests in that direction.So I'm adding the "on roadmap" label. This means I will implement this but I don't know yet when. I will have to dedicate quite some time to it.
@uthng commented on GitHub (Mar 5, 2018):
Yes, I think that I can manage in my projects so dont worry about when you
will implement it. Anyway, thanks to add "on roadmap" for this request
because it will be really nice to have it as a base element.
Thanh NGUYEN
On 5 March 2018 at 14:50, rivo notifications@github.com wrote:
@glycerine commented on GitHub (Mar 10, 2018):
@uthng Just fyi, there is also a full blown editor atop of tcell, https://github.com/zyedidia/micro, which is MIT licensed and of course is quite tuned to editing text. With mouse support, copy-paste clipboard, macros, plugin system, highlighting, etc.
@glycerine commented on GitHub (Mar 11, 2018):
In addition to micro/if you prefer emacs keybindings, I have ported
goditto Garrett'stcell, calling the resultgemacs: https://github.com/glycerine/gemacs. It is an emacs written in pure Go. As it uses tcell, it should (at least, theoretically) be tview compatible.@ernierasta commented on GitHub (Jan 10, 2019):
Hi everyone, are there any news about textarea? I would like to use tview on my current project, but I need to be able to edit few lines of text. We already have controls working in inputbox, so maybe we are closer to have multiline inputbox?
I really want to avoid using gocui. ;-)
@rivo commented on GitHub (Jan 24, 2019):
Apologies for taking so long but this is really a more complicated issue for which I currently don't seem to have the time. I will definitely add it but cannot give you a time frame for this.
Out of interest, in your application, would you need support for region and colour tags while editing? Or are you looking for a simple text-only editor here?
@ernierasta commented on GitHub (Jan 24, 2019):
@rivo no need for apology, it is open source, we all are working on it when we have time or/and we want!
I personally think, that simple text-only editor would be needed most of times. And in my app this is also the case, regions and color tags would not be used.
@Bios-Marcel commented on GitHub (Feb 23, 2019):
I made something using regions and highlights, maybe this is useful to someone. The code is quite error prone and unperformant and it still has some bugs, but overall it works! I would not recommend something like this for editing big chunks of text. I might replace it with an actual tview component at some point though. And if I do, I'll create a PR.
The code can be found here: https://github.com/Bios-Marcel/cordless/blob/master/internal/ui/editor.go
@glycerine commented on GitHub (Feb 24, 2019):
@ernierasta https://github.com/glycerine/gemacs doesn't ship with rivo/tview, but that matters little. It uses tcell too and it would take a few trivial lines of code to use it as your textarea editor.
@matheusd commented on GitHub (Mar 14, 2019):
@glycerine any chance you have a demo on hand with embedding either editor as a tview form field?
@glycerine commented on GitHub (Mar 14, 2019):
@matheusd not off hand.
@ernierasta commented on GitHub (Mar 15, 2019):
@glycerine @Bios-Marcel thank you both for valuable input! I will probably use one of given options. And I am joining to @matheusd question, example would be very welcome.
Thank you guys again!
@matheusd commented on GitHub (Mar 15, 2019):
I tested @Bios-Marcel
Editorimpl, and while it does have issues, it seems reasonable for a first try.The only thing I felt missing from it was being able to move up/down lines.
@lhanson commented on GitHub (Sep 21, 2019):
Rather than implement editor functionality in tview, would it make more sense to simply punt to using $EDITOR? That way whatever workflow/bindings the user is already accustomed to works seamlessly.
@ernierasta commented on GitHub (Sep 21, 2019):
@lhanson that is not what this ticket is about. You can probably do what You describe right now. We are talking about textarea here. It is similar to box You put Your comment in, it has multiple lines and at least some basic editing capabilities. You need to have it forms in app, not as separate thing. But thank You for stopping by. :-)
@pgavlin commented on GitHub (Oct 28, 2019):
I've just posted femto, a
tview-compatible editor component derived from the micro editor. The API is a work-in-progress, but I think the basics should work.@ernierasta commented on GitHub (Oct 28, 2019):
Great work @pgavlin! Thank you for letting us know!
@Bios-Marcel commented on GitHub (Oct 28, 2019):
Thanks for letting us know, I'll keep and eye on it and might use it :D
@millerlogic commented on GitHub (Feb 6, 2020):
Hey @pgavlin thanks for that! I've used femto with
ssh paste.runI'll probably be forking and making some pull requests.
@7onetella commented on GitHub (Feb 27, 2020):
@rivo thank you for creating a wonderful library for tui. I am using your library with my project here.
https://github.com/7onetella/minidoc
for one liner I use TextInput, for multiple lines, I exec to VIM, and back.
I am happy with using VIM for multiline edit but not everyone is comfortable with VIM.
it would be nice to have textarea for sure but I understand that you have a normal busy life like the rest of us. thank you anyway.
@Konstantin8105 commented on GitHub (May 14, 2020):
Add minimal PR #447 with multi-line text editor or
TextArea@flowchartsman commented on GitHub (Apr 22, 2021):
Is anyone aware of another widget (in any repo) that implements this functionality, even in a very basic way? I fully understand the difficulties in doing an implementation "the right way", and I excitedly await a more official "textarea" from @rivo, but I have found myself 99% of the way through an application and blocked by the the need for a simple, multiline input, and I cannot make it work. Femto is too heavy, #447 requires forking (i.e. I can't isolate it as an internal import because it depends too heavily on internal changes and dependencies), and shelling out to
$editoris completely broken, at least for me. I don't need much, and can hack quite easily around anything more than "a box that I can shuffle text around in", but I also don't want to dive into a rabbit hole making a new widget when I have been able to get so far without diving into internals at all. I am at the point where I am considering vendoring the entire library with a diff of #447 overlaid on top of it just to get this one piece of functionality, so I am asking here as a last resort.@glycerine commented on GitHub (Apr 22, 2021):
@flowchartsman see my comment above. https://github.com/glycerine/gemacs
@flowchartsman commented on GitHub (Apr 22, 2021):
@glycerine, I did (by the way, love your libraries), but, like you mentioned above in 2018, there's no quick example of embedding it as a widget and when I looked at the repo I was a little daunted by the complexity, and you appear to vendor tcell as well, so I honestly didn't consider it an option and looked elsewhere. Perhaps I should take another look, though some more guidance would be helpful.
@glycerine commented on GitHub (Apr 22, 2021):
Sorry, its been too long. You'll have to dive in, I'm afraid. The rabbit hole is likely very shallow though with gemacs an micro examples.
@rivo commented on GitHub (May 4, 2021):
Please check out #594
@golangdojo99 commented on GitHub (Sep 27, 2022):
This issue should be closed now that the
TextAreawidget has been implemented.@rivo commented on GitHub (Dec 11, 2022):
See #594