diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-05-07 21:52:44 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-05-07 21:52:44 +0400 |
commit | 471c28f91c489d40ae80561ce4d9629d2f152292 (patch) | |
tree | de175451299ed2115202f761500e67161b656b08 /source/blender/editors/space_text/text_ops.c | |
parent | e239085f70173b631861e58aede62484e246246e (diff) |
Fix #27319: Text editor "Find" does not locate words.
Added new option to find panel of space text which toggles
case-esensitive search.
Additional changes:
- Send NC_TEXT|NA_EDITED when removing markers in find_and_replace modifier
this prevents "sticked" markers which disappears on first redraw when
search text wasn't found
- Do not show "Text wasn't found" error when text to be searched is contained
in the end of buffer and it's selected. Replacing/marking used to happen, but
this popup message was really annoying for this case.
TODO: It's incorrect to use UI_GetThemeColor4ubv from this operator
Diffstat (limited to 'source/blender/editors/space_text/text_ops.c')
-rw-r--r-- | source/blender/editors/space_text/text_ops.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index c0c928dcb24..e87719084ce 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2841,8 +2841,14 @@ static int find_and_replace(bContext *C, wmOperator *op, short mode) flags ^= ST_FIND_WRAP; do { - if(first) + int proceed= 0; + + if(first) { + if(text->markers.first) + WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); + txt_clear_markers(text, TMARK_GRP_FINDALL, 0); + } first= 0; @@ -2850,7 +2856,10 @@ static int find_and_replace(bContext *C, wmOperator *op, short mode) if(mode!=TEXT_FIND && txt_has_sel(text)) { tmp= txt_sel_to_buf(text); - if(strcmp(st->findstr, tmp)==0) { + if(flags & ST_MATCH_CASE) proceed= strcmp(st->findstr, tmp)==0; + else proceed= BLI_strcasecmp(st->findstr, tmp)==0; + + if(proceed) { if(mode==TEXT_REPLACE) { txt_insert_buf(text, st->replacestr); if(text->curl && text->curl->format) { @@ -2880,7 +2889,7 @@ static int find_and_replace(bContext *C, wmOperator *op, short mode) } /* Find next */ - if(txt_find_string(text, st->findstr, flags & ST_FIND_WRAP)) { + if(txt_find_string(text, st->findstr, flags & ST_FIND_WRAP, flags & ST_MATCH_CASE)) { text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text); } @@ -2897,7 +2906,7 @@ static int find_and_replace(bContext *C, wmOperator *op, short mode) first= 1; } else { - if(!found) BKE_reportf(op->reports, RPT_ERROR, "Text not found: %s", st->findstr); + if(!found && !proceed) BKE_reportf(op->reports, RPT_ERROR, "Text not found: %s", st->findstr); break; } found = 1; |