From 9dc860b7ccf9164471b2892a7055dede1ad48279 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 11 Dec 2015 22:55:42 +0000 Subject: [PATCH] stb_textedit: better support for keying while holding mouse drag button --- stb_textedit.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stb_textedit.h b/stb_textedit.h index 6740b91..d1f918f 100644 --- a/stb_textedit.h +++ b/stb_textedit.h @@ -451,6 +451,8 @@ static void stb_textedit_click(STB_TEXTEDIT_STRING *str, STB_TexteditState *stat static void stb_textedit_drag(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y) { int p = stb_text_locate_coord(str, x, y); + if (state->select_start == state->select_end) + state->select_start = state->cursor; state->cursor = state->select_end = p; }