textbox: allow nil as value for text
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
905d8e78a1
commit
57b7d39cdb
|
@ -137,18 +137,20 @@ luaA_textbox_index(lua_State *L, awesome_token_t token)
|
||||||
static int
|
static int
|
||||||
luaA_textbox_newindex(lua_State *L, awesome_token_t token)
|
luaA_textbox_newindex(lua_State *L, awesome_token_t token)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len = 0;
|
||||||
widget_t **widget = luaA_checkudata(L, 1, "widget");
|
widget_t **widget = luaA_checkudata(L, 1, "widget");
|
||||||
const char *buf;
|
const char *buf = NULL;
|
||||||
textbox_data_t *d = (*widget)->data;
|
textbox_data_t *d = (*widget)->data;
|
||||||
|
|
||||||
switch(token)
|
switch(token)
|
||||||
{
|
{
|
||||||
case A_TK_TEXT:
|
case A_TK_TEXT:
|
||||||
if((buf = luaL_checklstring(L, 3, &len)))
|
if(lua_isnil(L, 3)
|
||||||
|
|| (buf = luaL_checklstring(L, 3, &len)))
|
||||||
{
|
{
|
||||||
p_delete(&d->text);
|
p_delete(&d->text);
|
||||||
a_iso2utf8(&d->text, buf, len);
|
if(buf)
|
||||||
|
a_iso2utf8(&d->text, buf, len);
|
||||||
d->len = len;
|
d->len = len;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue