From a791fe5290e434b90354086df3c5c45fc76c940e Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 24 Jul 2008 16:37:09 +0200 Subject: [PATCH] tag: allow for tag name modification Signed-off-by: Julien Danjou --- tag.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tag.c b/tag.c index c09f5392..2497dfad 100644 --- a/tag.c +++ b/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);