-
Notifications
You must be signed in to change notification settings - Fork 129
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
Readline movement support #28
Comments
I agree; but I don't plan to do this myself as of now, as I don't have enough resources for that, unfortunately. If someone wants to jump in and help, I'm super happy to provide mentoring, design discussion and guidance! ❤️ The process will be easiest for us both if you start talking to me here even before you start working on this. Also it's ok to fail - I won't be regretful if you don't complete the task even after we've put a lot of our time into it. I am more than sure we both will learn a lot from this anyway! |
I'd love to see this! Got started and managed to get the basics implemented:
cmacrae/up@a760a13 🕺 |
Next I'd be looking to implement:
Curious if others interested in this feature would also like to see |
Well, I've implemented |
Aaaaaand with I settled on One note (I don't have time to address this just at the moment, burgers and beer are calling 🍔 🍺 ): |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Oh, and before I forget, I had another idea for a feature that I feel fits in nicely here: the ability to "navigate" to previously run pipelines. Much like ⬆️ and ⬇️ (or For instance: I have some JSON I'm forming a Rather than having to then navigate back through my pipeline with the cursor and manually deleting the bad part of the pipeline to get back to where I was, I could just hit ⬆️ (or Hope that makes sense? |
The idea for "history navigation" sounds interesting, and I feel like it could maybe actually kinda accidentally solve #4?... (!) Maybe the results from a few old runs could also be stored gzipped in memory?... just a random thought, not necessarily a good idea. (part of the comment was hidden)
Re: ctrlKey() vs key() I don't understand Re: killspace overwritten by insert() About Re: O(n^2) in yank Do you know the "big O" notation? That's the first question I need to ask, to know how to try answering you, as your "don't understand" here is very broad, so not sure what exactly you do vs. do not understand, sorry :) Trying to explain quickly:
Given that yank() calls insert() many1 times, then each insert() calls MOV many2 times, it means that in grand scheme of things, yank() will call MOV many1 * many2 times, a.k.a. many ^ 2 times, a.k.a. O(n^2), a.k.a. Shlemiel the Painter's Algorithm. We can do better here, there's no need to use the |
@cmacrae I didn't want to risk losing your contribution to neglect, so I took the liberty to merge your branch now, plus the tweaks/fixes I suggested. Sorry for not being more patient :D and thank you so much! ❤️ I've released a v0.3.2 with those improvements. Also, I will now hide some comments in the thread which I feel are not very important for the main discussion here. |
Thanks so much @akavel! I've been very busy over the last couple weeks, and a few busy weeks ahead of me. So I may be a bit quiet around this, but I hope to get some time over the holidays to tackle some of the points we've discussed 🤗 |
Has there been any update on this? Would really love readline movements like |
@dufferzafar Could you try and add a prioritized list of what specific readline commands are the ones you miss the most? There's a lot of them, some may be tricky, so I don't expect all of them will be ever added to up; if you could list the ones you'd love most, me or someone else would have a better idea of what to focus on when trying to help you! |
Okay, I'll keep commenting here as and when use For now, it's just |
Oh hey! That’s so strange, I was actually thinking about this just yesterday and recalling the other parts I wanted to implement! I’d love to get the stuff I mentioned above in early comments implemented, so I can perhaps take a look at getting all this rolling again 😊 |
@cmacrae ❤️ Just one thing to note: I started testing Ctrl-W in bash (I never used this shortcut before), and from what I see, it seems somewhat tricky. It would be awesome if you guys could try and collect a corpus of test cases, with expected input & output, to verify it does what we want... I wouldn't see much sense in adding a Ctrl-W that would work very differently than in bash/readline... it's very much OK if you just collect them and not write actual unit tests, I will then try to add the actual tests when merging. For example, assuming
Though if you wish to add actual tests code too, you're certainly more than welcome! :) you can take a look at the existing (single.... :/) test, for some inspiration, if you like! |
Hey @akavel! 👋 Yep, definitely agree it's important we accurately recreate any expected behaviour. I'll see what I can do in ways of testing/ensuring consistency. One thing that could work is using this lib: https://github.com/chzyer/readline |
Wow, integrating with full fledged Readline lib would be great! |
Agreed. I use readline vi mode so it's really jarring switching between vi keys in |
I also think that it should be possible to just integrate with the tested-and-true readline library. Another idea is to somehow integrate it with a running neovim (I think this too should be possible, but readline still seems the more promising approach to me.) |
Hilariously, this support is just good enough that I keep finding myself hitting |
@saulrh Hmmm; but where does the As for UP, given the above, I think the only reasonable way around this would be to allow full customization of keys in the app; but that's not something I would expect to do especially soon, seeing how I have something of a writer's block with regards to UP now, unfortunately 😢 That said, for your personal purposes, you should be fine with just downloading the source (no need to even git clone at this point, it's still a single Go file as of today!), removing the ~2 lines related to |
It's a thing that's common to readline and emacs, yeah. And agree, this would probably require either a) a real customization system or b) replacing the homegrown line-editor with a "real editor", something like
It would. Thanks for the suggestion! |
It would be great if up would support my Readline movement commands.
https://www.gnu.org/software/bash/manual/html_node/Bindable-Readline-Commands.html
Thanks.
The text was updated successfully, but these errors were encountered: