equal
deleted
inserted
replaced
706 CopyToClipboard(selection); |
706 CopyToClipboard(selection); |
707 end; |
707 end; |
708 end; |
708 end; |
709 |
709 |
710 // TODO: honor utf8, don't break utf8 chars when shifting chars beyond limit |
710 // TODO: honor utf8, don't break utf8 chars when shifting chars beyond limit |
711 procedure InsertIntoInputStr(var s: shortstring); |
711 procedure InsertIntoInputStr(s: shortstring); |
712 var i, l, il, lastc: integer; |
712 var i, l, il, lastc: integer; |
713 begin |
713 begin |
714 // safe length for string |
714 // safe length for string |
715 l:= min(MaxInputStrLen-cursorPos, Length(s)); |
715 l:= min(MaxInputStrLen-cursorPos, Length(s)); |
|
716 s:= copy(s,1,l); |
716 |
717 |
717 // if we insert rather than append, shift info in InputStrL accordingly |
718 // if we insert rather than append, shift info in InputStrL accordingly |
718 if cursorPos < Length(InputStr.s) then |
719 if cursorPos < Length(InputStr.s) then |
719 begin |
720 begin |
720 for i:= Length(InputStr.s) downto cursorPos + 1 do |
721 for i:= Length(InputStr.s) downto cursorPos + 1 do |
730 end; |
731 end; |
731 end; |
732 end; |
732 |
733 |
733 InputStrL[cursorPos + l]:= cursorPos; |
734 InputStrL[cursorPos + l]:= cursorPos; |
734 // insert string truncated to safe length |
735 // insert string truncated to safe length |
735 Insert(copy(s,1,l), InputStr.s, cursorPos + 1); |
736 Insert(s, InputStr.s, cursorPos + 1); |
736 if Length(InputStr.s) > MaxInputStrLen then |
737 if Length(InputStr.s) > MaxInputStrLen then |
737 InputStr.s[0]:= char(MaxInputStrLen); |
738 InputStr.s[0]:= char(MaxInputStrLen); |
738 |
739 |
739 SetLine(InputStr, InputStr.s, true); |
740 SetLine(InputStr, InputStr.s, true); |
740 |
741 |