Skip to content

Commit

Permalink
Flush Warp OSC.
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishekp106 committed Jun 4, 2024
1 parent ece0c04 commit 7a7fbe1
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 0 deletions.
92 changes: 92 additions & 0 deletions osc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
diff --git a/src/terminal/adapter/ITermDispatch.hpp b/src/terminal/adapter/ITermDispatch.hpp
index e39769964..d59d7ef33 100644
--- a/src/terminal/adapter/ITermDispatch.hpp
+++ b/src/terminal/adapter/ITermDispatch.hpp
@@ -147,6 +147,8 @@ public:

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

+ virtual bool DoWarpAction(const std::wstring_view string) = 0;
+
virtual StringHandler DownloadDRCS(const VTInt fontNumber,
const VTParameter startChar,
const DispatchTypes::DrcsEraseControl eraseControl,
diff --git a/src/terminal/adapter/adaptDispatch.cpp b/src/terminal/adapter/adaptDispatch.cpp
index 4135cac88..d50daef0b 100644
--- a/src/terminal/adapter/adaptDispatch.cpp
+++ b/src/terminal/adapter/adaptDispatch.cpp
@@ -3746,6 +3746,20 @@ bool AdaptDispatch::DoConEmuAction(const std::wstring_view string)
return false;
}

+// Method Description:
+// - Performs a Warp Action
+// -
+bool AdaptDispatch::DoWarpAction(const std::wstring_view)
+{
+ const auto isConPty = _api.IsConsolePty();
+ if (isConPty) {
+ // Flush the frame manually, to make sure marks end up on the right
+ // line, like the alt buffer sequence.
+ _renderer.TriggerFlush(false);
+ }
+ return false;
+}
+
// Method Description:
// - Performs a iTerm2 action
// - Ascribes to the ITermDispatch interface
diff --git a/src/terminal/adapter/adaptDispatch.hpp b/src/terminal/adapter/adaptDispatch.hpp
index dbea2fcd8..2623120cf 100644
--- a/src/terminal/adapter/adaptDispatch.hpp
+++ b/src/terminal/adapter/adaptDispatch.hpp
@@ -150,6 +150,8 @@ namespace Microsoft::Console::VirtualTerminal

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

+ bool DoWarpAction(const std::wstring_view string) override;
+
StringHandler DownloadDRCS(const VTInt fontNumber,
const VTParameter startChar,
const DispatchTypes::DrcsEraseControl eraseControl,
diff --git a/src/terminal/adapter/termDispatch.hpp b/src/terminal/adapter/termDispatch.hpp
index 3a1d19a09..77ef073da 100644
--- a/src/terminal/adapter/termDispatch.hpp
+++ b/src/terminal/adapter/termDispatch.hpp
@@ -140,6 +140,8 @@ public:

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

+ bool DoWarpAction(const std::wstring_view /*string*/) override { return false; }
+
StringHandler DownloadDRCS(const VTInt /*fontNumber*/,
const VTParameter /*startChar*/,
const DispatchTypes::DrcsEraseControl /*eraseControl*/,
diff --git a/src/terminal/parser/OutputStateMachineEngine.cpp b/src/terminal/parser/OutputStateMachineEngine.cpp
index 7568f1546..5bdce5ad7 100644
--- a/src/terminal/parser/OutputStateMachineEngine.cpp
+++ b/src/terminal/parser/OutputStateMachineEngine.cpp
@@ -913,6 +913,11 @@ bool OutputStateMachineEngine::ActionOscDispatch(const size_t parameter, const s
success = _dispatch->DoVsCodeAction(string);
break;
}
+ case OscActionCodes::WarpAction:
+ {
+ success = _dispatch->DoWarpAction(string);
+ break;
+ }
default:
// If no functions to call, overall dispatch was a failure.
success = false;
diff --git a/src/terminal/parser/OutputStateMachineEngine.hpp b/src/terminal/parser/OutputStateMachineEngine.hpp
index 0970e45de..c2658e709 100644
--- a/src/terminal/parser/OutputStateMachineEngine.hpp
+++ b/src/terminal/parser/OutputStateMachineEngine.hpp
@@ -229,6 +229,7 @@ namespace Microsoft::Console::VirtualTerminal
FinalTermAction = 133,
VsCodeAction = 633,
ITerm2Action = 1337,
+ WarpAction = 9278,
};

bool _GetOscSetColorTable(const std::wstring_view string,
2 changes: 2 additions & 0 deletions src/terminal/adapter/ITermDispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ class Microsoft::Console::VirtualTerminal::ITermDispatch

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

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

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

// Method Description:
// - Performs a Warp Action
// -
bool AdaptDispatch::DoWarpAction(const std::wstring_view)
{
const auto isConPty = _api.IsConsolePty();
if (isConPty) {
// Flush the frame manually, to make sure marks end up on the right
// line, like the alt buffer sequence.
_renderer.TriggerFlush(false);
}
return false;
}

// Method Description:
// - Performs a iTerm2 action
// - Ascribes to the ITermDispatch interface
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 @@ -150,6 +150,8 @@ namespace Microsoft::Console::VirtualTerminal

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

bool DoWarpAction(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 @@ -140,6 +140,8 @@ class Microsoft::Console::VirtualTerminal::TermDispatch : public Microsoft::Cons

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

bool DoWarpAction(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 @@ -913,6 +913,11 @@ bool OutputStateMachineEngine::ActionOscDispatch(const size_t parameter, const s
success = _dispatch->DoVsCodeAction(string);
break;
}
case OscActionCodes::WarpAction:
{
success = _dispatch->DoWarpAction(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 @@ -229,6 +229,7 @@ namespace Microsoft::Console::VirtualTerminal
FinalTermAction = 133,
VsCodeAction = 633,
ITerm2Action = 1337,
WarpAction = 9278,
};

bool _GetOscSetColorTable(const std::wstring_view string,
Expand Down

0 comments on commit 7a7fbe1

Please sign in to comment.