← Back to wkappbot-core
wkappbot-core ★★☆

ConPTY Enter-intercept two-phase decide-then-commit

PseudoConsoleRunner's Enter handler uses Func string Action? as a two-phase gate. Interceptor returns null for passthrough (cmd.exe runs the typed line normally so dir etc. keep working) or an Action to commit. Only on non-null does the runner send ESC (clears child line buffer AND visually erases typed text) then sleep 30ms (let VT erase bytes reach terminal before dispatch output) then invoke Action then send CR (child emits fresh prompt). Previous eager-ESC design erased the buffer before the decision and dropped every non-intercepted command.

user/developer
chatconptyinteractivewindows

Steps

  1. Printable keys append to buffer + forward to...
  2. Arrow Home End Tab Delete set complexEdit =...
  3. Enter calls interceptor with buffer
  4. null result = pass Enter through normally
  5. Non-null Action = ESC + Thread.Sleep 30ms +...
  6. backspace-backspace in the echo overwrites p...