hedgewars/uConsole.pas
changeset 786 346c886bca7b
parent 785 ac538f1a629e
child 787 5064d72fa0e2
equal deleted inserted replaced
785:ac538f1a629e 786:346c886bca7b
   244 var t: PVariable;
   244 var t: PVariable;
   245     c: char;
   245     c: char;
   246 begin
   246 begin
   247 if InputStr.s[0] = #0 then exit;
   247 if InputStr.s[0] = #0 then exit;
   248 c:= InputStr.s[1];
   248 c:= InputStr.s[1];
   249 if c in ['/', '$'] then Delete(InputStr.s, 1, 1)
   249 if c in ['/', '$'] then Delete(InputStr.s, 1, 1) else c:= #0;
   250                    else c:= #0;
   250 
   251 if InputStr.s[byte(InputStr.s[0])] = #32 then dec(InputStr.s[0]);
   251 if InputStr.s[byte(InputStr.s[0])] = #32 then dec(InputStr.s[0]);
   252 t:= Variables;
   252 t:= Variables;
   253 while t <> nil do
   253 while t <> nil do
   254       begin
   254       begin
   255       if (c=#0) or ((t^.VType =  vtCommand) and (c='/'))or
   255       if (c=#0) or ((t^.VType =  vtCommand) and (c='/'))or
   256                    ((t^.VType <> vtCommand) and (c='$'))then
   256                    ((t^.VType <> vtCommand) and (c='$'))then
   257          if copy(t^.Name, 1, Length(InputStr.s)) = InputStr.s then
   257          if copy(t^.Name, 1, Length(InputStr.s)) = InputStr.s then
   258             begin
   258             begin
   259             if t^.VType = vtCommand then InputStr.s:= '/' + t^.Name + ' '
   259             if t^.VType = vtCommand then SetLine(InputStr, '/' + t^.Name + ' ')
   260                                     else InputStr.s:= '$' + t^.Name + ' ';
   260                                     else SetLine(InputStr, '$' + t^.Name + ' ');
   261             exit
   261             exit
   262             end;
   262             end;
   263       t:= t^.Next
   263       t:= t^.Next
   264       end
   264       end
   265 end;
   265 end;
   269 var i, btw: integer;
   269 var i, btw: integer;
   270     utf8: shortstring;
   270     utf8: shortstring;
   271 begin
   271 begin
   272 if Key <> 0 then
   272 if Key <> 0 then
   273   case Key of
   273   case Key of
   274       8: if Length(InputStr.s)>0 then dec(InputStr.s[0]);
   274       8: if Length(InputStr.s) > 0 then
       
   275             begin
       
   276             dec(InputStr.s[0]);
       
   277             SetLine(InputStr, InputStr.s)
       
   278             end;
   275       9: AutoComplete;
   279       9: AutoComplete;
   276  13,271: begin
   280  13,271: begin
   277          if InputStr.s[1] in ['/', '$'] then
   281          if InputStr.s[1] in ['/', '$'] then
   278             ParseCommand(InputStr.s, false)
   282             ParseCommand(InputStr.s, false)
   279          else
   283          else
   280             ParseCommand('/say ' + InputStr.s, false);
   284             ParseCommand('/say ' + InputStr.s, false);
   281          InputStr.s:= ''
   285          SetLine(InputStr, '')
   282          end
   286          end
   283      else
   287      else
   284      if (Key < $80) then btw:= 1
   288      if (Key < $80) then btw:= 1
   285      else if (Key < $800) then btw:= 2
   289      else if (Key < $800) then btw:= 2
   286      else if (Key < $10000) then btw:= 3
   290      else if (Key < $10000) then btw:= 3