diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-09-02 13:39:21 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-09-02 13:39:21 +0400 |
commit | 7a496bfbcf3c5a25d4101cf427ca980327ed3e8a (patch) | |
tree | 25c248a5e62b4472734d9e119c3ae689bb8ac292 /source/blender/editors/space_text/text_draw.c | |
parent | 612e2d4dbe0e8dfe5b4d4fee49040ec38107ada3 (diff) |
Partial fix for #28441: Tab width in texteditor ignored if used tabs as spaces
Scroll to cursor when displaying text datablock was changed.
This behavior was lost in 2.5x.
Diffstat (limited to 'source/blender/editors/space_text/text_draw.c')
-rw-r--r-- | source/blender/editors/space_text/text_draw.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 28230b7a48b..066404f23ba 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1821,12 +1821,10 @@ void text_update_character_width(SpaceText *st) /* Moves the view to the cursor location, also used to make sure the view isnt outside the file */ -void text_update_cursor_moved(bContext *C) +void text_scroll_to_cursor(SpaceText *st, ScrArea *sa) { - ScrArea *sa= CTX_wm_area(C); - SpaceText *st= CTX_wm_space_text(C); Text *text; - ARegion *ar; + ARegion *ar= NULL; int i, x, winx= 0; if(ELEM3(NULL, st, st->text, st->text->curl)) return; @@ -1834,8 +1832,10 @@ void text_update_cursor_moved(bContext *C) text= st->text; for(ar=sa->regionbase.first; ar; ar= ar->next) - if(ar->regiontype==RGN_TYPE_WINDOW) + if(ar->regiontype==RGN_TYPE_WINDOW) { winx= ar->winx; + break; + } winx -= TXT_SCROLL_WIDTH; @@ -1844,7 +1844,7 @@ void text_update_cursor_moved(bContext *C) i= txt_get_span(text->lines.first, text->sell); if(st->wordwrap) { int offl, offc; - wrap_offset(st, CTX_wm_region(C), text->sell, text->selc, &offl, &offc); + wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); i+= offl; } @@ -1865,3 +1865,10 @@ void text_update_cursor_moved(bContext *C) if(st->left <0) st->left= 0; } +void text_update_cursor_moved(bContext *C) +{ + ScrArea *sa= CTX_wm_area(C); + SpaceText *st= CTX_wm_space_text(C); + + text_scroll_to_cursor(st, sa); +} |