111 |
111 |
112 str:= InputLinePrefix + InputStr.s; |
112 str:= InputLinePrefix + InputStr.s; |
113 font:= CheckCJKFont(ansistring(str), fnt16); |
113 font:= CheckCJKFont(ansistring(str), fnt16); |
114 |
114 |
115 // get only substring before cursor to determine length |
115 // get only substring before cursor to determine length |
116 SetLength(str, Length(InputLinePrefix) + cursorPos); |
116 // SetLength(str, Length(InputLinePrefix) + cursorPos); // makes pas2c unhappy |
|
117 str[0]:= char(Length(InputLinePrefix) + cursorPos); |
117 // get render size of text |
118 // get render size of text |
118 TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(str), @coff, nil); |
119 TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(str), @coff, nil); |
119 |
120 |
120 cursorX:= 7 - cScreenWidth div 2 + coff; |
121 cursorX:= 7 - cScreenWidth div 2 + coff; |
121 |
122 |
122 // calculate selection width on screen |
123 // calculate selection width on screen |
123 if selectedPos >= 0 then |
124 if selectedPos >= 0 then |
124 begin |
125 begin |
125 if selectedPos > cursorPos then |
126 if selectedPos > cursorPos then |
126 str:= InputLinePrefix + InputStr.s; |
127 str:= InputLinePrefix + InputStr.s; |
127 SetLength(str, Length(InputLinePrefix) + selectedPos); |
128 // SetLength(str, Length(InputLinePrefix) + selectedPos); // makes pas2c unhappy |
|
129 str[0]:= char(Length(InputLinePrefix) + selectedPos); |
128 TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(str), @soff, nil); |
130 TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(str), @soff, nil); |
129 selectionDx:= soff - coff; |
131 selectionDx:= soff - coff; |
130 end |
132 end |
131 else |
133 else |
132 selectionDx:= 0; |
134 selectionDx:= 0; |