diff --git a/components/synedit/syncompletion.pas b/components/synedit/syncompletion.pas index b291fab031..6b306298b7 100644 --- a/components/synedit/syncompletion.pas +++ b/components/synedit/syncompletion.pas @@ -360,7 +360,10 @@ var end; begin - // update scrool bar +Writeln('[TSynBaseCompletionForm.Paint]'); + Writeln('ItemList.Count = '+inttostr(ItemList.Count)); + + // update scroll bar if ItemList.Count - NbLinesInWindow < 0 then Scroll.Max := 0 else @@ -375,27 +378,30 @@ begin Canvas.LineTo(Width - 1, Height - 1); Canvas.LineTo(0, Height - 1); Canvas.LineTo(0, 0); - - with bitmap do begin +//comments below are because canvas.draw is unfinished. +// with bitmap do begin canvas.pen.color := color; canvas.brush.color := color; canvas.Rectangle(0, 0, Width, Height); for i := 0 to min(NbLinesInWindow - 1, ItemList.Count - 1) do begin if i + Scroll.Position = Position then begin Canvas.Brush.Color := ClSelect; - Canvas.Pen.Color := ClSelect; + Canvas.Pen.Color := clSelect; Canvas.Rectangle(0, FFontHeight * i, width, FFontHeight * (i + 1)); - Canvas.Pen.Color := ClBlack; + Canvas.Pen.Color := clBlack; end else Canvas.Brush.Color := Color; if not Assigned(OnPaintItem) or not OnPaintItem(ItemList[Scroll.Position + i], Canvas, 0, FFontHeight * i) then - Canvas.TextOut(2, FFontHeight * i, ItemList[Scroll.Position + i]); + Begin + Writeln('Drawing to canvas'); + Canvas.TextOut(2, FFontHeight * i, ItemList[Scroll.Position + i]); + end; end; - end; - canvas.Draw(1, 1, bitmap); + //end; + //canvas.Draw(1, 1, bitmap); end; procedure TSynBaseCompletionForm.ScrollChange(Sender: TObject); @@ -506,6 +512,10 @@ end; procedure TSynBaseCompletion.Execute(s: string; x, y: integer); begin +Writeln('[TSynBaseComplete.Execute] '); +Writeln('s is '+s); +Writeln('X,Y is '+inttostr(x)+','+Inttostr(y)); + form.top := y; form.left := x; CurrentString := s; @@ -824,15 +834,23 @@ var s: string; i: integer; begin +Writeln('[TSynCompletion.GetPreviousToken]'); + if FEditor <> nil then begin s := FEditor.LineText; + Writeln('S = '+S); i := FEditor.CaretX - 1; + Writeln('I is '+inttostr(i)); + Writeln('Length(s) is= '+inttostr(length(s))); if i > length(s) then result := '' else begin - while (i > 0) and (s[i] > ' ') and (pos(s[i], FEndOfTokenChr) = 0) do - dec(i); + while (i > 0) and (s[i] > ' ') {commented out by shane and (pos(s[i], FEndOfTokenChr) = 0)} do + Begin + dec(i); + end; result := copy(s, i + 1, FEditor.CaretX - i - 1); + end; end else @@ -1025,6 +1043,8 @@ var i, j, prevspace: integer; StartOfBlock: tpoint; begin +Writeln('[TSynAutoComplete.Execute] '); +Writeln('Token is '+Token); i := AutoCompleteList.IndexOf(token); if i <> -1 then begin TRecordUsedToStoreEachEditorVars(fEditstuffs[fEditors.IndexOf(aEditor)]^).NoNextKey := true; diff --git a/ide/uniteditor.pp b/ide/uniteditor.pp index 7e6a0e49a7..6c0850ad21 100644 --- a/ide/uniteditor.pp +++ b/ide/uniteditor.pp @@ -136,6 +136,8 @@ type Procedure BookMarkToggle(Value : Integer); Procedure BookMarkGoto(Value : Integer); + Procedure ccExecute(Sender : TObject); + Procedure ProcessUserCommand(Sender: TObject; var Command: TSynEditorCommand; var AChar: char; Data: pointer); @@ -277,7 +279,7 @@ const var Editor_Num : Integer; aHighlighter: TSynPasSyn; - aCompletion : TSynCompletion; +aCompletion : TSynCompletion; { TSourceEditor } @@ -836,6 +838,19 @@ Begin EditorOpts.GetSynEditSettings(FEditor); end; +Procedure TSourceEditor.ccExecute(Sender : TObject); +var + scompl : TSynBaseCompletion; + S : TStrings; +Begin + Writeln('[ccExecute]'); + sCompl := TSynBaseCOmpletion(Sender); + S := TStringList.Create; + S.Add('constructor Create(aOwner : TComponent);'); + S.Add('OnActivate'); + sCompl.ItemList := S; +End; + Procedure TSourceEditor.CreateEditor(AOwner : TComponent; AParent: TWinControl); Begin @@ -876,7 +891,7 @@ Begin FSynAutoComplete.AddEditor(FEditor); RefreshEditorSettings; aCompletion.Editor := FEditor; - + aCompletion.OnExecute := @ccExecute; FEditor.Lines.Assign(FSource); FEditor.Setfocus end;