diff options
author | Ton Roosendaal <ton@blender.org> | 2006-12-26 13:18:38 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-12-26 13:18:38 +0300 |
commit | d1091296636726149309d59a5d29e24cfd343631 (patch) | |
tree | 9f7452b5f75c4a8e9fbde399a2c42571f560d4cd /source/blender/src/interface.c | |
parent | e4511c805fa3cdebb33f321963fcdb46cc0c4aea (diff) |
Bugfix #5498
Textbutton: SHIFT+Arrow selections did not work proper when the amount of
text in a button was more than its width could display. Now still doesn't
work OK 100% (when selection itself goes outside of button view).
Also: removed the very bad SELWIDTH define (but->selend - but->selsta).
That's not making readable code!
Diffstat (limited to 'source/blender/src/interface.c')
-rw-r--r-- | source/blender/src/interface.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index b45b1f9dff5..94b3a57687a 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -1349,7 +1349,7 @@ static short ui_delete_selection_edittext(uiBut *but) str= (char *)but->poin; - deletedwidth = SELWIDTH; + deletedwidth = (but->selend - but->selsta); for(x=0; x< strlen(str); x++) { if (but->selend + x <= strlen(str) ) { @@ -1745,7 +1745,7 @@ static int ui_do_but_TEX(uiBut *but) /* paste */ if (dev==VKEY) { /* paste over the current selection */ - if (SELWIDTH > 0) { + if ((but->selend - but->selsta) > 0) { len -= ui_delete_selection_edittext(but); } @@ -1775,7 +1775,7 @@ static int ui_do_but_TEX(uiBut *but) /* for cut only, delete the selection afterwards */ if (dev==XKEY) { - if (SELWIDTH > 0) { + if ((but->selend - but->selsta) > 0) { len -= ui_delete_selection_edittext(but); if (len < 0) len = 0; @@ -1786,10 +1786,10 @@ static int ui_do_but_TEX(uiBut *but) } else if((ascii)){ - if(len-SELWIDTH+1 <= but->max) { + if(len-(but->selend - but->selsta)+1 <= but->max) { /* type over the current selection */ - if (SELWIDTH > 0) { + if ((but->selend - but->selsta) > 0) { len -= ui_delete_selection_edittext(but); } @@ -1810,7 +1810,7 @@ static int ui_do_but_TEX(uiBut *but) case RIGHTARROWKEY: /* if there's a selection */ - if (SELWIDTH > 0) { + if ((but->selend - but->selsta) > 0) { /* extend the selection based on the first direction taken */ if(G.qual & LR_SHIFTKEY) { if (!selextend) { @@ -1859,7 +1859,7 @@ static int ui_do_but_TEX(uiBut *but) case LEFTARROWKEY: /* if there's a selection */ - if (SELWIDTH > 0) { + if ((but->selend - but->selsta) > 0) { /* extend the selection based on the first direction taken */ if(G.qual & LR_SHIFTKEY) { if (!selextend) { @@ -1935,7 +1935,7 @@ static int ui_do_but_TEX(uiBut *but) break; case DELKEY: - if (SELWIDTH > 0) { + if ((but->selend - but->selsta) > 0) { len -= ui_delete_selection_edittext(but); if (len < 0) len = 0; @@ -1951,7 +1951,7 @@ static int ui_do_but_TEX(uiBut *but) case BACKSPACEKEY: if(len!=0) { - if (SELWIDTH > 0) { + if ((but->selend - but->selsta) > 0) { len -= ui_delete_selection_edittext(but); if (len < 0) len = 0; |