Skip to content

Commit

Permalink
InputText: triple-click avoid scroll + include end of line character. (
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut committed Oct 25, 2021
1 parent 126a6f8 commit 9955242
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions imgui_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4205,8 +4205,16 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
else
{
// Triple-click: Select line
const bool is_eol = ImStb::STB_TEXTEDIT_GETCHAR(state, state->Stb.cursor) == '\n';
state->OnKeyPressed(STB_TEXTEDIT_K_LINESTART);
state->OnKeyPressed(STB_TEXTEDIT_K_LINEEND | STB_TEXTEDIT_K_SHIFT);
state->OnKeyPressed(STB_TEXTEDIT_K_RIGHT | STB_TEXTEDIT_K_SHIFT);
if (!is_eol && is_multiline)
{
ImSwap(state->Stb.select_start, state->Stb.select_end);
state->Stb.cursor = state->Stb.select_end;
}
state->CursorFollow = false;
}
state->CursorAnimReset();
}
Expand Down

0 comments on commit 9955242

Please sign in to comment.