Changeset 181:2708124a8f6c
- 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
| r152 |
r181 |
|
| 45 | 45 | |
|---|
| 46 | 46 | alias tango.text.Text.Text!(char) Text8; |
|---|
| | 47 | |
|---|
| 47 | 48 | /** |
|---|
| 48 | 49 | * Instances of this class represent a selectable |
|---|
| … | … | |
| 531 | 532 | Text8 result = new Text8 (); |
|---|
| 532 | 533 | char [] buffer = string.dup; |
|---|
| | 534 | |
|---|
| 533 | 535 | int index = 0, state = 0, linkIndex = 0; |
|---|
| 534 | 536 | int start = 0, tagStart = 0, linkStart = 0, endtagStart = 0, refStart = 0; |
|---|
| 535 | 537 | 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 | |
|---|
| 537 | 541 | switch (state) { |
|---|
| 538 | 542 | case 0: |
|---|
| … | … | |
| 630 | 634 | break; |
|---|
| 631 | 635 | } |
|---|
| 632 | | index++; |
|---|
| | 636 | index+=increment; |
|---|
| 633 | 637 | } |
|---|
| 634 | 638 | if (start < length_) { |
|---|
| … | … | |
| 657 | 661 | int mnemonic = -1, index = start; |
|---|
| 658 | 662 | while (index < end) { |
|---|
| 659 | | if (buffer [index] is '&') { |
|---|
| | 663 | int incr = 1; |
|---|
| | 664 | if ( buffer[index] is '&') { |
|---|
| 660 | 665 | if (index + 1 < end && buffer [index + 1] is '&') { |
|---|
| 661 | 666 | result.append (buffer [index]); |
|---|
| … | … | |
| 665 | 670 | } |
|---|
| 666 | 671 | } else { |
|---|
| 667 | | result.append (buffer [index]); |
|---|
| 668 | | } |
|---|
| 669 | | index++; |
|---|
| | 672 | result.append ( firstCodePointStr( buffer [index .. $ ], incr )); |
|---|
| | 673 | } |
|---|
| | 674 | index+=incr; |
|---|
| 670 | 675 | } |
|---|
| 671 | 676 | return mnemonic; |
|---|
| … | … | |
| 712 | 717 | checkWidget (); |
|---|
| 713 | 718 | if (string is null) error (DWT.ERROR_NULL_ARGUMENT); |
|---|
| 714 | | if (string ==/*eq*/ text) return; |
|---|
| | 719 | if (string.equals(text)) return; |
|---|
| 715 | 720 | text = string; |
|---|
| 716 | 721 | layout.setText (parse (string)); |
|---|