mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
InputText: Added support for Ctrl+Delete to delete up to end of word. (#6067)
This commit is contained in:
@ -4317,7 +4317,16 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
||||
else if (IsKeyPressed(ImGuiKey_PageDown) && is_multiline) { state->OnKeyPressed(STB_TEXTEDIT_K_PGDOWN | k_mask); scroll_y += row_count_per_page * g.FontSize; }
|
||||
else if (IsKeyPressed(ImGuiKey_Home)) { state->OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTSTART | k_mask : STB_TEXTEDIT_K_LINESTART | k_mask); }
|
||||
else if (IsKeyPressed(ImGuiKey_End)) { state->OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTEND | k_mask : STB_TEXTEDIT_K_LINEEND | k_mask); }
|
||||
else if (IsKeyPressed(ImGuiKey_Delete) && !is_readonly && !is_cut) { state->OnKeyPressed(STB_TEXTEDIT_K_DELETE | k_mask); }
|
||||
else if (IsKeyPressed(ImGuiKey_Delete) && !is_readonly && !is_cut)
|
||||
{
|
||||
if (!state->HasSelection())
|
||||
{
|
||||
// OSX doesn't seem to have Super+Delete to delete until end-of-line, so we don't emulate that (as opposed to Super+Backspace)
|
||||
if (is_wordmove_key_down)
|
||||
state->OnKeyPressed(STB_TEXTEDIT_K_WORDRIGHT | STB_TEXTEDIT_K_SHIFT);
|
||||
}
|
||||
state->OnKeyPressed(STB_TEXTEDIT_K_DELETE | k_mask);
|
||||
}
|
||||
else if (IsKeyPressed(ImGuiKey_Backspace) && !is_readonly)
|
||||
{
|
||||
if (!state->HasSelection())
|
||||
|
Reference in New Issue
Block a user