diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index e6585c3a16083d9c78d1527b367b37af043ea4b7..5fbd22bd73cb7ba0c30abe86b3d62d8b179c2121 100644 --- a/pd/src/g_editor.c +++ b/pd/src/g_editor.c @@ -6105,6 +6105,16 @@ void glob_key(void *dummy, t_symbol *s, int ac, t_atom *av) canvas_key(canvas_editing, s, ac, av); } +void glob_pastetext(void *dummy, t_symbol *s, int ac, t_atom *av) +{ + //fprintf(stderr,"glob_pastetext %s\n", s->s_name); + canvas_key(canvas_editing, s, ac-1, av+1); + if ((int)atom_getfloat(av) == 1) { + //fprintf(stderr,"force getscroll\n"); + sys_vgui("pdtk_canvas_force_getscroll .x%lx.c\n", canvas_editing); + } +} + void canvas_editmode(t_canvas *x, t_floatarg fyesplease) { //fprintf(stderr,"canvas_editmode %f\n", fyesplease); diff --git a/pd/src/m_glob.c b/pd/src/m_glob.c index 3a68e18914bd84197e89b89fed688341410d3ff9..7809f499da6df3758f56c108ade6778fcde9bffc 100644 --- a/pd/src/m_glob.c +++ b/pd/src/m_glob.c @@ -18,6 +18,7 @@ void glob_verifyquit(void *dummy, t_floatarg f); void glob_dsp(void *dummy, t_symbol *s, int argc, t_atom *argv); void glob_meters(void *dummy, t_floatarg f); void glob_key(void *dummy, t_symbol *s, int ac, t_atom *av); +void glob_pastetext(void *dummy, t_symbol *s, int ac, t_atom *av); void glob_audiostatus(void *dummy); void glob_finderror(t_pd *dummy); void glob_audio_properties(t_pd *dummy, t_floatarg flongform); @@ -99,6 +100,7 @@ void glob_init(void) class_addmethod(glob_pdobject, (t_method)glob_meters, gensym("meters"), A_FLOAT, 0); class_addmethod(glob_pdobject, (t_method)glob_key, gensym("key"), A_GIMME, 0); + class_addmethod(glob_pdobject, (t_method)glob_pastetext, gensym("pastetext"), A_GIMME, 0); class_addmethod(glob_pdobject, (t_method)glob_audiostatus, gensym("audiostatus"), 0); class_addmethod(glob_pdobject, (t_method)glob_finderror, diff --git a/pd/src/pd.tk b/pd/src/pd.tk index ae3dcd5b96e1d9ecb6326b9c53e4fffd2bca826c..079d87f76a057e1b78b3b10f34b5d3e66036f9c1 100644 --- a/pd/src/pd.tk +++ b/pd/src/pd.tk @@ -6637,7 +6637,15 @@ proc pdtk_pastetext {} { for {set i 0} {$i < [string length $pdtk_pastebuffer]} {incr i 1} { set cha [string index $pdtk_pastebuffer $i] scan $cha %c keynum - pd [concat pd key 1 $keynum 0\;] + if {$i == [expr [string length $pdtk_pastebuffer] - 1]} { + # unlike key command which would be pd [concat pd key 1 $keynum 0\;] + # we add first digit to ask for force getscroll as we limit the number of + # getscrolls we can get per second so last one is likely to be eaten up + # in the process + pd [concat pd pastetext 1 1 $keynum 0\;] + } else { + pd [concat pd pastetext 0 1 $keynum 0\;] + } } }