Author: titmuss
Date: Fri Apr 25 03:21:47 2008
New Revision: 2352
URL: http://svn.slimdevices.com?rev=2352&root=Jive&view=rev
Log:
Bug: N/A
Description:
Make textarea have a zero width,height when the content is nil.
Modified:
7.0/trunk/squeezeplay/src/squeezeplay/src/ui/jive_textarea.c
Modified: 7.0/trunk/squeezeplay/src/squeezeplay/src/ui/jive_textarea.c
URL:
http://svn.slimdevices.com/7.0/trunk/squeezeplay/src/squeezeplay/src/ui/jive_textarea.c?rev=2352&root=Jive&r1=2351&r2=2352&view=diff
==============================================================================
--- 7.0/trunk/squeezeplay/src/squeezeplay/src/ui/jive_textarea.c (original)
+++ 7.0/trunk/squeezeplay/src/squeezeplay/src/ui/jive_textarea.c Fri Apr 25
03:21:47 2008
@@ -93,6 +93,15 @@
}
peer = jive_getpeer(L, 1, &textareaPeerMeta);
+
+ if (peer->num_lines == 0) {
+ /* empty textarea */
+ lua_pushnil(L);
+ lua_pushnil(L);
+ lua_pushinteger(L, 0);
+ lua_pushinteger(L, 0);
+ return 4;
+ }
w = peer->w.bounds.w + peer->w.padding.left + peer->w.padding.right;
h = (peer->num_lines * peer->line_height) + peer->w.padding.top +
peer->w.padding.bottom;
@@ -184,8 +193,18 @@
/* word wrap text */
lua_getglobal(L, "tostring");
lua_getfield(L, 1, "text");
+ if (lua_isnil(L, -1)) {
+ /* nil is empty textarea */
+ lua_pop(L, 2);
+
+ peer->num_lines = 0;
+ lua_pushinteger(L, peer->num_lines);
+ lua_setfield(L, 1, "numLines");
+
+ return 0;
+ }
+
lua_call(L, 1, 1);
-
text = lua_tostring(L, -1);
visible_lines = peer->w.bounds.h / peer->line_height;
@@ -254,7 +273,7 @@
JiveSurface *srf = tolua_tousertype(L, 2, 0);
bool drawLayer = luaL_optinteger(L, 3, JIVE_LAYER_ALL) & peer->w.layer;
- if (!drawLayer) {
+ if (!drawLayer || peer->num_lines == 0) {
return 0;
}
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins