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

Pipes make the cursor visible

Discussion in 'Support' started by vefatica, Mar 8, 2011.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,784
    Likes Received:
    29
    I often turn off the cursor (CURSOR plugin) in long-running BTMs designed to monitor a process. I noticed recently that a pipe instance will cause the cursor to become visible again.

    With "cursor 0 & echo foo & delay 5" the cursor remains off until the prompt returns.

    With "cursor 0 & echo foo | tee nul & delay 5" the cursor is visible during the delay (even with "if %_pipe == 1 cursor 0" in my tcstart.btm).

    With "cursor 0 & echo foo | (cursor 0 & tee nul) & delay 5" the cursor remains off.

    So it seems that somewhere after tcstart.btm, TCC does something to turn the cursor on.

    Could you change that behavior so the cursor will stay off when the user wants it off. I can think of no reason to have it on in a pipe instance.
     
  2. WavSlave

    Joined:
    May 29, 2008
    Messages:
    47
    Likes Received:
    0
    On 2011-03-08 19:28, vefatica wrote:

    So it seems that somewhere after tcstart.btm, TCC does something to turn the cursor on.



    My guess would be that it's the result of the CursorIns and
    CursorOver directives in the .ini file, which will take effect
    regardless of whether you execute TCStart.btm. I bet with a little
    creativity you could find some way to have the session on the right
    side of the pipe execute a SETDOS /S0:0 command.


    -- Dan McMullin
     
  3. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    ---- Original Message ----
    From: WavSlave
    To: ESFabian@zenge.org
    Sent: Wednesday, 2011. March 9. 00:31
    Subject: RE: [Support-t-2660] Pipes make the cursor visible

    | On 2011-03-08 19:28, vefatica wrote:
    |
    | So it seems that somewhere after tcstart.btm, TCC does something to
    | turn the cursor on.
    |
    |
    |
    | My guess would be that it's the result of the CursorIns and
    | CursorOver directives in the .ini file, which will take effect
    | regardless of whether you execute TCStart.btm. I bet with a little
    | creativity you could find some way to have the session on the right
    | side of the pipe execute a SETDOS /S0:0 command.
    |

    Thats 'easy. In TCSTART.BTM:

    if %_pipe EQ 1 setdos /s0:0
    --
    Steve
     
  4. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,784
    Likes Received:
    29
    That doesn't work any better than "if %_pipe == 1 cursor 0".

    Code:
    v:\> type d:\TCbeta\tcstart.btm
    IF %_PIPE == 1 CURSOR 0
    if %_pipe EQ 1 setdos /s0:0
    IFF %_TRANSIENT == 1 .OR. %_PIPE == 1 THEN
            QUIT
    ELSE
            TITLE ` `[%_PID]  %_CWD
    ENDIFF
    ECHO.
    v:\> cursor 0 & echo foo & delay 5
    foo
    
    v:\> cursor 0 & echo foo | tee nul & delay 5
    foo
    Above, during the first delay I don't see the cursor; during the second I do see it. As I said, TCC seems to be doing something with the cursor ***AFTER*** TCSTART.

    Rex, please comment and address this issue.
     
  5. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,729
    Likes Received:
    80
    This will not be changed in this version. You can submit a feature request
    for the next major update.

    It will definitely NOT be the default behavior, as it would be very harmful
    in those cases where you *want* the cursor to appear in a pipe. (And there
    are obviously a lot more of those -- or it wouldn't have taken you 20 years
    to notice this!)
     
  6. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,784
    Likes Received:
    29
    On Fri, 11 Mar 2011 13:45:11 -0500, rconn <> wrote:

    |---Quote---
    |> Rex, please comment and address this issue.
    |---End Quote---
    |This will not be changed in this version. You can submit a feature request
    |for the next major update.
    |
    |It will definitely NOT be the default behavior, as it would be very harmful
    |in those cases where you *want* the cursor to appear in a pipe. (And there
    |are obviously a lot more of those -- or it wouldn't have taken you 20 years
    |to notice this!)

    I can't think of any scenario in which I'd **want** the cursor on in a pipe
    instance. Got an example? It would be more accurate to say than in 20 years,
    most of the time I didn't care.


    Why can't I overcome it in TCSTART? It would seem quite reasonable to respect
    the user's wishes as expressed in TCSTART. Could I do it from a plugin?

    It should be so simple ... I don't want to see the cursor while this BTM is
    running (period!).
     
  7. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,729
    Likes Received:
    80
    Anytime you're redirecting input to an interactive command. (Particularly an external app!)

    It can be reset in TCSTART, but you're probably then doing something to reset it again.

    The cursor shape (and visibility) is only set in four places: (1) after the .INI file has been processed; (2) in SETDOS /S; (3) when editing an input line, and (4) when processing a ^C or ^Break.

    You can make the cursor invisible by setting the size to -1 in the .INI.

    Of course.

    Are you trying to do this in a tab window or a console window?
     
  8. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,784
    Likes Received:
    29
    On Fri, 11 Mar 2011 14:29:30 -0500, rconn <> wrote:

    |---Quote (Originally by vefatica)---
    |I can't think of any scenario in which I'd **want** the cursor on in a pipe instance. Got an example?
    |---End Quote---
    |
    |Anytime you're redirecting input to an interactive command. (Particularly an external app!)

    Like what? I wouldn't miss the cursor in LIST or MORE.

    |---Quote---
    |Why can't I overcome it in TCSTART? It would seem quite reasonable to respect the user's wishes as expressed in TCSTART.
    |---End Quote---
    |
    |It can be reset in TCSTART, but you're probably then doing something to reset it again.

    Well here's my example again. CURSOR uses SetConsoleCursorInfo() to change
    CONSOLE_CURSOR_INFO::bVisible. Below, I don't see the cursor during the first
    DELAY and I do see it during the second DELAY. What am I doing to turn it on?

    Code:
    v:\> type d:\TCbeta\tcstart.btm
    IF %_PIPE == 1 CURSOR 0
    if %_pipe EQ 1 setdos /s0:0
    IFF %_TRANSIENT == 1 .OR. %_PIPE == 1 THEN
            QUIT
    ELSE
            TITLE ` `[%_PID]  %_CWD
    ENDIFF
    
    v:\> cursor 0 & echo foo & delay 5
    foo
    
    v:\> cursor 0 & echo foo | tee nul & delay 5
    foo
    |Are you trying to do this in a tab window or a console window?

    In a console.

    I see that pipe instances **do** (apparently) respect the SETDOS setting of the
    parent (but not one specified in TCSTART). With

    Code:
    setdos /s0:0 & echo foo | tee nul & delay 5
    I don't see the cursor during the DELAY. But it stays off and there's
    apparently no way to get it back without specifying new sizes (which must have
    been remembered earlier).

    Perhaps in a future version, SETDOS /S could have a new option that would simple
    make the cursor invisible/visible without changing its sizes.
     
  9. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    ---- Original Message ----
    From: vefatica
    | Perhaps in a future version, SETDOS /S could have a new option that
    | would simple
    | make the cursor invisible/visible without changing its sizes.

    Or simply a new CURSOR command with identical syntax to LOADBTM: ON, OFF, or no parameter (to display current state). It should have immediate effect.
    --
    Steve
     
  10. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,784
    Likes Received:
    29
    On Fri, 11 Mar 2011 15:45:05 -0500, Steve Fabian <> wrote:

    |---- Original Message ----
    |From: vefatica
    || Perhaps in a future version, SETDOS /S could have a new option that
    || would simple
    || make the cursor invisible/visible without changing its sizes.
    |
    |Or simply a new CURSOR command with identical syntax to LOADBTM: ON, OFF, or no parameter (to display current state). It should have immediate effect.

    Well, I could make my CURSOR plugin do that, but it's not respected in pipe
    instances. Whereas, apparently, the SETDOS settings of the parent **are**
    respected in pipe instances.

    What I like about toggling CONSOLE_CURSOR_INFO::bVisible is that it's reset (to
    visible) when the prompt returns (perfect for use in a BTM). But,
    unfortunately, a pipe instance sets it back to TRUE.

    Right now I'm writing an alternative CURSOR plugin ... one which uses SETDOS /S
    with either "0:0" (OFF) or the values returned by QueryOptionValue() (ON). I
    imagine it'll work, but after using it to make the cursor invisible, it won't
    automatically become visible when a BTM ends.
     
  11. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,177
    Likes Received:
    11
    Have you tried experimenting with the CursorIns
    and CursorOver directives in the INI file?

    -Scott

    vefatica <> wrote on 03/11/2011
    04:05:50 PM:


    in pipe

    **are**

    (ON). I

    it won't

     
  12. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,784
    Likes Received:
    29
    On Fri, 11 Mar 2011 16:28:26 -0500, samintz <> wrote:

    |Have you tried experimenting with the CursorIns
    |and CursorOver directives in the INI file?

    To what end?

    I generally want normal behavior (a visible cursor). I'd like to be able to
    make the cursor invisible/visible without messing with it's size and without
    anything that being undone while a batch file is running (pipe instances undo
    it). The only TCC-kosher inheritable way to hide the cursor is with "SETDOS
    /S0:0" and that changes the current values of CursorIns and CursorOver. That
    seems a bit archaic since Windows has for a long time allowed for making the
    cursor invisible/invisible without changing its sizes.
     
  13. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,784
    Likes Received:
    29
    ... my fault all along. :-(

    Although my TCSTART contained the likes of "CURSOR 0" and "SETDOS /S0:0" for pipe instances, the INI file in my beta directory had a different 4StartPath.

    Using the correct TCSTART, "IF %_PIPE == 1 CURSOR 0" keeps the cursor off in pipe instances.

    Rex, I'll let you know if I **ever** miss the cursor in a pipe instance.

    I still think it would be a good idea if a future version implemented an inheritable TURN_THE_CURSOR_OFF without changing its sizes
     

Share This Page