To: vim-dev@vim.org Subject: Patch 6.1.414 (extra) Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.414 (extra, depends on 6.1.369) Problem: VMS: Vim busy waits when waiting for input. Solution: Delay for a short while before getting another character. (Zoltan Arpadffy) Files: src/os_vms.c *** ../vim61.413/src/os_vms.c Sun Mar 9 14:08:43 2003 --- src/os_vms.c Tue Mar 25 21:36:13 2003 *************** *** 296,339 **** * * Returns: input length */ - int vms_read(char *inbuf, size_t nbytes) { - - static unsigned short add_esc, was_esc = 0; - char ibuf[nbytes]; int status, function, len; TT_MODE tt_mode; /* whatever happened earlier we need an iochan here */ if (!iochan) ! tt_mode=get_tty(); ! function = ( IO$_READLBLK | IO$M_NOECHO | IO$M_TIMED ) ; ! len=0; ! add_esc=0; ! while(1) { ! memset(ibuf,0,sizeof(ibuf)); ! status = sys$qiow(0,iochan,function,&iosb,0,0,&ibuf,nbytes-1,0,0,0,0); ! len=strlen( ibuf ); ! if ( was_esc ) { /* ESC interrupts the BLOCK QIO */ ! add_esc=1; /* therefore we need to handle */ ! was_esc=0; /* it on special way in order to */ ! inbuf[0]=27; /* read ESC sequences */ ! } ! if ( len>0 ){ ! if ( ibuf[len-1]==27 ){ ! was_esc=1; ! len=len-1; ! } ! mch_memmove(inbuf+add_esc, ibuf, len); } ! if ((add_esc+len) > 0) break; } ! return add_esc+len; } /* --- 296,328 ---- * * Returns: input length */ int vms_read(char *inbuf, size_t nbytes) { char ibuf[nbytes]; int status, function, len; + float wait = 0.05; TT_MODE tt_mode; /* whatever happened earlier we need an iochan here */ if (!iochan) ! tt_mode = get_tty(); ! function = (IO$_READLBLK | IO$M_NOECHO | IO$M_TIMED | IO$M_ESCAPE); ! memset(ibuf, 0, sizeof(ibuf)); ! while (1) ! { ! status = sys$qiow(0,iochan,function,&iosb,0,0,&ibuf,nbytes,0,0,0,0); ! len = strlen(ibuf); ! if (len > 0) ! { ! mch_memmove(inbuf, ibuf, len); ! break; } ! lib$wait(&wait); } ! return len; } /* *** ../vim61.413/src/version.c Sun Mar 23 21:06:00 2003 --- src/version.c Tue Mar 25 21:38:08 2003 *************** *** 613,614 **** --- 613,616 ---- { /* Add new patch number below this line */ + /**/ + 414, /**/ -- "You mean there really is an answer?" "Yes! But you're not going to like it!" "Oh do please tell us!" "You're really not going to like it!" "but we MUST know - tell us" "Alright, the answer is...." "yes..." "... is ..." "yes... come on!" "is 42!" (Douglas Adams - The Hitchhiker's Guide to the Galaxy) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///