From 64fdb009695828b788fce074135b20a5e52c5fc4 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Tue, 23 Sep 2003 00:21:28 +0000 Subject: imported version 0.37-0 svn path=/trunk/; revision=1016 --- pd/src/g_rtext.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'pd/src/g_rtext.c') diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c index ee894b7e..aeeb5dfd 100644 --- a/pd/src/g_rtext.c +++ b/pd/src/g_rtext.c @@ -229,7 +229,13 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp, sys_vgui(".x%x.c select from %s %d\n", canvas, x->x_tag, x->x_selstart); sys_vgui(".x%x.c select to %s %d\n", canvas, - x->x_tag, x->x_selend); + x->x_tag, x->x_selend +#if defined (MSW) || defined(MACOSX) + /* Why is linux selecting text differently from MSW and OSX??? + Just adjust it here... LATER revisit this one */ + -1 +#endif + ); sys_vgui(".x%x.c focus \"\"\n", canvas); } else @@ -385,18 +391,23 @@ void rtext_key(t_rtext *x, int keynum, t_symbol *keysym) { int n = keynum; if (n == '\r') n = '\n'; - if (n == '\b') + if (n == '\b') /* backspace */ { - if ((!x->x_selstart) && (x->x_selend == x->x_bufsize)) + /* LATER delete the box if all text is selected... + this causes reentrancy problems now. */ + /* if ((!x->x_selstart) && (x->x_selend == x->x_bufsize)) { - /* LATER delete the box... this causes reentrancy - problems now. */ - /* glist_delete(x->x_glist, &x->x_text->te_g); */ - return; - } - else if (x->x_selstart && (x->x_selstart == x->x_selend)) + .... + } */ + if (x->x_selstart && (x->x_selstart == x->x_selend)) x->x_selstart--; } + else if (n == 127) /* delete */ + { + if (x->x_selend < x->x_bufsize && (x->x_selstart == x->x_selend)) + x->x_selend++; + } + ndel = x->x_selend - x->x_selstart; for (i = x->x_selend; i < x->x_bufsize; i++) x->x_buf[i- ndel] = x->x_buf[i]; -- cgit v1.2.1