View | Details | Raw Unified | Return to bug 16604
Collapse All | Expand All

(-)R-devel/src/unix/sys-std.c (+26 lines)
Lines 509-514 Link Here
509
  rl_vcpfunc_t *fun[MAX_READLINE_NESTING];
509
  rl_vcpfunc_t *fun[MAX_READLINE_NESTING];
510
} ReadlineStack = {-1, MAX_READLINE_NESTING - 1};
510
} ReadlineStack = {-1, MAX_READLINE_NESTING - 1};
511
511
512
/*
513
  Readline >= 6.3 no longer handles SIGWINCH outside of Readline code,
514
  so we need our own signal handler.
515
 */
516
static volatile int caught_sigwinch=0;
517
518
static RETSIGTYPE
519
R_readline_sigwinch_handler(int sig)
520
{
521
    caught_sigwinch=1;
522
}
512
523
513
/*
524
/*
514
  Registers the specified routine and prompt with readline
525
  Registers the specified routine and prompt with readline
Lines 523-528 Link Here
523
     ReadlineStack.fun[++ReadlineStack.current] = f;
534
     ReadlineStack.fun[++ReadlineStack.current] = f;
524
535
525
   rl_callback_handler_install(prompt, f);
536
   rl_callback_handler_install(prompt, f);
537
538
   signal(SIGWINCH, R_readline_sigwinch_handler);
539
   
526
   /* flush stdout in case readline wrote the prompt, but didn't flush
540
   /* flush stdout in case readline wrote the prompt, but didn't flush
527
      stdout to make it visible. (needed for Apple's rl in OS X 10.4-pre) */
541
      stdout to make it visible. (needed for Apple's rl in OS X 10.4-pre) */
528
   fflush(stdout);
542
   fflush(stdout);
Lines 921-926 Link Here
921
	    if (Rg_wait_usec > 0 && (wt < 0 || wt > Rg_wait_usec))
935
	    if (Rg_wait_usec > 0 && (wt < 0 || wt > Rg_wait_usec))
922
		wt = Rg_wait_usec;
936
		wt = Rg_wait_usec;
923
	    what = R_checkActivityEx(wt, 0, handleInterrupt);
937
	    what = R_checkActivityEx(wt, 0, handleInterrupt);
938
#ifdef HAVE_LIBREADLINE
939
            if (UsingReadline) {
940
		if(caught_sigwinch) {
941
		    caught_sigwinch=0;
942
		    rl_resize_terminal();
943
		    /* TODO: users may want to be able to register a
944
		     * function which modifies options("width") when
945
		     * we get here */
946
		}
947
            }
948
#endif
949
924
	    /* This is slightly clumsy. We have advertised the
950
	    /* This is slightly clumsy. We have advertised the
925
	     * convention that R_wait_usec == 0 means "wait forever",
951
	     * convention that R_wait_usec == 0 means "wait forever",
926
	     * but we also need to enable R_checkActivity to return
952
	     * but we also need to enable R_checkActivity to return

Return to bug 16604