Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the FTCS_PROMPT sequence for marking the start of the prompt #13163

Merged
41 commits merged into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
88ff59f
better align overlay, transparent to clicks now
zadjii-msft Mar 22, 2022
18ddace
the start of a bunch of actions
zadjii-msft Mar 22, 2022
be83255
Plumb more actions through
zadjii-msft Mar 23, 2022
66a5d9e
Auto prompt detection on enter
zadjii-msft Mar 23, 2022
928002b
setting to enable scrollbar marks
zadjii-msft Mar 24, 2022
036ebb1
Be able to mark a selection via the action, because that's handy!
zadjii-msft Mar 24, 2022
958dfa3
howd i miuss this
zadjii-msft Apr 19, 2022
fb0bc53
plumb iterm2 marks thru to the control, draw on scrollbar
zadjii-msft Mar 22, 2022
b7a8445
let the user overscroll marks to the start/end
zadjii-msft Apr 20, 2022
df00505
clearing a selection of marks is important too
zadjii-msft Apr 20, 2022
0fa5765
some cleanup
zadjii-msft Apr 20, 2022
a9a8ef9
allow for optional colors
zadjii-msft Apr 20, 2022
3aad0f5
flush that too
zadjii-msft Apr 20, 2022
1a27350
Merge remote-tracking branch 'origin/main' into dev/migrie/f/1527-exp…
zadjii-msft Apr 20, 2022
9e2eb1a
Allow the settings to set marks with an optional color
zadjii-msft Apr 20, 2022
6df37bf
format ; spell
zadjii-msft Apr 20, 2022
00d9408
Merge commit 'eb5c26c' into dev/migrie/f/1527-experimental-marks
zadjii-msft May 5, 2022
f6c8cd7
Merge remote-tracking branch 'origin/main' into dev/migrie/f/1527-exp…
zadjii-msft May 5, 2022
2f08c35
Merge remote-tracking branch 'origin/main' into dev/migrie/f/1527-exp…
zadjii-msft May 24, 2022
39a08ed
classic
zadjii-msft May 24, 2022
d00aadd
some rather simple misses, that I guess are only in Release & audit
zadjii-msft May 24, 2022
1090b88
Cat walking over the keyboard
zadjii-msft May 24, 2022
1315f5e
this is the easy way of implementing this
zadjii-msft May 24, 2022
dbae32a
comments
zadjii-msft May 24, 2022
ff512ca
derp
zadjii-msft May 24, 2022
1ed81dc
there's gonna be a lot of this
zadjii-msft May 24, 2022
b441891
make audit happy, I think
zadjii-msft May 26, 2022
02132b8
this makes audit happy, but the interactivity tests are... flaky... i…
zadjii-msft May 26, 2022
a2a3771
this makes a lot more sense now doesn't it
zadjii-msft May 27, 2022
0ece836
this too
zadjii-msft May 27, 2022
b989d00
this fixes the tests, but I don't think I need the test delta
zadjii-msft May 27, 2022
be6616f
That's right, I didn't
zadjii-msft May 27, 2022
be59a71
put behind velocity, fix alt buffer
zadjii-msft Jun 7, 2022
8cb9ae2
loc comments too
zadjii-msft Jun 7, 2022
994e5d4
Merge remote-tracking branch 'origin/main' into dev/migrie/f/1527-exp…
zadjii-msft Jun 7, 2022
25dea23
Merge remote-tracking branch 'origin/main' into dev/migrie/f/1527-exp…
zadjii-msft Jun 9, 2022
7bfdc9d
its happening
zadjii-msft Jun 9, 2022
7eca448
Merge branch 'dev/migrie/f/1527-experimental-marks' into dev/migrie/f…
zadjii-msft Jun 9, 2022
83c71be
add velocity here too
zadjii-msft Jun 9, 2022
bd8cff6
Merge remote-tracking branch 'origin/main' into dev/migrie/f/11000-FT…
zadjii-msft Jun 9, 2022
8045832
forgot one part
zadjii-msft Jun 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/spelling/allow/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ EDDC
Enum'd
Fitt
formattings
FTCS
ftp
fvar
gcc
Expand Down
2 changes: 2 additions & 0 deletions src/terminal/adapter/ITermDispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ class Microsoft::Console::VirtualTerminal::ITermDispatch

