* Textarea bugs fixed 4.x-dev

Tue, 29 Jun 2021 14:48:55 +0300

author
cemkalyoncu
date
Tue, 29 Jun 2021 14:48:55 +0300
branch
4.x-dev
changeset 1697
2810cd4a843e
parent 1696
72dc4ad1399b
child 1698
b753c493202e

* Textarea bugs fixed

Source/Gorgon/Graphics/AdvancedPrinter.cpp file | annotate | diff | comparison | revisions
Source/Gorgon/Graphics/AdvancedPrinterImpl.h file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/Textarea.cpp file | annotate | diff | comparison | revisions
--- a/Source/Gorgon/Graphics/AdvancedPrinter.cpp	Mon Jun 28 11:42:00 2021 +0300
+++ b/Source/Gorgon/Graphics/AdvancedPrinter.cpp	Tue Jun 29 14:48:55 2021 +0300
@@ -72,6 +72,12 @@
             },
             text, l, 0, false
         );
+        
+        if(l.X > sz.Width)
+            sz.Width = l.X;
+
+        if(l.Y > sz.Height)
+            sz.Height = l.Y;
 
         return sz;
     }
@@ -84,27 +90,34 @@
             [&sz](
                 const GlyphRenderer &renderer, Glyph g,
                 const Geometry::Point &location, const RGBAf &, long
-                ) {
-            if(g != 0xffff) {
-                auto p = location + (Geometry::Point)renderer.GetSize(g) + renderer.GetOffset(g);
-                p.Y += int(renderer.GetBaseLine());
+            ) {
+                if(g != 0xffff) {
+                    auto p = location + (Geometry::Point)renderer.GetSize(g) + renderer.GetOffset(g);
+                    p.Y += int(renderer.GetBaseLine());
 
-                if(p.X > sz.Width)
-                    sz.Width = p.X;
+                    if(p.X > sz.Width)
+                        sz.Width = p.X;
 
-                if(p.Y > sz.Height)
-                    sz.Height = p.Y;
-            }
-            return true;
-        },
+                    if(p.Y > sz.Height)
+                        sz.Height = p.Y;
+                }
+                return true;
+            },
             [](const Geometry::Bounds &, const RGBAf &, int, RGBAf) {
-        },
+            },
             [](int, int, int, int, RGBAf) {
-        },
+            },
             [](Byte, const Geometry::Bounds &, const RGBAf &, bool) {
-        },
+            },
             text, l, width, true
-            );
+        );
+        
+        
+        if(l.X > sz.Width)
+            sz.Width = l.X;
+
+        if(l.Y > sz.Height)
+            sz.Height = l.Y;
 
         return sz;
     }
--- a/Source/Gorgon/Graphics/AdvancedPrinterImpl.h	Mon Jun 28 11:42:00 2021 +0300
+++ b/Source/Gorgon/Graphics/AdvancedPrinterImpl.h	Tue Jun 29 14:48:55 2021 +0300
@@ -932,7 +932,8 @@
             ind = acc.size();
             newline = ind == 0;
 
-            cur.Y += lineh;
+            if(nl != -1)
+                cur.Y += lineh;
 
             int nextlinexstart = location.X + indent + hangingindent * beginparag;
 
@@ -1075,7 +1076,7 @@
             //END
 
             //if requested do paragraph
-            if(beginparag)
+            if(nl != -1 && beginparag)
                 cur.Y += paragraphspacing(maxh, printer->GetParagraphSpacing());
 
             //BEGIN Reset
--- a/Source/Gorgon/Widgets/Textarea.cpp	Mon Jun 28 11:42:00 2021 +0300
+++ b/Source/Gorgon/Widgets/Textarea.cpp	Tue Jun 29 14:48:55 2021 +0300
@@ -696,7 +696,7 @@
         }
         
         if(text == "") {
-            stack.RemoveTagLocation(UI::ComponentTemplate::CaretTag);
+            stack.SetTagLocation(UI::ComponentTemplate::CaretTag, Geometry::Point{cursorlocation.X, cursorlocation.Y} - scrolloffset);
         }
         else {
             stack.SetTagLocation(UI::ComponentTemplate::CaretTag, Geometry::Point{cursorlocation.X, cursorlocation.Y} - scrolloffset);
@@ -741,8 +741,7 @@
         
         return byte;
     }
-
-
+    
     void Textarea::SetWordWrap(const bool &value) {
         if(wrap == value)
             return;

mercurial