refterm icon indicating copy to clipboard operation
refterm copied to clipboard

Add rudimentary command-line history (up/down arrow)

Open cculianu opened this issue 2 years ago • 11 comments

This commit adds very rudimentary command-line history support. Use the up/down arrow to navigate the history.

This commit also adds an additional command, "history" to view the history.

cculianu avatar Jul 12 '21 22:07 cculianu

Isn't command-history a feature implemented by the shell and not the terminal?

jantari avatar Jul 16 '21 17:07 jantari

It is, but I believe the intent here was to avoid having to retype commands (when testing stuff in refterm)?

- Casey

cmuratori avatar Jul 16 '21 18:07 cmuratori

Yeah, you're both right. :) Ideally we'd have this refterm talking to a shell in the canonical way so that the shell itself does all this business (I am not even sure how to do that on Windows -- I'm more of a Unix guy as of late and forgot my windows incantations -- I'd need to brush up on them -- on Linux for instance you'd allocate a pty and give that to a persistent shell process and the shell would talk to the rendering windowing app via that).

This is just a quick feature to make it easier to use refterm right now as it stands -- until maybe refterm can be reconfigured/recoded to actually just use cmd.exe or bash.exe or whatever your favorite shell is as the real driver... and refterm maybe some day can just do rendering only.

cculianu avatar Jul 16 '21 21:07 cculianu

It would be fairly straightforward to reconfigure refterm that way, but unfortunately it would mean that you could no longer use it for performance testing, because you'd always be going through the slowest possible path (cmd.exe<-conhost<-test.exe). So I don't think it's feasible to do this, although it would be fine to make a #define that did this for people who want that (or a command you run, like "shell", that launches cmd.exe permanently inside refterm, etc.)

- Casey

cmuratori avatar Jul 16 '21 21:07 cmuratori

Sure. Up to you. I personally don't have a strong opinion either way. I think for what you wanted to accomplish -- which was demonstrate and benchmark the potential speed one can get with rendering itself -- this is fine as-is.

As for this particular PR: I just wanted to make what you have now here be slightly more ergonomic, is all. So that up/down arrow works and lets you scroll back through commands, etc.

My personal agenda here is thus: I actually have always wanted to write a better term program (in particular for windows -- I too share your frustration at the seemingly abysmal performance of current popular options). When I came across your videos that showed it's possible to have reasonably correct rendering at blazing speeds, I was inspired. So -- some day I plan on maybe taking some of the very fast (and correct!) rendering code you have developed here and folding it into a more full-featured term program (time permitting -- in the future). Hence my interest in your project....

cculianu avatar Jul 16 '21 23:07 cculianu

@cculianu may I suggest you have a look at the handterm project at https://github.com/jfhs/handterm? jfhs has already started some great work on completely removing the dependency on the conhost subsystem on Windows, and I'd like to help him integrate refterm's renderer so we have a great foundation for building a no-bullshit terminal for the community.

n00bmind avatar Jul 22 '21 11:07 n00bmind

Yes, putting resources behind handterm would be a very good idea. jfhs and I have talked separately about this and I do think that project is the current best bet for getting a full terminal for Windows that is performant.

- Casey

cmuratori avatar Jul 23 '21 04:07 cmuratori

@n00bmind @cmuratori thanks for the tip. When I get some free time I’ll check out that project. Sounds like a good plan to me.

cculianu avatar Jul 23 '21 08:07 cculianu

Seems like handterm died out as well, yet WT thrives. Which kinda indicate it isnt about performance but resources put behind the thing that make it feasible and relevant.

Kein avatar May 12 '22 21:05 Kein

Seems like handterm died out as well, yet WT thrives. Which kinda indicate it isnt about performance but resources put behind the thing that make it feasible and relevant.

A fast terminal would be preferred by many if it existed! It's just a lot of work to actually make something polished and nice to use and to keep maintaining it. WT is made by people paid by MS to do it so of course it will keep living, that has nothing to do with usability or technical merit. They are also very good at telling people about it. I don't think many people outside of the Handmade community even knows about refterm or any spinoffs. Marketing matters way more than quality if you want someone to actually use your thing. It sounds to me like you think these things are somehow connected but they are not. Quality is a separate thing from something existing and being used. But if all other things are equal, quality wins.

bagucode avatar May 13 '22 07:05 bagucode

Wasn't WT planning to include some of the performance enhancements from refterm anyway? I think I saw an issue made for that once. It has not landed yet, still as slow, but it will likely take some time to adjust their architecture to fit it in.

nikbackm avatar May 13 '22 08:05 nikbackm