Johann ELSASS 1 год назад
Родитель
Сommit
8655ac1a87
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      lazpaint/tools/utooltext.pas

+ 7 - 1
lazpaint/tools/utooltext.pas

@@ -222,7 +222,9 @@ var
   alignBefore: TAlignment;
   alignBefore: TAlignment;
 begin
 begin
   if FShape is TTextShape then
   if FShape is TTextShape then
-    alignBefore := (FShape as TTextShape).ParagraphAlignment;
+    alignBefore := (FShape as TTextShape).ParagraphAlignment
+  else
+    alignBefore := taLeftJustify;
   if Key = VK_SPACE then
   if Key = VK_SPACE then
   begin
   begin
     keyUtf8:= ' ';
     keyUtf8:= ' ';
@@ -232,7 +234,10 @@ begin
   if (Key = VK_ESCAPE) and Assigned(FShape) then
   if (Key = VK_ESCAPE) and Assigned(FShape) then
   begin
   begin
     if FShape.Usermode = vsuEditText then
     if FShape.Usermode = vsuEditText then
+    begin
+      result := EmptyRect;
       FShape.Usermode := vsuEdit
       FShape.Usermode := vsuEdit
+    end
     else
     else
       result := ValidateShape;
       result := ValidateShape;
     Key := 0;
     Key := 0;
@@ -240,6 +245,7 @@ begin
   if (Key = VK_RETURN) and Assigned(FShape) then
   if (Key = VK_RETURN) and Assigned(FShape) then
   begin
   begin
     handled := false;
     handled := false;
+    result := EmptyRect;
     FShape.KeyDown(ShiftState, skReturn, handled);
     FShape.KeyDown(ShiftState, skReturn, handled);
     if not handled then ValidateShape;
     if not handled then ValidateShape;
     Key := 0;
     Key := 0;