mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-12 16:15:20 +02:00
Formspec: Fix newline conversion on Windows (#16311)
Strings with CR+LF (\r+\n) were wrongly fixed into \r, which is enough to display them correctly, but the missing \n became important once the text was saved/reloaded. By removing the \r instead of the \n, then the text is displayed correctly and saved correctly.
This commit is contained in:
@@ -1104,10 +1104,7 @@ void CGUIEditBox::breakText()
|
||||
lineBreak = true;
|
||||
c = 0;
|
||||
if (Text[i + 1] == L'\n') { // Windows breaks
|
||||
// TODO: I (Michael) think that we shouldn't change the text given by the user for whatever reason.
|
||||
// Instead rework the cursor positioning to be able to handle this (but not in stable release
|
||||
// branch as users might already expect this behavior).
|
||||
Text.erase(i + 1);
|
||||
Text.erase(i);
|
||||
--size;
|
||||
if (CursorPos > i)
|
||||
--CursorPos;
|
||||
|
@@ -337,10 +337,7 @@ void GUIEditBoxWithScrollBar::breakText()
|
||||
line_break = true;
|
||||
c = 0;
|
||||
if (Text[i + 1] == L'\n') { // Windows breaks
|
||||
// TODO: I (Michael) think that we shouldn't change the text given by the user for whatever reason.
|
||||
// Instead rework the cursor positioning to be able to handle this (but not in stable release
|
||||
// branch as users might already expect this behavior).
|
||||
Text.erase(i + 1);
|
||||
Text.erase(i);
|
||||
--size;
|
||||
if (m_cursor_pos > i)
|
||||
--m_cursor_pos;
|
||||
|
Reference in New Issue
Block a user