Merge remote-tracking branch 'Blu3train/flushDelayStringSpacing'

This commit is contained in:
Chenx221 2024-09-05 11:29:17 +08:00
commit 874430a5a7
4 changed files with 7 additions and 0 deletions

View File

@ -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;
@ -495,6 +496,7 @@ namespace
{ autoAttach, AUTO_ATTACH },
{ autoAttachSavedOnly, ATTACH_SAVED_ONLY },
{ showSystemProcesses, SHOW_SYSTEM_PROCESSES },
{ TextThread::flushDelaySpacing, FLUSH_DELAY_SPACING },
})
{
auto checkBox = new QCheckBox(&dialog);
@ -666,6 +668,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();

View File

@ -58,6 +58,7 @@ void TextThread::Push(BYTE* data, int length)
}
}
if (flushDelaySpacing && !buffer.empty() && (hp.type & (USING_STRING))) buffer += L"\x200b "; // insert \x200b to recognize it in case it has to be found with a filter
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());

View File

@ -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;

View File

@ -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";
@ -858,6 +859,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";