Changeset 181:2708124a8f6c

Show
Ignore:
Timestamp:
03/02/08 12:19:44 (6 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

Fix: utf8 awareness

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/widgets/Link.d

    r152 r181  
    4545 
    4646alias tango.text.Text.Text!(char) Text8; 
     47 
    4748/** 
    4849 * Instances of this class represent a selectable 
     
    531532    Text8 result = new Text8 (); 
    532533    char [] buffer = string.dup; 
     534 
    533535    int index = 0, state = 0, linkIndex = 0; 
    534536    int start = 0, tagStart = 0, linkStart = 0, endtagStart = 0, refStart = 0; 
    535537    while (index < length_) { 
    536         char c = tango.text.Unicode.toLower (buffer [index .. index+1])[0]; 
     538        int increment; 
     539        dchar c = CharacterFirstToLower (buffer [index .. $ ], increment ); 
     540 
    537541        switch (state) { 
    538542            case 0: 
     
    630634                break; 
    631635        } 
    632         index++
     636        index+=increment
    633637    } 
    634638    if (start < length_) { 
     
    657661    int mnemonic = -1, index = start; 
    658662    while (index < end) { 
    659         if (buffer [index] is '&') { 
     663        int incr = 1; 
     664        if ( buffer[index] is '&') { 
    660665            if (index + 1 < end && buffer [index + 1] is '&') { 
    661666                result.append (buffer [index]); 
     
    665670            } 
    666671        } else { 
    667             result.append (buffer [index]); 
    668         } 
    669         index++
     672            result.append ( firstCodePointStr( buffer [index .. $ ], incr )); 
     673        } 
     674        index+=incr
    670675    } 
    671676    return mnemonic; 
     
    712717    checkWidget (); 
    713718    if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 
    714     if (string ==/*eq*/ text) return; 
     719    if (string.equals(text)) return; 
    715720    text = string; 
    716721    layout.setText (parse (string));