Merge pull request #3592 from myk002/myk_tabs_to_spaces

convert tabs to spaces when getting clipboard text
develop
Myk 2023-07-21 16:34:25 -07:00 committed by GitHub
commit 1a040a1ba1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

@ -151,6 +151,11 @@ DFHACK_EXPORT std::string DFHack::getClipboardTextCp437() {
if (!g_sdl_handle || g_SDL_HasClipboardText() != SDL_TRUE) if (!g_sdl_handle || g_SDL_HasClipboardText() != SDL_TRUE)
return ""; return "";
char *text = g_SDL_GetClipboardText(); char *text = g_SDL_GetClipboardText();
// convert tabs to spaces so they don't get converted to '?'
for (char *c = text; *c; ++c) {
if (*c == '\t')
*c = ' ';
}
std::string textcp437 = UTF2DF(text); std::string textcp437 = UTF2DF(text);
DFHack::DFSDL::DFSDL_free(text); DFHack::DFSDL::DFSDL_free(text);
return textcp437; return textcp437;