]> asedeno.scripts.mit.edu Git - PuTTY_svn.git/commitdiff
Remove the timed part of the terminal paste mechanism.
authorSimon Tatham <anakin@pobox.com>
Sun, 15 Sep 2013 14:05:38 +0000 (14:05 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 15 Sep 2013 14:05:38 +0000 (14:05 +0000)
In r10020 I carefully reimplemented using timing.c and callback.c the
same policy for large pastes that the previous code appeared to be
implementing ad-hoc, which included a 450ms delay between sending
successive lines of pasted text if no visible acknowledgment of the
just-sent line (in the form of a \n or \r) came back from the
application.

However, it turns out that that *wasn't* what the old code was doing.
It *would* have done that, but for the bug that it never actually set
the 'last_paste' variable, and never has done since it was first
introduced way back in r516! So the policy I thought had been in force
forever has in fact only been in force since I unwittingly fixed that
bug in r10020 - and it turns out to be a bad idea, breaking pastes
into vi in particular.

So I've removed the timed paste code completely, on the basis that
it's never actually worked and nobody seems to have been unhappy about
that. Now we still break large pastes into separate lines and send
them in successive top-level callbacks, and the user can still press a
key to interrupt a paste if they manage to catch it still going on,
but there's no attempted *delay* any more.

(It's possible that what I *really* ought to be doing is calling
back->sendbuffer() to see whether the backend is consuming the data
pasted so far, and if not, deferring the rest of the paste until the
send buffer becomes smaller. Then we could have pasting be delayed by
back-pressure from the recipient, and still manually interruptible
during that delay, but not have it delayed by anything else. But what
we have here should at least manage to be equivalent to the *actual*
rather than the intended old policy.)

git-svn-id: http://svn.tartarus.org/sgt/putty@10041 cda61777-01e9-0310-a592-d414129be87e

terminal.c
terminal.h

index e7095e0c2db2cf7e7a9e248e699de64ceb944e9d..d6a754c916faace187bb6347933006b6cb521498 100644 (file)
@@ -109,9 +109,6 @@ static void scroll(Terminal *, int, int, int, int);
 #ifdef OPTIMISE_SCROLL
 static void scroll_display(Terminal *, int, int, int);
 #endif /* OPTIMISE_SCROLL */
-static void term_resume_pasting(Terminal *term);
-static void term_paste_callback(void *vterm);
-static void term_paste_queue(Terminal *term, int timed);
 
 static termline *newline(Terminal *term, int cols, int bce)
 {
@@ -2969,7 +2966,6 @@ static void term_out(Terminal *term)
                term->curs.x = 0;
                term->wrapnext = FALSE;
                seen_disp_event(term);
-                term_resume_pasting(term);
 
                if (term->crhaslf) {
                    if (term->curs.y == term->marg_b)
@@ -3000,7 +2996,6 @@ static void term_out(Terminal *term)
                    term->curs.x = 0;
                term->wrapnext = FALSE;
                seen_disp_event(term);
-                term_resume_pasting(term);
                if (term->logctx)
                    logtraffic(term->logctx, (unsigned char) c, LGTYP_ASCII);
                break;
@@ -5708,48 +5703,6 @@ static void sel_spread(Terminal *term)
     }
 }
 
-static void term_resume_pasting(Terminal *term)
-{
-    expire_timer_context(&term->paste_timer_ctx);
-    term_paste_queue(term, FALSE);
-}
-
-static void term_paste_timing_callback(void *vterm, unsigned long now)
-{
-    Terminal *term = *(Terminal **)vterm;
-    term_resume_pasting(term);
-}
-
-static void term_paste_queue(Terminal *term, int timed)
-{
-    if (timed) {
-        /*
-         * Delay sending the rest of the paste buffer until we have
-         * seen a newline coming back from the server (indicating that
-         * it's absorbed the data we've sent so far). As a fallback,
-         * continue sending anyway after a longish timeout.
-         *
-         * We use the pointless structure field term->paste_timer_ctx
-         * (which is a Terminal *, and we'll make sure it points
-         * straight back to term) as our timer context, so that it can
-         * be distinguished from term itself. That way, if we see a
-         * reason to continue pasting before the timer goes off, we
-         * can cancel just this timer and none of the other terminal
-         * timers handling display updates, blinking text and cursor,
-         * and visual bells.
-         */
-        term->paste_timer_ctx = term;
-        schedule_timer(450, term_paste_timing_callback,
-                       &term->paste_timer_ctx);
-    } else {
-        /*
-         * Just arrange to call term_paste_callback from the top level
-         * at the next opportunity.
-         */
-        queue_toplevel_callback(term_paste_callback, term);
-    }
-}
-
 static void term_paste_callback(void *vterm)
 {
     Terminal *term = (Terminal *)vterm;
@@ -5768,7 +5721,7 @@ static void term_paste_callback(void *vterm)
        term->paste_pos += n;
 
        if (term->paste_pos < term->paste_len) {
-            term_paste_queue(term, TRUE);
+            queue_toplevel_callback(term_paste_callback, term);
            return;
        }
     }
@@ -5838,7 +5791,7 @@ void term_do_paste(Terminal *term)
     }
     get_clip(term->frontend, NULL, NULL);
 
-    term_paste_queue(term, FALSE);
+    queue_toplevel_callback(term_paste_callback, term);
 }
 
 void term_mouse(Terminal *term, Mouse_Button braw, Mouse_Button bcooked,
@@ -6125,7 +6078,6 @@ void term_nopaste(Terminal *term)
 {
     if (term->paste_len == 0)
        return;
-    expire_timer_context(&term->paste_timer_ctx);
     sfree(term->paste_buffer);
     term->paste_buffer = NULL;
     term->paste_len = 0;
index 9f0561124c0bfff58ab0534ba882ce94182caba1..135ef45a6ce9636f9e3f4d06055905bd952e7dc0 100644 (file)
@@ -223,7 +223,6 @@ struct terminal_tag {
 
     wchar_t *paste_buffer;
     int paste_len, paste_pos;
-    Terminal *paste_timer_ctx;
 
     void (*resize_fn)(void *, int, int);
     void *resize_ctx;