Loading ...
Sorry, an error occurred while loading the content.

Re: Porting Vim to new platform: problem with terminal

Expand Messages
  • Bram Moolenaar
    ... You should use the time argument here. If it s a small number, like 100 or 1000, then mch_inchar() should not block. Only when time is -1
    Message 1 of 3 , Feb 4, 2004
    • 0 Attachment
      Oscar Fuentes wrote:

      > I'm porting Vim 5.5 to EPOC R5 using the EpocEmx development kit, wich
      > provides a terminal emulating the vt100.
      > This is a sample sesion that shows the problem:
      > start vim without vim_rc file
      > press 'a'.
      > press 'h' 3 times. Nothing is shown.
      > press ESC. Now the screen shows 'hhh', with the cursor under the third 'h'.
      > press ESC again. Nothing happens.
      > press ESC again. Beep.
      > press ':'. Beep. An ':' appears on the right place.
      > press 'q', then '!'. A 'q!' appears as nornal.
      > press Enter. Vim exits.
      > This is with a vim_rc file that sets nocompatible:
      > press 'a'.
      > press 'h'. The modeline changes to "-- INSERT --". No 'h' is shown.
      > press two more times 'h'. Nothing changes on the terminal.
      > press ESC. Nothing changes.
      > press ESC again. The "-- INSERT --" dissappears and the 'h's we wrote
      > appears on the screen.
      > press ':'. Beep. No ':' is shown on the command line.
      > press 'q'. On the command line ':q' is shown.
      > press '!'. Now the command line shows ':q!'
      > pres Enter. Vim exits.
      > Seems that Vim is holding characters somewhere before they take
      > effect.
      > The os_epoc.c file is simplistic to the maximum. These are the
      > terminal I/O functions:
      > int
      > mch_inchar(
      > char_u *buf,
      > int maxlen,
      > long time)
      > {
      > buf[0] = ttgetc();
      > buf[1] = '\0';
      > return 1;
      > }
      > 'ttgetc' simply waits until a key is pressed and returns its code. It
      > doesn't work for cursor keys, PgDn/PgUp, etc but that is not a
      > problem yet.

      You should use the "time" argument here. If it's a small number, like
      100 or 1000, then mch_inchar() should not block. Only when "time" is -1
      mch_inchar() may block. In your situation you might want to return 0
      whenever "time" is >= 0.

      There will still be a problem: when 'timeoutlen' is 1000 Vim will not
      wait a second for a mapping to complete. If this system has some
      polling function and a delay function you should use that. Perhaps
      os_amiga.c is a good example for you.

      I suggest you have a good look at the other os_*.c files to find out how
      they implemented the machine specific functions.

      hundred-and-one symptoms of being an internet addict:
      37. You start looking for hot HTML addresses in public restrooms.

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
      \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
    Your message has been successfully submitted and would be delivered to recipients shortly.