Skip to content

Commit

Permalink
Do not emit control characters in title reports
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kemp <[email protected]>
Co-authored-by: David Leadbeater <[email protected]>
  • Loading branch information
2 people authored and Maximus5 committed Jul 23, 2023
1 parent a5620b3 commit 03c48ab
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ConEmuCD/ConAnsiImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ bool SrvAnsiImpl::ReportString(LPCWSTR asRet)
LPCWSTR pc = asRet;
for (int i = 0; i < nLen; i++, p++, pc++)
{
const char ch = (wcschr(UNSAFE_CONSOLE_REPORT_CHARS, *pc) == nullptr) ? *pc : L' ';
const char ch = *pc >= 0x20 ? *pc : L' ';
p->EventType = KEY_EVENT;
p->Event.KeyEvent.bKeyDown = TRUE;
p->Event.KeyEvent.wRepeatCount = 1;
Expand Down
2 changes: 1 addition & 1 deletion src/ConEmuHk/Ansi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2505,7 +2505,7 @@ BOOL CEAnsi::ReportString(LPCWSTR asRet)
LPCWSTR pc = asRet;
for (size_t i = 0; i < nLen; i++, p++, pc++)
{
const char ch = (wcschr(UNSAFE_CONSOLE_REPORT_CHARS, *pc) == nullptr) ? *pc : L' ';
const char ch = *pc >= 0x20 ? *pc : L' ';
p->EventType = KEY_EVENT;
p->Event.KeyEvent.bKeyDown = TRUE;
p->Event.KeyEvent.wRepeatCount = 1;
Expand Down
3 changes: 0 additions & 3 deletions src/common/WConsole.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define DISABLE_NEWLINE_AUTO_RETURN 0x0008
#endif

// These keys should not be reported back to console input
#define UNSAFE_CONSOLE_REPORT_CHARS L"\r\n\t"

struct MY_CONSOLE_SCREEN_BUFFER_INFOEX
{
ULONG cbSize;
Expand Down

0 comments on commit 03c48ab

Please sign in to comment.