]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
If there's a caret before the cursor in the input box when clicking on the color...
authorterencehill <piuntn@gmail.com>
Tue, 27 Sep 2011 13:35:52 +0000 (15:35 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 27 Sep 2011 13:35:52 +0000 (15:35 +0200)
qcsrc/menu/xonotic/colorpicker.c

index df9620696808337bf5e915f9bc8aa1f78e84fd7e..781ca9a44fb17460ee588a19ec97596ac2d90569 100644 (file)
@@ -117,6 +117,15 @@ float XonoticColorpicker_mouseDrag(entity me, vector coords)
                break;
        }
 
+       if(substring(me.controlledTextbox.text, i-1, 1) == "^")
+       {
+               carets = 1;
+               while (i - 1 - carets >= 0 && substring(me.controlledTextbox.text, i - 1 - carets, 1) == "^")
+                       ++carets;
+               if (carets == 1 || mod(carets, 2) == 1) // first check is just an optimization
+                       me.controlledTextbox.enterText(me.controlledTextbox, "^"); // escape previous caret
+       }
+
        vector margin;
        margin = me.imagemargin;
        if(coords_x >= margin_x)