hedgewars/uChat.pas
changeset 10926 43612076e989
parent 10921 05e6f3b02612
child 10985 c5348fe9077c
equal deleted inserted replaced
10924:ed1b6914cac5 10926:43612076e989
   592 end;
   592 end;
   593 
   593 
   594 procedure MoveCursorToPreviousChar();
   594 procedure MoveCursorToPreviousChar();
   595 begin
   595 begin
   596     if cursorPos > 0 then
   596     if cursorPos > 0 then
   597         begin
   597         repeat
   598         while (not IsFirstCharByte(InputStr.s[cursorPos])) do
       
   599             begin
       
   600             dec(cursorPos);
   598             dec(cursorPos);
   601             end;
   599         until ((cursorPos = 0) or IsFirstCharByte(InputStr.s[cursorPos + 1]));
   602         dec(cursorPos);
       
   603         end;
       
   604 end;
   600 end;
   605 
   601 
   606 procedure MoveCursorToNextChar();
   602 procedure MoveCursorToNextChar();
   607 begin
   603 var len: integer;
   608     if cursorPos <  Length(InputStr.s) then
   604 begin
   609         begin
   605     len:= Length(InputStr.s);
   610         inc(cursorPos, 2);
   606     if cursorPos < len then
   611         while (cursorPos <  Length(InputStr.s)) and (not IsFirstCharByte(InputStr.s[cursorPos])) do
   607         repeat
   612             begin
       
   613             inc(cursorPos);
   608             inc(cursorPos);
   614             end;
   609         until ((cursorPos = len) or IsFirstCharByte(InputStr.s[cursorPos + 1]));
   615         dec(cursorPos);
       
   616         end;
       
   617 end;
   610 end;
   618 
   611 
   619 procedure DeleteLastUTF8CharFromStr(var s: shortstring);
   612 procedure DeleteLastUTF8CharFromStr(var s: shortstring);
   620 var l: byte;
   613 var l: byte;
   621 begin
   614 begin