From 81a63dba1c2f3dffeb196dbeb1104139e6ab86ee Mon Sep 17 00:00:00 2001 From: Blu3train Date: Thu, 17 Nov 2022 19:29:20 +0100 Subject: [PATCH] Flush Delay String Spacing option --- GUI/mainwindow.cpp | 3 +++ host/textthread.cpp | 1 + host/textthread.h | 1 + text.cpp | 2 ++ 4 files changed, 7 insertions(+) diff --git a/GUI/mainwindow.cpp b/GUI/mainwindow.cpp index d95af3c..e8d1f42 100644 --- a/GUI/mainwindow.cpp +++ b/GUI/mainwindow.cpp @@ -62,6 +62,7 @@ extern const char* ATTACH_SAVED_ONLY; extern const char* SHOW_SYSTEM_PROCESSES; extern const char* DEFAULT_CODEPAGE; extern const char* FLUSH_DELAY; +extern const char* FLUSH_DELAY_SPACING; extern const char* MAX_BUFFER_SIZE; extern const char* MAX_HISTORY_SIZE; extern const char* CONFIG_JP_LOCALE; @@ -492,6 +493,7 @@ namespace { autoAttach, AUTO_ATTACH }, { autoAttachSavedOnly, ATTACH_SAVED_ONLY }, { showSystemProcesses, SHOW_SYSTEM_PROCESSES }, + { TextThread::flushDelaySpacing, FLUSH_DELAY_SPACING }, }) { auto checkBox = new QCheckBox(&dialog); @@ -663,6 +665,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) autoAttach = settings.value(AUTO_ATTACH, autoAttach).toBool(); autoAttachSavedOnly = settings.value(ATTACH_SAVED_ONLY, autoAttachSavedOnly).toBool(); showSystemProcesses = settings.value(SHOW_SYSTEM_PROCESSES, showSystemProcesses).toBool(); + TextThread::flushDelaySpacing = settings.value(FLUSH_DELAY_SPACING, TextThread::flushDelaySpacing).toBool(); TextThread::flushDelay = settings.value(FLUSH_DELAY, TextThread::flushDelay).toInt(); TextThread::maxBufferSize = settings.value(MAX_BUFFER_SIZE, TextThread::maxBufferSize).toInt(); TextThread::maxHistorySize = settings.value(MAX_HISTORY_SIZE, TextThread::maxHistorySize).toInt(); diff --git a/host/textthread.cpp b/host/textthread.cpp index 593ab0f..46d2458 100644 --- a/host/textthread.cpp +++ b/host/textthread.cpp @@ -58,6 +58,7 @@ void TextThread::Push(BYTE* data, int length) } } + if (flushDelaySpacing && !buffer.empty() && (hp.type & (USING_STRING))) buffer += L" "; if (hp.type & HEX_DUMP) for (int i = 0; i < length; i += sizeof(short)) buffer.append(FormatString(L"%04hX ", *(short*)(data + i))); else if (hp.type & USING_UNICODE) buffer.append((wchar_t*)data, length / sizeof(wchar_t)); else if (auto converted = StringToWideString(std::string((char*)data, length), hp.codepage ? hp.codepage : Host::defaultCodepage)) buffer.append(converted.value()); diff --git a/host/textthread.h b/host/textthread.h index f1b0c37..6771bbb 100644 --- a/host/textthread.h +++ b/host/textthread.h @@ -9,6 +9,7 @@ public: inline static OutputCallback Output; inline static bool filterRepetition = false; + inline static bool flushDelaySpacing = false; inline static int flushDelay = 500; // flush every 500ms by default inline static int maxBufferSize = 3000; inline static int maxHistorySize = 10'000'000; diff --git a/text.cpp b/text.cpp index b68a1f7..c0467c2 100644 --- a/text.cpp +++ b/text.cpp @@ -92,6 +92,7 @@ const char* ATTACH_SAVED_ONLY = u8"Auto attach (saved only)"; const char* SHOW_SYSTEM_PROCESSES = u8"Show system processes"; const char* DEFAULT_CODEPAGE = u8"Default codepage"; const char* FLUSH_DELAY = u8"Flush delay"; +const char* FLUSH_DELAY_SPACING = u8"Flush delay string spacing"; const char* MAX_BUFFER_SIZE = u8"Max buffer size"; const char* MAX_HISTORY_SIZE = u8"Max history size"; const char* CONFIG_JP_LOCALE = u8"Launch with JP locale"; @@ -820,6 +821,7 @@ Per rimuovere un estenzione, selezionala e premi rimuovi)"; SHOW_SYSTEM_PROCESSES = u8"Mostra i processi di sistema"; DEFAULT_CODEPAGE = u8"Codepage di base"; FLUSH_DELAY = u8"Ritardo flush"; + FLUSH_DELAY_SPACING = u8"Spazia ritardo flush string"; MAX_BUFFER_SIZE = u8"Massima dimensione buffer"; MAX_HISTORY_SIZE = u8"Massima dimensione cronologia"; CONFIG_JP_LOCALE = u8"Avvia con il JP locale";