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

View File

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

View File

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