virtual bool DoITerm2Action(const std::wstring_view string) = 0;

virtual bool DoFinalTermAction(const std::wstring_view string) = 0;

virtual StringHandler DownloadDRCS(const VTInt fontNumber,
const VTParameter startChar,
const DispatchTypes::DrcsEraseControl eraseControl,
Expand Down
50 changes: 50 additions & 0 deletions src/terminal/adapter/adaptDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2509,6 +2509,56 @@ bool AdaptDispatch::DoITerm2Action(const std::wstring_view string)
return false;
}

// Method Description:
// - Performs a FinalTerm action
// - Currently, the actions we support are:
// * `OSC133;A`: mark a line as a prompt line
// - Not actually used in conhost
// - The remainder of the FTCS prompt sequences are tracked in GH#11000
// Arguments:
// - string: contains the parameters that define which action we do
// Return Value:
// - false in conhost, true for the SetMark action, otherwise false.
bool AdaptDispatch::DoFinalTermAction(const std::wstring_view string)
{
// This is not implemented in conhost.
if (_api.IsConsolePty())
{
// Flush the frame manually, to make sure marks end up on the right line, like the alt buffer sequence.
_renderer.TriggerFlush(false);
return false;
}

if constexpr (!Feature_ScrollbarMarks::IsEnabled())
{
return false;
}

const auto parts = Utils::SplitString(string, L';');

if (parts.size() < 1)
{
return false;
}

const auto action = til::at(parts, 0);

if (action == L"A") // FTCS_PROMPT
{
// Simply just mark this line as a prompt line.
DispatchTypes::ScrollMark mark;
mark.category = DispatchTypes::MarkCategory::Prompt;
_api.AddMark(mark);
return true;
}

// When we add the rest of the FTCS sequences (GH#11000), we should add a
// simple state machine here to track the most recently emitted mark from
// this set of sequences, and which sequence was emitted last, so we can
// modify the state of that mark as we go.
return false;
}

// Method Description:
// - DECDLD - Downloads one or more characters of a dynamically redefinable
// character set (DRCS) with a specified pixel pattern. The pixel array is
Expand Down
2 changes: 2 additions & 0 deletions src/terminal/adapter/adaptDispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ namespace Microsoft::Console::VirtualTerminal

bool DoITerm2Action(const std::wstring_view string) override;

bool DoFinalTermAction(const std::wstring_view string) override;

StringHandler DownloadDRCS(const VTInt fontNumber,
const VTParameter startChar,
const DispatchTypes::DrcsEraseControl eraseControl,
Expand Down
2 changes: 2 additions & 0 deletions src/terminal/adapter/termDispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ class Microsoft::Console::VirtualTerminal::TermDispatch : public Microsoft::Cons

bool DoITerm2Action(const std::wstring_view /*string*/) override { return false; }

bool DoFinalTermAction(const std::wstring_view /*string*/) override { return false; }

StringHandler DownloadDRCS(const VTInt /*fontNumber*/,
const VTParameter /*startChar*/,
const DispatchTypes::DrcsEraseControl /*eraseControl*/,
Expand Down
5 changes: 5 additions & 0 deletions src/terminal/parser/OutputStateMachineEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,11 @@ bool OutputStateMachineEngine::ActionOscDispatch(const wchar_t /*wch*/,
success = _dispatch->DoITerm2Action(string);
break;
}
case OscActionCodes::FinalTermAction:
{
success = _dispatch->DoFinalTermAction(string);
break;
}
default:
// If no functions to call, overall dispatch was a failure.
success = false;
Expand Down
1 change: 1 addition & 0 deletions src/terminal/parser/OutputStateMachineEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ namespace Microsoft::Console::VirtualTerminal
ResetForegroundColor = 110, // Not implemented
ResetBackgroundColor = 111, // Not implemented
ResetCursorColor = 112,
FinalTermAction = 133,
ITerm2Action = 1337,
};

Expand Down