Skip to content

Commit d585f73

Browse files
committed
Avoid using DECDMAC when macros aren't supported
Some terminals can end up echoing part of the sequence to the screen if they don't have macro support.
1 parent 298362c commit d585f73

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/macros.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ macro_manager::macro_manager(const capabilities& caps, const options& options)
2525
: _caps{caps}, _options{options}
2626
{
2727
// Clear existing macros first to make sure we have space.
28-
std::cout << "\033P0;1;0!z\033\\";
28+
if (_caps.has_macros)
29+
std::cout << "\033P0;1;0!z\033\\";
2930
const auto x_indent = std::max((caps.width - engine::width * 2) / 4, 0);
3031
const auto y_indent = std::max((caps.height - engine::height) / 2, 1);
3132
_init_scrollers(x_indent, y_indent);
@@ -41,7 +42,8 @@ macro_manager::macro_manager(const capabilities& caps, const options& options)
4142
macro_manager::~macro_manager()
4243
{
4344
// Clean out our macros on exit.
44-
std::cout << "\033P0;1;0!z\033\\";
45+
if (_caps.has_macros)
46+
std::cout << "\033P0;1;0!z\033\\";
4547
}
4648

4749
macro macro_manager::create(std::function<void(builder&)> callback)

0 commit comments

Comments
 (0)