1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

using bottom line for status bar

Discussion in 'Support' started by thorsten, Jan 3, 2015.

  1. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    124
    Likes Received:
    0
    Hi,

    I'd like to implement a simple kind of status bar in the bottom line of the console window (using pre_input and scrput). Is there a way to tell TCC not to display the prompt on the last line? (because it overwrites the status bar)
     
  2. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,935
    Likes Received:
    30
    I don't think there's a built-it way (I hope I'm wrong). I simply don't like the prompt on the last line. I did it in my 4CONSOLE plugin a while back but removed it because I didn't want to force it on all users of 4CONSOLE.

    I think this is what I did, in a plugin keystroke handler
    Code:
    if ( csbi.dwCursorPosition.Y == csbi.srWindow.Bottom || (csbi.dwCursorPosition.Y == csbi.srWindow.Bottom-1 && csbi.dwCursorPosition.X == csbi.dwSize.X-1 ))
       SendMessage(g.hWndConsole, WM_VSCROLL, MAKEWPARAM(SB_LINEDOWN, 0), NULL);
    But I must wonder ... What happens if the status bar is on the last line, the prompt is on the next-to-last line, and you type a command longer than one line? Without some intervention I'd expect the command to overwrite the status line.
     
  3. K_Meinhard

    Joined:
    May 20, 2008
    Messages:
    310
    Likes Received:
    0
    Hi Thorsten,

    it would be easier IMHO to display your status info at the top of the console and nail the input line to or near the bottom. In 4DOS times there were very elaborate ANSI prompt sequences to do just that.

    The advantage is that you will find your input line always at the same position, you can use CLS to paint the whole console the color you like, you'll see the input and output of preceding commands, you won't overwrite your status line (though it may scroll off for very long inputs).
     
  4. thorsten

    Joined:
    Aug 16, 2008
    Messages:
    124
    Likes Received:
    0
    You convinced me: I switched from bottom to top. The "status bar" (not real one as it is only updated when executing a command) is finished now (at least for the moment). The code is not exactly pretty but maintainable. Attached the tmux original and my attempt to recreate that in TCC.

    The "styling" of the status bar items (CapacityUnitPercentage%) is taken from Byobu (which is a kind of pre-configured Tmux). Thanks to everyone who helped!!

    tcc status bar.png Zsh in tmux status bar.png
     

    Attached Files:

Share This Page