Summary
When using the ted example app, indenting a line with Tab, then unindenting with Shift+Tab, can leave the next Tab keypress ignored. The following Tab keypress then indents the line normally.
Repro
- create a line of text: hello world
- position cursor at start of line
- press tab; line indents correctly
- press shift+tab; line unindents correctly
- press tab; line does not indent
- press tab a second time; line indents correctly
Expected
The first Tab after Shift+Tab should indent the line immediately.
Actual
The first Tab after Shift+Tab is swallowed, and only the second Tab indents the line.
Notes
- This has been observed in the
examples\ted app.
- I added candidate repro tests that should fail if the bug were reproduced in the current test harness, but both pass:
[Fact]
public async Task Tab_After_ShiftTab_Reindents_Line_On_First_Keypress ()
{
await using AppFixture<EditorTestHost> fx = new (() => new ("hello world"));
fx.Top.Editor.SetFocus ();
fx.Top.Editor.CaretOffset = 0;
fx.Injector.InjectKey (Key.Tab, Direct);
Assert.Equal ("\thello world", fx.Top.Editor.Document!.Text);
Assert.Equal (1, fx.Top.Editor.CaretOffset);
fx.Injector.InjectKey (Key.Tab.WithShift, Direct);
Assert.Equal ("hello world", fx.Top.Editor.Document.Text);
Assert.Equal (0, fx.Top.Editor.CaretOffset);
fx.Injector.InjectKey (Key.Tab, Direct);
Assert.Equal ("\thello world", fx.Top.Editor.Document.Text);
Assert.Equal (1, fx.Top.Editor.CaretOffset);
}
[Fact]
public async Task Editor_Tab_After_ShiftTab_Reindents_On_First_Keypress ()
{
await using AppFixture<TedApp> fx = new (() => new TedApp ());
InputInjectionOptions options = new ();
fx.Top.Editor.SetFocus ();
fx.Top.Editor.Document!.Text = "hello world";
fx.Top.Editor.CaretOffset = 0;
fx.Injector.InjectKey (Key.Tab, options);
Assert.Equal (" hello world", fx.Top.Editor.Document.Text);
Assert.Equal (4, fx.Top.Editor.CaretOffset);
fx.Injector.InjectKey (Key.Tab.WithShift, options);
Assert.Equal ("hello world", fx.Top.Editor.Document.Text);
Assert.Equal (0, fx.Top.Editor.CaretOffset);
fx.Injector.InjectKey (Key.Tab, options);
Assert.Equal (" hello world", fx.Top.Editor.Document.Text);
Assert.Equal (4, fx.Top.Editor.CaretOffset);
}
- The
Editor-only integration repro passes under direct ANSI test input.
- The
TedApp integration repro also passes under the current harness, including the non-Direct default input injection path.
Summary
When using the
tedexample app, indenting a line withTab, then unindenting withShift+Tab, can leave the nextTabkeypress ignored. The followingTabkeypress then indents the line normally.Repro
Expected
The first
TabafterShift+Tabshould indent the line immediately.Actual
The first
TabafterShift+Tabis swallowed, and only the secondTabindents the line.Notes
examples\tedapp.Editor-only integration repro passes under direct ANSI test input.TedAppintegration repro also passes under the current harness, including the non-Directdefault input injection path.