tag: allow for tag name modification
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
f5f0663bf1
commit
a791fe5290
14
tag.c
14
tag.c
|
@ -406,6 +406,20 @@ luaA_tag_newindex(lua_State *L)
|
|||
|
||||
switch(a_tokenize(attr, len))
|
||||
{
|
||||
case A_TK_NAME:
|
||||
buf = luaL_checklstring(L, 3, &len);
|
||||
if((*tag)->screen != TAG_SCREEN_UNDEF)
|
||||
{
|
||||
tag_array_t *tags = &globalconf.screens[(*tag)->screen].tags;
|
||||
for(i = 0; i < tags->len; i++)
|
||||
if(tags->tab[i] != *tag && !a_strcmp(buf, tags->tab[i]->name))
|
||||
luaL_error(L, "a tag with the name `%s' is already on screen %d",
|
||||
buf, (*tag)->screen);
|
||||
}
|
||||
p_delete(&(*tag)->name);
|
||||
a_iso2utf8(&(*tag)->name, buf, len);
|
||||
widget_invalidate_cache((*tag)->screen, WIDGET_CACHE_TAGS);
|
||||
break;
|
||||
case A_TK_LAYOUT:
|
||||
buf = luaL_checkstring(L, 3);
|
||||
l = name_func_lookup(buf, LayoutList);
|
||||
|
|
Loading…
Reference in New Issue