1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-12 04:15:07 -05:00

Turns out I did something wrong =D

This commit is contained in:
Niels 2010-06-03 16:35:33 +02:00
parent 60c7ebce58
commit 8265555e82
3 changed files with 20 additions and 18 deletions

View File

@ -187,12 +187,14 @@ begin
try
SynEdit.GetWordBoundsAtRowCol(SynEdit.CaretXY, sp, ep);
s := SynEdit.Lines[SynEdit.Carety-1];
if ep > length(s) then //We are outside the real text, go back to the last char
mp.Run(ms, nil, Synedit.SelStart - ep + length(s),false)
if (SynEdit.CaretY <= 0) or (SynEdit.CaretY > SynEdit.Lines.Count) then
s := ''
else
mp.Run(ms, nil, Synedit.SelStart + (ep - Synedit.CaretX) - 1,false);
mp.Position := SynEdit.SelStart + (ep - SynEdit.CaretX) - 1;
s := SynEdit.Lines[SynEdit.CaretY - 1];
if ep > length(s) then //We are outside the real text, go back to the last char
mp.Run(ms, nil, Synedit.SelStart + (Length(s) - Synedit.CaretX))
else
mp.Run(ms, nil, Synedit.SelStart + (ep - Synedit.CaretX) - 1);
d := mp.FindVarBase(mp.GetExpressionAtPos);
if (d <> nil) then
@ -278,15 +280,14 @@ begin
end;
end;
procedure TScriptFrame.SynEditKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure TScriptFrame.SynEditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if key = VK_F3 then
begin;
SimbaForm.ActionFindNextExecute(Sender);
key := 0;
end;
if key = VK_ESCAPE then
end
else if key = VK_ESCAPE then
SimbaForm.ParamHint.Hide;
SimbaForm.CodeCompletionForm.HandleKeyDown(Sender, Key, Shift);
@ -360,7 +361,7 @@ begin
if (SynEdit.CaretY <= 0) or (SynEdit.CaretY > SynEdit.Lines.Count) then
s := ''
else
s := SynEdit.Lines[SynEdit.Carety - 1];
s := SynEdit.Lines[SynEdit.CaretY - 1];
if ep > length(s) then //We are outside the real text, go back to the last char
mp.Run(ms, nil, Synedit.SelStart + (Length(s) - Synedit.CaretX) + 1)
else

View File

@ -5,7 +5,7 @@ interface
{$I ValistusDefines.inc}
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs,
Classes, SysUtils, Forms, Controls, Graphics,
StdCtrls, ExtCtrls, SynEdit, SynEditKeyCmds, v_ideCodeParser, v_ideCodeInsight,
{$IFDEF FPC}
@ -597,14 +597,12 @@ begin;
if EndPos.y = beginpos.y then
begin
result := copy(strings[beginpos.y], beginpos.x, endpos.x - beginpos.x + 1);
//ShowMessage(Result);
exit;
end;
result := copy(strings[beginpos.y],beginpos.x, length(strings[beginpos.y]) - beginpos.x + 1);
for i := beginpos.y + 1 to endpos.y-1 do
result := result + strings[i];
result := result + copy(strings[endpos.y], 1, endpos.x - 1); //Position <> count!
//ShowMessage(Result);
end;
function TParamHint.PrepareParamString(out Str: string; out MustHide : boolean): Integer;
@ -739,7 +737,6 @@ begin
inherited Destroy;
end;
constructor TParamHint.Create(TheOwner: TComponent);
begin
inherited;
@ -1007,9 +1004,13 @@ end;
procedure TParamHint.ApplicationIdle(Sender: TObject; var Done: Boolean);
begin
if not Visible then exit;
UpdateHint;
Sleep(1);
if (not Visible) then exit;
try
UpdateHint;
Sleep(1);
except
Hide;
end;
end;
end.

View File

@ -728,7 +728,7 @@ begin
if (EndPos > Length(s)) then
Result := ''
else
Result := CompressWhiteSpace(Copy(s, StartPos + 1, EndPos - StartPos - 1));
Result := CompressWhiteSpace(Copy(s, StartPos + 1, EndPos - StartPos));
end;
function TCodeInsight.GetExpressionAtPos(var BraceCount, BracketCount, CommaCount: Integer; IgnoreBrackets: Boolean = False): string;