diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-09-27 20:35:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-09-27 20:35:14 +0400 |
commit | f8e5e953c5abd7242242ccc37ccd5ea833d4420e (patch) | |
tree | d914ad7d1250b8b943b086d84f1c721a98860a02 /source/blender/editors/space_console | |
parent | 1a3cc12999c17196a9cb4d60ec6272b50093ff65 (diff) |
bugfix, console text selection /w wrapped lines now works.
Diffstat (limited to 'source/blender/editors/space_console')
-rw-r--r-- | source/blender/editors/space_console/console_draw.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c index 5ef86c87594..4bff21ab3d2 100644 --- a/source/blender/editors/space_console/console_draw.c +++ b/source/blender/editors/space_console/console_draw.c @@ -163,16 +163,20 @@ static int console_draw_string(ConsoleDrawContext *cdc, char *str, int str_len, /* just advance the height */ if(cdc->draw==0) { - if(cdc->pos_pick) { - if((cdc->mval[1] != INT_MAX) && cdc->xy[1] <= cdc->mval[1]) { - if((cdc->xy[1]+cdc->lheight >= cdc->mval[1])) { + if(cdc->pos_pick && (cdc->mval[1] != INT_MAX)) { + if(cdc->xy[1] <= cdc->mval[1]) { + if((y_next >= cdc->mval[1])) { int ofs = (int)floor(((float)cdc->mval[0] / (float)cdc->cwidth)); + + /* wrap */ + if(str_len > cdc->console_width) + ofs += (cdc->console_width * ((int)((((float)(y_next - cdc->mval[1]) / (float)(y_next-cdc->xy[1])) * tot_lines)))); + CLAMP(ofs, 0, str_len); *cdc->pos_pick += str_len - ofs; } else *cdc->pos_pick += str_len + 1; } - } cdc->xy[1]= y_next; |