diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-12-02 14:35:42 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-12-02 14:35:42 +0400 |
commit | 02aec1e758732a8a307b552b464da2fef3865f7b (patch) | |
tree | 420c95fa541c382c68eabfd7404da1e83c7a9932 /source/blender/editors | |
parent | 1815225faa75eb64e83fdc9f066fcd6339502d52 (diff) |
User Interface: fix for crash pressing Ctrl+Delete
also remove redundant string duplication.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 6 |
2 files changed, 2 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 1ed0c128a20..d0b0661c333 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1896,7 +1896,7 @@ static bool ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directi int step; BLI_str_cursor_step_utf8(str, len, &pos, direction, jump, true); step = pos - but->pos; - memmove(&str[but->pos], &str[but->pos + step], (len + 1) - but->pos); + memmove(&str[but->pos], &str[but->pos + step], (len + 1) - (but->pos + step)); changed = true; } } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 27f16a6fd5c..06213340f77 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1008,13 +1008,9 @@ static void ui_text_clip_cursor(uiFontStyle *fstyle, uiBut *but, const rcti *rec while (but->strwidth > okwidth) { float width; - char buf[UI_MAX_DRAW_STR]; - /* copy draw string */ - BLI_strncpy_utf8(buf, but->drawstr, sizeof(buf)); /* string position of cursor */ - buf[but->pos] = 0; - width = BLF_width(fstyle->uifont_id, buf + but->ofs, sizeof(buf) - but->ofs); + width = BLF_width(fstyle->uifont_id, but->drawstr + but->ofs, but->pos - but->ofs); /* if cursor is at 20 pixels of right side button we clip left */ if (width > okwidth - 20) { |