MG: fixed wordcompletion and carettimer nonfocus bug

git-svn-id: trunk@311 -
This commit is contained in:
lazarus 2001-07-02 15:17:24 +00:00
parent ff39f433d9
commit 38adf9cc3c
4 changed files with 19 additions and 18 deletions

View File

@ -957,7 +957,7 @@ begin
fPassLinkerOpt := false;
fLinkerOptions := '';
fShowErrors := false;
fShowErrors := true;
fShowWarn := true;
fShowNotes := true;
fShowHints := true;

View File

@ -700,17 +700,17 @@ Begin
if TCustomSynEdit(Sender).ReadOnly=false then begin
CurrentCompletionType:=ctCodeCompletion;
TextS := FEditor.LineText;
i := FEditor.CaretX;
i := FEditor.CaretX - 1;
if i > length(TextS) then
TextS2 := ''
else begin
dec(i);
while (i > 0) and (TextS[i] in ['a'..'z','A'..'Z','0'..'9','_']) do
dec(i);
TextS2 := copy(TextS, i + 1, FEditor.CaretX - i - 1);
TextS2 := Trim(copy(TextS, i + 1, FEditor.CaretX - i - 1));
end;
with TCustomSynEdit(Sender) do
P := ClientToScreen(Point(CaretXPix - length('constructor ')*CharWidth
P := ClientToScreen(Point(CaretXPix - length(TextS2)*CharWidth
, CaretYPix + LineHeight));
aCompletion.Editor:=TCustomSynEdit(Sender);
aCompletion.Execute(TextS2,P.X,P.Y);
@ -1351,9 +1351,7 @@ begin
with aCompletion do
Begin
EndOfTokenChr:='()[]';
writeln('AAAA 1');
Width:=400;
writeln('AAAA 2');
OnExecute := @ccExecute;
OnCancel := @ccCancel;
OnCodeCompletion := @ccComplete;

View File

@ -117,12 +117,12 @@ begin
while (i>=0) and (AWordList.Count<MaxResults) do begin
NewWord:=FWordBuffer[i];
if CaseSensitive then begin
if copy(NewWord,1,PrefixLen)<>Prefix then
exit;
end else if uppercase(copy(NewWord,1,PrefixLen))<>UpPrefix then
exit
else if (NewWord=Prefix) then exit;
Add(NewWord);
if copy(NewWord,1,PrefixLen)=Prefix then
Add(NewWord);
end else if uppercase(copy(NewWord,1,PrefixLen))=UpPrefix then begin
if NewWord<>Prefix then
Add(NewWord)
end;
dec(i);
end;
if AWordList.Count>=MaxResults then exit;
@ -164,8 +164,8 @@ begin
if (j>PrefixLen) and (copy(LineText,x,i-x)<>Prefix) then
Add(copy(LineText,x,i-x))
end;
if AWordList.Count>=MaxResults then exit;
end;
if AWordList.Count>=MaxResults then exit;
x:=i;
end else
inc(x);

View File

@ -282,7 +282,6 @@ begin
WriteLn('WARNING: [GTKAPIWidgetClient_HideCaret] Got nil client');
Exit;
end;
Client^.Caret.Visible := False;
GTKAPIWidgetClient_DrawCaret(Client);
end;
@ -318,14 +317,14 @@ begin
end
else
if Visible
and gtk_widget_has_focus(PGTKWidget(Client))
and gtk_widget_has_focus(Widget)
and (not IsDrawn)
then begin
if Pixmap <> nil then
Assert(False, 'Trace:TODO: [GTKAPIWidgetClient_ShowCaret] Implement bitmap');
//Create backbitmap if needed
if BackPixmap = nil
if (BackPixmap = nil) and (Widget^.Window<>nil)
then BackPixmap := gdk_pixmap_new(Widget^.Window, Width, Height, -1);
if (BackPixmap <> nil) and (Widget<>nil) and ((Widget^.theStyle)<>nil)
@ -334,7 +333,7 @@ begin
PGTKStyle(Widget^.theStyle)^.bg_gc[GTK_STATE_NORMAL],
Widget^.Window, X, Y, 0, 0, Width, Height
);
// draw caret
if PGTKStyle(PGTKWidget(Client)^.theStyle)<>nil then
gdk_draw_rectangle(
@ -345,7 +344,8 @@ begin
IsDrawn := True;
end;
if Visible and Blinking and (Timer = 0) then
if Visible and Blinking and (Timer = 0) and gtk_widget_has_focus(Widget)
then
Timer := gtk_timeout_add(500, @GTKAPIWidgetClient_Timer, Client);
end;
end;
@ -574,6 +574,9 @@ end.
{ =============================================================================
$Log$
Revision 1.10 2001/07/02 15:17:24 lazarus
MG: fixed wordcompletion and carettimer nonfocus bug
Revision 1.9 2001/06/14 23:13:30 lazarus
MWE:
* Fixed some syntax errors for the latest 1.0.5 compiler