Hacker News new | past | comments | ask | show | jobs | submit login
Basta: Terminal status line in 153 lines of Bash (kylheku.com)
3 points by kazinator on Aug 27, 2023 | hide | past | favorite | 2 comments



Well done, so far.

When I try it, the clock sits in reverse-color at the start of the last line, followed by the hostname and directory. As it should.

I would like to use PS1='> '. Almost identical to your '$' prompt.

However on the $PS1 line, after the clock updates the cursor sits hard against the left margin, and not at the end of the newer truncated prompt. Looks like the clock-update should finish by rewriting the prompt also.

Note I call it the 'clock-update', but I'm not sure why the cursor suddenly slams back to the left margin after a time, 10-20 seconds or so. I initially thought it was the clock updating, and that may be so. It happens whether the cursor has reached that second-last line or is still halfway down the page.

     +---- prompt cursor here after clock-update
     |
     | +-- prompt cursor should be here
     | |
     V V
     > 
     08-27/18:06 m70t /home/jvs/dl/tmp/basta-master


It doesn't repro for me; if I change to PS1='> ', it's working as well as the usual PS1='\$ '.

The refresh logic saves the cursor position and then restores it, so even if you're in the middle of editing a long line, the clock can update, and the cursor doesn't appear to move.

Are you seeing this 100% of the time? Like on every stroke of the 15 second timer?

I've not tested with a lot of terminal emulators; I'm using PuTTY and Gnome Terminal. Currently testing with xterm and rxvt; looks fine.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: