mirror of
https://github.com/ocornut/imgui.git
synced 2026-06-01 01:34:57 +08:00
InputText: Pasting a multi-line buffer into a single-line edit replaces carriage return by spaces. (#8459)
This commit is contained in:
@@ -77,6 +77,8 @@ Other changes:
|
|||||||
inner/outer padding applied to hit-testing of windows borders and detection
|
inner/outer padding applied to hit-testing of windows borders and detection
|
||||||
of hovered window.
|
of hovered window.
|
||||||
- InputText: Allow CTRL+Shift+Z to redo even outside of OSX. (#8389) [@tanksdude]
|
- InputText: Allow CTRL+Shift+Z to redo even outside of OSX. (#8389) [@tanksdude]
|
||||||
|
- InputText: Pasting a multi-line buffer into a single-line edit replaces
|
||||||
|
carriage return by spaces. (#8459)
|
||||||
- InputTextWithHint(): Fixed buffer-overflow (luckily often with no visible effect)
|
- InputTextWithHint(): Fixed buffer-overflow (luckily often with no visible effect)
|
||||||
when a user callback modified the buffer contents in a way that altered the
|
when a user callback modified the buffer contents in a way that altered the
|
||||||
visibility of the preview/hint buffer. (#8368) [@m9710797, @ocornut]
|
visibility of the preview/hint buffer. (#8368) [@m9710797, @ocornut]
|
||||||
|
|||||||
@@ -4295,6 +4295,12 @@ static bool InputTextFilterCharacter(ImGuiContext* ctx, unsigned int* p_char, Im
|
|||||||
{
|
{
|
||||||
bool pass = false;
|
bool pass = false;
|
||||||
pass |= (c == '\n') && (flags & ImGuiInputTextFlags_Multiline) != 0; // Note that an Enter KEY will emit \r and be ignored (we poll for KEY in InputText() code)
|
pass |= (c == '\n') && (flags & ImGuiInputTextFlags_Multiline) != 0; // Note that an Enter KEY will emit \r and be ignored (we poll for KEY in InputText() code)
|
||||||
|
if (c == '\n' && input_source_is_clipboard && (flags & ImGuiInputTextFlags_Multiline) == 0) // In single line mode, replace \n with a space
|
||||||
|
{
|
||||||
|
c = *p_char = ' ';
|
||||||
|
pass = true;
|
||||||
|
}
|
||||||
|
pass |= (c == '\n') && (flags & ImGuiInputTextFlags_Multiline) != 0;
|
||||||
pass |= (c == '\t') && (flags & ImGuiInputTextFlags_AllowTabInput) != 0;
|
pass |= (c == '\t') && (flags & ImGuiInputTextFlags_AllowTabInput) != 0;
|
||||||
if (!pass)
|
if (!pass)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user