|
21 | 21 | #include "lldb/Host/MainLoopBase.h" |
22 | 22 | #include "lldb/Host/MemoryMonitor.h" |
23 | 23 | #include "lldb/Host/Socket.h" |
| 24 | +#include "lldb/Utility/AnsiTerminal.h" |
24 | 25 | #include "lldb/Utility/Status.h" |
25 | 26 | #include "lldb/Utility/UriParser.h" |
26 | 27 | #include "lldb/lldb-forward.h" |
@@ -122,15 +123,6 @@ class LLDBDAPOptTable : public llvm::opt::GenericOptTable { |
122 | 123 | }; |
123 | 124 | } // anonymous namespace |
124 | 125 |
|
125 | | -#define ESCAPE "\x1b" |
126 | | -#define CSI ESCAPE "[" |
127 | | -// Move the cursor to 0,0 |
128 | | -#define ANSI_CURSOR_HOME CSI "H" |
129 | | -// Clear the screen buffer |
130 | | -#define ANSI_ERASE_SCREEN CSI "2J" |
131 | | -// Clear the scroll back buffer |
132 | | -#define ANSI_ERASE_SCROLLBACK CSI "3J" |
133 | | - |
134 | 126 | static void PrintHelp(LLDBDAPOptTable &table, llvm::StringRef tool_name) { |
135 | 127 | std::string usage_str = tool_name.str() + " options"; |
136 | 128 | table.printHelp(llvm::outs(), usage_str.c_str(), "LLDB DAP", false); |
@@ -274,7 +266,8 @@ static llvm::Error LaunchRunInTerminalTarget(llvm::opt::Arg &target_arg, |
274 | 266 | } else if ((isatty(STDIN_FILENO) != 0) && |
275 | 267 | llvm::StringRef(getenv("TERM")).starts_with_insensitive("xterm")) { |
276 | 268 | // Clear the screen. |
277 | | - llvm::outs() << ANSI_CURSOR_HOME ANSI_ERASE_SCREEN ANSI_ERASE_SCROLLBACK; |
| 269 | + llvm::outs() << ANSI_CSI_RESET_CURSOR ANSI_CSI_ERASE_VIEWPORT |
| 270 | + ANSI_CSI_ERASE_SCROLLBACK; |
278 | 271 | // VSCode will reuse the same terminal for the same debug configuration |
279 | 272 | // between runs. Clear the input buffer prior to starting the new process so |
280 | 273 | // prior input is not carried forward to the new debug session. |
|
0 commit comments