Subject: patch 5.4.x2 (was: patch: BeOS paste/acquire_sem_etc() problems)
From: Bram Moolenaar <[email-masked]>
To: Will Day <[email-masked]>
Cc: VIM Development Mailing List <[email-masked]>

------------

Will Day wrote:

> Attached is a patch to fix a problem I've been having with pasting in vim
> 5.4 under BeOS R4.5/x86.

Thanks for fixing this.  I was already wondering if someone was using Vim on
BeOS these days.

Since os_beos.c is in the extra archive, this will be an "x" patch.

Patch 5.4.x2
Problem:    BeOS: When pasting text, one character was moved to the end.
Solution:   Re-enable the BeOS code in fill_input_buf(), and fix timing out
	    with acquire_sem_etc(). (Will Day)
Files:	    src/os_beos.c, src/ui.c

*** ../vim-5.4/src/os_beos.c	Sun Jul 25 22:02:17 1999
--- src/os_beos.c	Sun Aug  8 14:04:49 1999
***************
*** 186,198 ****
  	    if (tmo == 0)
  		tmo = 1.0;
  	} else {
- 	    tmo = B_INFINITE_TIMEOUT;
  	    check_for_bebox();
  	}
  #if TRY_ABORT
  	release_sem(character_wanted);
  #endif
! 	acquired = acquire_sem_etc(character_present, 1, B_TIMEOUT, tmo);
  	if (acquired == B_NO_ERROR) {
  	    if (charcount > 0) {
  		add_to_input_buf(&charbuf, 1);
--- 186,200 ----
  	    if (tmo == 0)
  		tmo = 1.0;
  	} else {
  	    check_for_bebox();
  	}
  #if TRY_ABORT
  	release_sem(character_wanted);
  #endif
! 	if (timeout)
! 	    acquired = acquire_sem_etc(character_present, 1, B_TIMEOUT, tmo);
! 	else
! 	    acquired = acquire_sem(character_present);
  	if (acquired == B_NO_ERROR) {
  	    if (charcount > 0) {
  		add_to_input_buf(&charbuf, 1);
*** ../vim-5.4/src/ui.c	Sun Jul 25 22:02:19 1999
--- src/ui.c	Sun Aug  8 13:53:18 1999
***************
*** 1245,1261 ****
       * If we can't get any, and there isn't any in the buffer, we give up and
       * exit Vim.
       */
! /* make sure we have all macros defined... */
! # if defined(__BEOS__)
! #  ifndef B_BEOS_VERSION_4_5
! #   define B_BEOS_VERSION 4_5 0x0450
! #  endif
! # endif
! /* Genki (R4.5) doesn't seem to like the following (exits immediately on
!  * startup)
!  * [email-masked] Jul 99
!  */
! # if defined(__BEOS__) && B_BEOS_VERSION < B_BEOS_VERSION_4_5
      /*
       * On the BeBox version (for now), all input is secretly performed within
       * beos_select() which is called from RealWaitForChar().
--- 1245,1251 ----
       * If we can't get any, and there isn't any in the buffer, we give up and
       * exit Vim.
       */
! # ifdef __BEOS__
      /*
       * On the BeBox version (for now), all input is secretly performed within
       * beos_select() which is called from RealWaitForChar().

--
DENNIS: Look,  strange women lying on their backs in ponds handing out
        swords ... that's no basis for a system of government.  Supreme
        executive power derives from a mandate from the masses, not from some
        farcical aquatic ceremony.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

--/-/---- Bram Moolenaar ---- [email-masked] ---- [email-masked] ---\-\--
  \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /