Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 21012d245357481f6a9ba62e5a817bc9e24fe532cea3ccec9f81143f0778a3d8
Ticket: 1d0618000674abdf701021d69eaa858cbccf14a4
channel reads prematurely from stdin on Windows
User & Date: anonymous on 2025-11-13 08:29:57
Changes

  1. icomment:
    Thank you for your patch.
    
    First I tested if the program reads character-by-character input
    correctly by adding
    
        HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
        DWORD mode;
        GetConsoleMode(hStdin, &mode);
        SetConsoleMode(hStdin, mode & ~ENABLE_LINE_INPUT);
    
    to the test program. It works correctly, generating one callback for
    every character separately. However, pressing e.g. the ALT key also
    generates a callback, and then the read function will block.
    
    If I don't change the mode and keep ENABLE_LINE_INPUT to read line-by-line,
    then the callback function is already called after typing the first character,
    and the read function will block.
    
    For the purpose of tkinter, it is actually sufficient if we can read
    character-by-character correctly. It would be great if reading
    character-by-character can be fixed in Tcl 9. Python currently still uses
    Tcl 8.6, but the Python developers also seem eager to move to Tcl 9, so I
    assume we don't need to worry about Tcl 8.6.
    
  2. login: "anonymous"
  3. mimetype: "text/x-markdown"
  4. username: "mdehoon"