| 399 | | gc.setBackground(lineBackground); |
|---|
| 400 | | styledText.drawBackground(gc, client.x, paintY, client.width, height); |
|---|
| 401 | | |
|---|
| | 399 | if (lineBackground !is null) { |
|---|
| | 400 | gc.setBackground(lineBackground); |
|---|
| | 401 | gc.fillRectangle(client.x, paintY, client.width, height); |
|---|
| | 402 | } else { |
|---|
| | 403 | gc.setBackground(widgetBackground); |
|---|
| | 404 | styledText.drawBackground(gc, client.x, paintY, client.width, height); |
|---|
| | 405 | } |
|---|
| 666 | | if (!includeRanges || ranges is null) newStyles[newStyles.length - 1] = style = cast(StyleRange)style.clone(); |
|---|
| 667 | | style.length = end - style.start + 1; |
|---|
| | 669 | if (end < style.start) { |
|---|
| | 670 | StyleRange[] tmp = new StyleRange[newStyles.length - 1]; |
|---|
| | 671 | System.arraycopy(newStyles, 0, tmp, 0, newStyles.length - 1); |
|---|
| | 672 | newStyles = tmp; |
|---|
| | 673 | } else { |
|---|
| | 674 | if (!includeRanges || ranges is null) newStyles[newStyles.length - 1] = style = cast(StyleRange)style.clone(); |
|---|
| | 675 | style.length = end - style.start + 1; |
|---|
| | 676 | } |
|---|
| | 880 | if (styledText !is null && styledText.ime !is null) { |
|---|
| | 881 | IME ime = styledText.ime; |
|---|
| | 882 | int compositionOffset = ime.getCompositionOffset(); |
|---|
| | 883 | if (compositionOffset !is -1) { |
|---|
| | 884 | int commitCount = ime.getCommitCount(); |
|---|
| | 885 | int compositionLength = ime.getText().length; |
|---|
| | 886 | if (compositionLength !is commitCount) { |
|---|
| | 887 | int compositionLine = content.getLineAtOffset(compositionOffset); |
|---|
| | 888 | if (compositionLine is lineIndex) { |
|---|
| | 889 | int[] imeRanges = ime.getRanges(); |
|---|
| | 890 | TextStyle[] imeStyles = ime.getStyles(); |
|---|
| | 891 | if (imeRanges.length > 0) { |
|---|
| | 892 | for (int i = 0; i < imeStyles.length; i++) { |
|---|
| | 893 | int start = imeRanges[i*2] - lineOffset; |
|---|
| | 894 | int end = imeRanges[i*2+1] - lineOffset; |
|---|
| | 895 | TextStyle imeStyle = imeStyles[i], userStyle; |
|---|
| | 896 | for (int j = start; j <= end; j++) { |
|---|
| | 897 | userStyle = layout.getStyle(j); |
|---|
| | 898 | if (userStyle is null && j > 0) userStyle = layout.getStyle(j - 1); |
|---|
| | 899 | if (userStyle is null && j + 1 < length) userStyle = layout.getStyle(j + 1); |
|---|
| | 900 | if (userStyle is null) { |
|---|
| | 901 | layout.setStyle(imeStyle, j, j); |
|---|
| | 902 | } else { |
|---|
| | 903 | TextStyle newStyle = new TextStyle(imeStyle); |
|---|
| | 904 | if (newStyle.font is null) newStyle.font = userStyle.font; |
|---|
| | 905 | if (newStyle.foreground is null) newStyle.foreground = userStyle.foreground; |
|---|
| | 906 | if (newStyle.background is null) newStyle.background = userStyle.background; |
|---|
| | 907 | layout.setStyle(newStyle, j, j); |
|---|
| | 908 | } |
|---|
| | 909 | } |
|---|
| | 910 | } |
|---|
| | 911 | } else { |
|---|
| | 912 | int start = compositionOffset - lineOffset; |
|---|
| | 913 | int end = start + compositionLength - 1; |
|---|
| | 914 | TextStyle userStyle = layout.getStyle(start); |
|---|
| | 915 | if (userStyle is null) { |
|---|
| | 916 | if (start > 0) userStyle = layout.getStyle(start - 1); |
|---|
| | 917 | if (userStyle is null && end + 1 < length) userStyle = layout.getStyle(end + 1); |
|---|
| | 918 | if (userStyle !is null) { |
|---|
| | 919 | TextStyle newStyle = new TextStyle(); |
|---|
| | 920 | newStyle.font = userStyle.font; |
|---|
| | 921 | newStyle.foreground = userStyle.foreground; |
|---|
| | 922 | newStyle.background = userStyle.background; |
|---|
| | 923 | layout.setStyle(newStyle, start, end); |
|---|
| | 924 | } |
|---|
| | 925 | } |
|---|
| | 926 | } |
|---|
| | 927 | } |
|---|
| | 928 | } |
|---|
| | 929 | } |
|---|
| | 930 | } |
|---|
| | 931 | |
|---|