diff options
author | Miller Puckette <millerpuckette@users.sourceforge.net> | 2009-01-06 19:36:42 +0000 |
---|---|---|
committer | Miller Puckette <millerpuckette@users.sourceforge.net> | 2009-01-06 19:36:42 +0000 |
commit | f06fe8bef4964656f56975a97b448c1c788e7cf3 (patch) | |
tree | 553d06df3e28c41e45e2cdc2c31ff17ad7e0f303 /pd/src/g_text.c | |
parent | e60dbadb4745a209901a7ce30235e75f805ae6a0 (diff) |
0.42-2 (bug fixes)
svn path=/trunk/; revision=10477
Diffstat (limited to 'pd/src/g_text.c')
-rw-r--r-- | pd/src/g_text.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/pd/src/g_text.c b/pd/src/g_text.c index 30184fcf..b8680e87 100644 --- a/pd/src/g_text.c +++ b/pd/src/g_text.c @@ -136,23 +136,39 @@ static void canvas_objtext(t_glist *gl, int xpix, int ypix, int selected, static void canvas_howputnew(t_canvas *x, int *connectp, int *xpixp, int *ypixp, int *indexp, int *totalp) { - int xpix, ypix, indx = 0, nobj = 0, x1, x2, y1, y2; + int xpix, ypix, indx = 0, nobj = 0, n2, x1, x2, y1, y2; int connectme = (x->gl_editor->e_selection && !x->gl_editor->e_selection->sel_next); if (connectme) { - t_gobj *g; + t_gobj *g, *selected = x->gl_editor->e_selection->sel_what; for (g = x->gl_list, nobj = 0; g; g = g->g_next, nobj++) - if (g == x->gl_editor->e_selection->sel_what) + if (g == selected) { gobj_getrect(g, x, &x1, &y1, &x2, &y2); indx = nobj; *xpixp = x1; *ypixp = y2 + 5; } + glist_noselect(x); + /* search back for 'selected' and if it isn't on the list, + plan just to connect from the last item on the list. */ + for (g = x->gl_list, n2 = 0; g; g = g->g_next, n2++) + { + if (g == selected) + { + indx = n2; + break; + } + else if (!g->g_next) + indx = nobj-1; + } + } + else + { + glist_getnextxy(x, xpixp, ypixp); + glist_noselect(x); } - else glist_getnextxy(x, xpixp, ypixp); - glist_noselect(x); *connectp = connectme; *indexp = indx; *totalp = nobj; |