Changeset 125:8b6d038b7f79

Show
Ignore:
Timestamp:
02/11/08 20:23:29 (1 year ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

uncommented getCodePage for compatibility and made the parse statemachine work only with ascii to ensure proper parsing.

Files:

Legend:

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

    r108 r125  
    179179        auto newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); 
    180180        auto oldFont = OS.SelectObject (hDC, newFont); 
    181         TCHAR[] buffer = StrToTCHARs (/+getCodePage (),+/ parse (text)); 
     181        TCHAR[] buffer = StrToTCHARs (getCodePage (), parse (text)); 
    182182        RECT rect; 
    183183        int flags = OS.DT_CALCRECT | OS.DT_NOPREFIX; 
     
    411411    int index = 0, state = 0, linkIndex = 0; 
    412412    int start = 0, tagStart = 0, linkStart = 0, endtagStart = 0, refStart = 0; 
     413 
    413414    while (index < length_) { 
    414         char c = CharacterToLower (buffer [index]); 
     415 
     416        // instead Character.toLower 
     417        // only needed for the control symbols, which are always ascii 
     418        char c = buffer[index]; 
     419        if( c >= 'A' && c <= 'Z' ){ 
     420            c -= ( 'A' - 'a' ); 
     421        } 
     422 
     423        // only simple ascii whitespace needed 
     424        bool isWhitespace(char w ){ 
     425            switch(w){ 
     426                case ' ': return true; 
     427                default : return false; 
     428            } 
     429        } 
     430 
    415431        switch (state) { 
    416432            case 0: 
     
    433449                        break; 
    434450                    default: 
    435                         if (CharacterIsWhitespace(c)) break; 
     451                        if (isWhitespace(c)) break; 
    436452                        else state = 13; 
    437453                } 
     
    492508                break; 
    493509            case 13: 
    494                 if (CharacterIsWhitespace (c)) { 
     510                if (isWhitespace (c)) { 
    495511                    state = 0; 
    496512                } else if (c is '='){ 
     
    625641        */ 
    626642        if (string.length is 0) string = " ";  //$NON-NLS-1$ 
    627         TCHAR* buffer = StrToTCHARz (/+getCodePage (),+/ string); 
     643        TCHAR* buffer = StrToTCHARz (getCodePage (), string); 
    628644        OS.SetWindowText (handle, buffer); 
    629645        parse (text);