From d585f732bb9f439dceda72688fabaad3aca9c0f7 Mon Sep 17 00:00:00 2001 From: James Holderness Date: Thu, 21 Mar 2024 16:30:41 +0000 Subject: [PATCH] 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. --- src/macros.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/macros.cpp b/src/macros.cpp index ebe8ca2..bbb9ddb 100644 --- a/src/macros.cpp +++ b/src/macros.cpp @@ -25,7 +25,8 @@ macro_manager::macro_manager(const capabilities& caps, const options& options) : _caps{caps}, _options{options} { // Clear existing macros first to make sure we have space. - std::cout << "\033P0;1;0!z\033\\"; + if (_caps.has_macros) + std::cout << "\033P0;1;0!z\033\\"; const auto x_indent = std::max((caps.width - engine::width * 2) / 4, 0); const auto y_indent = std::max((caps.height - engine::height) / 2, 1); _init_scrollers(x_indent, y_indent); @@ -41,7 +42,8 @@ macro_manager::macro_manager(const capabilities& caps, const options& options) macro_manager::~macro_manager() { // Clean out our macros on exit. - std::cout << "\033P0;1;0!z\033\\"; + if (_caps.has_macros) + std::cout << "\033P0;1;0!z\033\\"; } macro macro_manager::create(std::function callback)