From: terencehill Date: Tue, 27 Sep 2011 13:35:52 +0000 (+0200) Subject: If there's a caret before the cursor in the input box when clicking on the color... X-Git-Tag: xonotic-v0.8.0~251^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c091c111f71b8452f481f15714cbc1f3d5f1fb7e;p=xonotic%2Fxonotic-data.pk3dir.git If there's a caret before the cursor in the input box when clicking on the color picker, escape the caret so we can add a valid color code --- diff --git a/qcsrc/menu/xonotic/colorpicker.c b/qcsrc/menu/xonotic/colorpicker.c index df9620696..781ca9a44 100644 --- a/qcsrc/menu/xonotic/colorpicker.c +++ b/qcsrc/menu/xonotic/colorpicker.c @@ -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)