cantino / mcfly

Fly through your shell history. Great Scott!
MIT License
6.85k stars 178 forks source link

Show last run time for each command #149

Closed dmfay closed 3 years ago

dmfay commented 3 years ago

1621797105

with thanks to atuin for the idea of showing timing!

cantino commented 3 years ago

Could we make it use less space by just showing 5d or 30m or 10s. I don't think 30m 10s adds much?

dmfay commented 3 years ago

I've liked having days-hours and hours-minutes resolution in my test-driving so far, so I may have sold it a bit short with the recent git commands. That said, other scales are definitely not as useful, so that specific band really has to be worth the four characters. Try it out for a day or three and see what you think, maybe?

cantino commented 3 years ago

I've liked having days-hours and hours-minutes resolution in my test-driving so far, so I may have sold it a bit short with the recent git commands. That said, other scales are definitely not as useful, so that specific band really has to be worth the four characters. Try it out for a day or three and see what you think, maybe?

Ok!

cantino commented 3 years ago

I don't mind the two part dates, but I am finding it a bit hard to parse when I skim the list. I wonder if we should make it a lighter color (on dark backgrounds) and put it flush to the right?

dmfay commented 3 years ago

here's a version with timings on the right. The FixedLengthGraphemeString looks like it only checks on input and returns whatever the internal string has accumulated (even if shorter), though, and I'm not quite sure what to do about that. We have width but do we have the current cursor x somewhere?

cantino commented 3 years ago

I'm not 100% sure what you're asking. If you need to know if the line is currently selected in truncate_for_display, you could pass in index == self.selection to it. Is that what you're asking? All FixedLengthGraphemeString does is ensure that you cannot add more than N unicode characters to the string.

Do you like how it looks if you put

write!(screen, "{}", cursor::Goto(width - 9, index as u16 + RESULTS_TOP_INDEX)).unwrap();

on line 248?

dmfay commented 3 years ago

I was trying to fill the remaining width between command text and timing info with spaces and not having much luck. cursor::Goto does the trick, thanks!

cantino commented 3 years ago

Thanks @dmfay, this is a nice addition :)