Skip to content

Commit

Permalink
Don't end the current mark, if we get one of the same kind (#16107)
Browse files Browse the repository at this point in the history
If you're already in the "output" state, then an app requesting an
"output" mark probably shouldn't end the current mark and start a new
one. It should just keep on keepin' on.

The decision to end the previous one was arbitrary in the first place,
so let's arbitrarily change it back.

Especially noticable if you hit <kbd>Enter</kbd> during a command,
because the auto-mark prompt work will do a CommandEnd, so long-running
commands will get broken into multiple marks 🥲

(cherry picked from commit 0144cdd)
Service-Card-Id: 91707294
Service-Version: 1.19
  • Loading branch information
zadjii-msft authored and DHowett committed Jan 29, 2024
1 parent 5575187 commit 9c10575
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/cascadia/TerminalCore/TerminalApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,13 @@ void Terminal::MarkCommandStart()
//
//We can just do the work below safely.
}
else if (_currentPromptState == PromptState::Command)
{
// We're already in the command state. We don't want to end the current
// mark. We don't want to make a new one. We want to just leave the
// current command going.
return;
}
else
{
// If there was no last mark, or we're in a weird state,
Expand Down Expand Up @@ -369,6 +376,13 @@ void Terminal::MarkOutputStart()
//
//We can just do the work below safely.
}
else if (_currentPromptState == PromptState::Output)
{
// We're already in the output state. We don't want to end the current
// mark. We don't want to make a new one. We want to just leave the
// current output going.
return;
}
else
{
// If there was no last mark, or we're in a weird state,
Expand Down

0 comments on commit 9c10575

Please sign in to comment.