From 8a0ad8f8b5b76f5fe69c628c9e564e0231cc0576 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 Jan 2013 19:12:11 +0000 Subject: [PATCH] fix for text selection glitch, moving the mouse to the left would sometimes not entirely select the start of the text. --- source/blender/editors/interface/interface_handlers.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index dc87a23cd54..7abccb17818 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1447,10 +1447,10 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con } /* mouse dragged outside the widget to the left */ - if (x < startx && but->ofs > 0) { + if (x < startx) { int i = but->ofs; - origstr[but->ofs] = 0; + origstr[but->ofs] = '\0'; while (i > 0) { if (BLI_str_cursor_step_prev_utf8(origstr, but->ofs, &i)) { @@ -1467,7 +1467,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con but->pos = but->ofs; } /* mouse inside the widget, mouse coords mapped in widget space */ - else if (x >= startx) { + else { /* (x >= startx) */ int pos_i; /* keep track of previous distance from the cursor to the char */ @@ -1476,7 +1476,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con but->pos = pos_prev = strlen(origstr) - but->ofs; - while (TRUE) { + while (true) { cdist = startx + BLF_width(fstyle->uifont_id, origstr + but->ofs); /* check if position is found */