diff --git a/pd/src/g_text.c b/pd/src/g_text.c index b7363b4c3f15c2f4ad2edf607933045be01d25de..65c6d99bf9d585a9391bdb92d73c6d5c546f3ade 100644 --- a/pd/src/g_text.c +++ b/pd/src/g_text.c @@ -1112,7 +1112,7 @@ static void gatom_key(void *z, t_floatarg f) { t_gatom *x = (t_gatom *)z; int c = f; - //post("gatom_key <%c> %d", c, x->a_shift); + //post("gatom_key %f %d", f, x->a_shift); int len = strlen(x->a_buf); t_atom at; char sbuf[ATOMBUFSIZE + 4]; @@ -1139,7 +1139,11 @@ static void gatom_key(void *z, t_floatarg f) else if (x->a_atom.a_type == A_SYMBOL) { //post("gatom_key release"); - if (strcmp(x->a_buf, x->a_atom.a_w.w_symbol->s_name)) + // ico@vt.edu 20200923: we also check for empty a_buf to ensure that + // the ... is deleted. This was created when the object was originally + // clicked on below, but only if the current gatom is symbol type and + // is empty. + if (x->a_buf[0] == 0 || strcmp(x->a_buf, x->a_atom.a_w.w_symbol->s_name)) { strcpy(x->a_buf, x->a_atom.a_w.w_symbol->s_name); gatom_retext(x, 1, 1); @@ -1256,6 +1260,16 @@ static void gatom_click(t_gatom *x, return; } x->a_shift = shift; + if (x->a_atom.a_type == A_SYMBOL && !strlen(x->a_atom.a_w.w_symbol->s_name)) + { + char sbuf[ATOMBUFSIZE + 4]; + t_atom at; + sprintf(sbuf, "%s...", x->a_buf); + SETSYMBOL(&at, gensym(sbuf)); + binbuf_clear(x->a_text.te_binbuf); + binbuf_add(x->a_text.te_binbuf, 1, &at); + glist_retext(x->a_glist, &x->a_text); + } glist_grab(x->a_glist, &x->a_text.te_g, gatom_motion, gatom_key, xpos, ypos); //post("a_shift_clicked=%d", x->a_shift_clicked);