@@ -52,8 +52,8 @@ public class Text extends Scrollable {
5252boolean doubleClick ,ignoreModify ,ignoreVerify ,ignoreCharacter ;
5353
5454boolean keyDownOK ;
55-
5655Element textHandle ;
56+ private String textValue ;
5757
5858int lineHeight ;
5959
@@ -197,6 +197,7 @@ void createHandle () {
197197textHandle .type ="text" ;
198198}
199199}
200+ textValue ="" ;
200201String textCSSName =null ;
201202if (OS .isIE ) {
202203textCSSName ="text-ie-default" ;
@@ -315,26 +316,33 @@ public void run() {
315316String s =verifyText (txt ,0 ,0 ,e );
316317if (s ==null ) {
317318toReturn (false );
319+ return ;
318320}else if (hooks (SWT .Modify )) {
319- Event ev =new Event ();
320- ev .type =SWT .Modify ;
321- ev .widget =Text .this ;
322- ev .display =display ;
323- ev .time =display .getLastEventTime ();
324- sendEvent (ev );
325- toReturn (ev .doit );
321+ if (textValue !=textHandle .value ) {
322+ textValue =textHandle .value ;
323+ Event ev =new Event ();
324+ ev .type =SWT .Modify ;
325+ ev .widget =Text .this ;
326+ ev .display =display ;
327+ ev .time =display .getLastEventTime ();
328+ sendEvent (ev );
329+ toReturn (ev .doit );
330+ }
326331}
327332}
328333}
329334keyDownOK =this .isReturned ();
330335if (!verifyHooked ||hooks (SWT .KeyDown )) {
331336Event ev =new Event ();
332- ev .type =SWT .Modify ;
333- ev .widget =Text .this ;
334- ev .display =display ;
335- ev .time =display .getLastEventTime ();
336- sendEvent (ev );
337- toReturn (ev .doit );
337+ if (textValue !=textHandle .value ) {
338+ textValue =textHandle .value ;
339+ ev .type =SWT .Modify ;
340+ ev .widget =Text .this ;
341+ ev .display =display ;
342+ ev .time =display .getLastEventTime ();
343+ sendEvent (ev );
344+ toReturn (ev .doit );
345+ }
338346
339347HTMLEventWrapper e =new HTMLEventWrapper (getEvent ());
340348HTMLEvent evt = (HTMLEvent )e .event ;
@@ -438,24 +446,25 @@ public void run() {
438446}
439447String newText =textHandle .value ;
440448if (newText !=null ) {
441- //String oldText = newText;
442449newText =verifyText (newText ,0 ,0 ,null );
443450if (newText ==null ) {
444451toReturn (true );
445452return ;
446453}
447- //if (!newText.equals (oldText)) {
454+ if (textValue !=textHandle .value ) {
455+ textValue =textHandle .value ;
448456Event e =new Event ();
449457e .type =SWT .Modify ;
450458e .item =Text .this ;
451459e .widget =Text .this ;
452460sendEvent (e );
453461toReturn (e .doit );
454- // }
462+ }
455463}
456464}
457465};
458466Clazz .addEvent (textHandle ,"keyup" ,hModifyKeyUp );
467+ Clazz .addEvent (textHandle ,"change" ,hModifyKeyUp );
459468
460469hModifyBlur =new RunnableCompatibility () {
461470public void run () {
@@ -629,6 +638,10 @@ public void append (String string) {
629638OS.SendMessage (handle, OS.EM_SCROLLCARET, 0, 0);
630639*/
631640textHandle .value +=string ;
641+ if (string .length () >0 ) {
642+ textValue =textHandle .value ;
643+ sendEvent (SWT .Modify );
644+ }
632645}
633646
634647static int checkStyle (int style ) {
@@ -1632,10 +1645,16 @@ public void insert (String string) {
16321645ignoreCharacter = false;
16331646*/
16341647insertTextString (textHandle ,string );
1648+ /*
16351649if ((style & SWT.MULTI) != 0) {
16361650sendEvent (SWT.Modify);
16371651// widget could be disposed at this point
16381652}
1653+ */
1654+ if (textValue !=textHandle .value ) {
1655+ textValue =textHandle .value ;
1656+ sendEvent (SWT .Modify );
1657+ }
16391658}
16401659
16411660/**
@@ -1760,6 +1779,7 @@ protected void releaseHandle() {
17601779hModifyFocus =null ;
17611780}
17621781if (hModifyKeyUp !=null ) {
1782+ Clazz .removeEvent (textHandle ,"change" ,hModifyKeyUp );
17631783Clazz .removeEvent (textHandle ,"keyup" ,hModifyKeyUp );
17641784hModifyKeyUp =null ;
17651785}
@@ -2385,10 +2405,16 @@ public void setText (String string) {
23852405* notify the application that the text has changed.
23862406* The fix is to send the event.
23872407*/
2388- //if ((style & SWT.MULTI) != 0) {
2408+ /*
2409+ if ((style & SWT.MULTI) != 0) {
23892410sendEvent (SWT.Modify);
23902411// widget could be disposed at this point
2391- //}
2412+ }
2413+ */
2414+ if (textValue !=string ) {
2415+ textValue =string ;
2416+ sendEvent (SWT .Modify );
2417+ }
23922418}
23932419
23942420/**