terminal icon indicating copy to clipboard operation
terminal copied to clipboard

doskey macros broken for inputs with >1 consecutive whitespace

Open lhecker opened this issue 2 years ago • 3 comments
trafficstars

Steps to reproduce

Run this:

doskey foo=echo start $3 $2 $1 end
foo a b c
foo a  b c

Expected Behavior

start c b a end
start c b a end

Actual Behavior

start c b a end
start b  a end

The issue is caused by this function: https://github.com/microsoft/terminal/blob/42e9ddcc78710c101315a58b87c1c9db893fe3a7/src/host/alias.cpp#L833-L861

For an input like "a b c" it'll return

"a"
""
"b"
"c"

The issue can either be fixed by fixing s_Tokenize itself or by reverting the code to the previous conhost v1 code. Either would likely be fine.

lhecker avatar Jul 20 '23 20:07 lhecker

In conhost the same behavior

237dmitry avatar Jul 21 '23 06:07 237dmitry

For sure! The bug was introduced in 2018. 🙂

lhecker avatar Jul 21 '23 10:07 lhecker

Note to self: not fixed in #15783

zadjii-msft avatar Aug 17 '23 21:08 zadjii-msft