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

Re: draw_part_cursor covered by subsequent draw_string?

Expand Messages
  • Bram Moolenaar
    ... Isn t this the cursor blinking? You can see in other GUI files that gui_mch_draw_part_cursor() just draws a rectangle, nothing more. E.g., in gui_x11.c.
    Message 1 of 4 , Jul 21, 2007
    • 0 Attachment
      Jjgod Jiang wrote:

      > I just find that in insert mode, every time vim tries to draw a
      > part cursor (to indicate the insertion point), there is a draw_string
      > call following it at exactly the same place, for example:
      >
      > 2007-07-21 05:02:50.293 Vim[9150] insertText: a
      > gui_mch_draw_string: (0, 8, 1)
      > 2007-07-21 05:02:50.294 Vim[9150] ' '
      > gui_mch_draw_string: (0, 8, 1)
      > 2007-07-21 05:02:50.294 Vim[9150] 'a'
      > gui_mch_draw_part_cursor: 3, 20 (0, 9)
      > gui_mch_draw_string: (0, 9, 1)
      > 2007-07-21 05:02:50.295 Vim[9150] ' '
      >
      > This trace means after I pressed 'a', there will be a draw_string call
      > to draw ' ' in column 8, then a draw_string call to call 'a' in column 8,
      > then a draw_part_cursor call to draw cursor in column 9, then a
      > draw_string call to draw ' ' in column 9.
      >
      > The problem is, if I draw the cursor in column 9, it will be fully
      > covered by the subsequence draw_string call in column 9, because
      > it will draw a space thus clear that rectangle with background color
      > again.
      >
      > I'm really curious about how is that getting solved by terminals and
      > other GUI port.

      Isn't this the cursor blinking?

      You can see in other GUI files that gui_mch_draw_part_cursor() just
      draws a rectangle, nothing more. E.g., in gui_x11.c. Nothing special,
      it seems.

      gui_mch_draw_string() has flags, one of them is DRAW_TRANSP. If that's
      present then the background is not to be erased.

      --
      Bypasses are devices that allow some people to dash from point A to
      point B very fast while other people dash from point B to point A very
      fast. People living at point C, being a point directly in between, are
      often given to wonder what's so great about point A that so many people
      from point B are so keen to get there and what's so great about point B
      that so many people from point A are so keen to get there. They often
      wish that people would just once and for all work out where the hell
      they wanted to be.
      -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ download, build and distribute -- http://www.A-A-P.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_mac" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Jjgod Jiang
      ... Cool, I forgot to handle this flag, it s OK now. But I just found a new problem about cursor blinking, every 4 seconds, gui_wait_for_chars will:
      Message 2 of 4 , Jul 21, 2007
      • 0 Attachment
        2007/7/21, Bram Moolenaar <Bram@...>:
        > gui_mch_draw_string() has flags, one of them is DRAW_TRANSP. If that's
        > present then the background is not to be erased.

        Cool, I forgot to handle this flag, it's OK now.

        But I just found a new problem about cursor blinking, every 4 seconds,
        gui_wait_for_chars will:

        gui_mch_start_blink();
        retval = gui_mch_wait_for_chars(wtime);
        gui_mch_stop_blink();

        So, when I was trying to implement cursor blinking, I got the following
        trace:

        2007-07-21 21:50:50.876 Vim[11594] gui_mch_start_blink
        2007-07-21 21:50:51.576 Vim[11594] blinkCursorTimer: BLINK_ON
        2007-07-21 21:50:51.827 Vim[11594] blinkCursorTimer: BLINK_OFF
        2007-07-21 21:50:52.228 Vim[11594] blinkCursorTimer: BLINK_ON
        2007-07-21 21:50:52.479 Vim[11594] blinkCursorTimer: BLINK_OFF
        2007-07-21 21:50:52.879 Vim[11594] blinkCursorTimer: BLINK_ON
        2007-07-21 21:50:53.130 Vim[11594] blinkCursorTimer: BLINK_OFF
        2007-07-21 21:50:53.531 Vim[11594] blinkCursorTimer: BLINK_ON
        2007-07-21 21:50:53.782 Vim[11594] blinkCursorTimer: BLINK_OFF
        2007-07-21 21:50:54.183 Vim[11594] blinkCursorTimer: BLINK_ON
        2007-07-21 21:50:54.434 Vim[11594] blinkCursorTimer: BLINK_OFF
        2007-07-21 21:50:54.835 Vim[11594] blinkCursorTimer: BLINK_ON
        2007-07-21 21:50:54.877 Vim[11594] gui_mch_stop_blink
        2007-07-21 21:50:54.878 Vim[11594] gui_mch_start_blink
        2007-07-21 21:50:55.578 Vim[11594] blinkCursorTimer: BLINK_ON
        2007-07-21 21:50:55.829 Vim[11594] blinkCursorTimer: BLINK_OFF
        2007-07-21 21:50:56.230 Vim[11594] blinkCursorTimer: BLINK_ON
        2007-07-21 21:50:56.481 Vim[11594] blinkCursorTimer: BLINK_OFF
        2007-07-21 21:50:56.882 Vim[11594] blinkCursorTimer: BLINK_ON
        2007-07-21 21:50:57.132 Vim[11594] blinkCursorTimer: BLINK_OFF
        2007-07-21 21:50:57.533 Vim[11594] blinkCursorTimer: BLINK_ON
        2007-07-21 21:50:57.784 Vim[11594] blinkCursorTimer: BLINK_OFF
        2007-07-21 21:50:58.185 Vim[11594] blinkCursorTimer: BLINK_ON
        2007-07-21 21:50:58.436 Vim[11594] blinkCursorTimer: BLINK_OFF
        2007-07-21 21:50:58.837 Vim[11594] blinkCursorTimer: BLINK_ON
        2007-07-21 21:50:58.893 Vim[11594] gui_mch_stop_blink
        2007-07-21 21:50:58.895 Vim[11594] gui_mch_start_blink

        It means, for example, in 2007-07-21 21:50:54.835, blinkCursorTimer is
        getting called, it finds out that current blink_state is BLINK_ON, so it
        will undraw the cursor, then create a new timer to be fired after 0.25
        second, but only after 0.04 second, in 2007-07-21 21:50:54.878,
        gui_mch_start_blink will cause the cursor to show up again, until
        0.7 second (blink_wait time) later, it's turned off.

        Because the regular cursor off time is 0.25 second, the 0.04 second
        off time caused by gui_mch_start_blink will make cursor looked like
        a flash, which is inconsistent with the regular on and off, on and off
        period.

        Do you aware of if there is a solution to avoid this inconsistency?

        - Jiang

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_mac" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Bram Moolenaar
        ... I m glad you found it. ... I would not worry about this. This is in the generic GUI code. It is probably caused by the updatetime option. -- If they
        Message 3 of 4 , Jul 21, 2007
        • 0 Attachment
          Jjgod Jiang wrote:

          > 2007/7/21, Bram Moolenaar <Bram@...>:
          > > gui_mch_draw_string() has flags, one of them is DRAW_TRANSP. If that's
          > > present then the background is not to be erased.
          >
          > Cool, I forgot to handle this flag, it's OK now.

          I'm glad you found it.

          > But I just found a new problem about cursor blinking, every 4 seconds,
          > gui_wait_for_chars will:
          >
          > gui_mch_start_blink();
          > retval = gui_mch_wait_for_chars(wtime);
          > gui_mch_stop_blink();
          >
          > So, when I was trying to implement cursor blinking, I got the following
          > trace:
          >
          > 2007-07-21 21:50:50.876 Vim[11594] gui_mch_start_blink
          > 2007-07-21 21:50:51.576 Vim[11594] blinkCursorTimer: BLINK_ON
          > 2007-07-21 21:50:51.827 Vim[11594] blinkCursorTimer: BLINK_OFF
          > 2007-07-21 21:50:52.228 Vim[11594] blinkCursorTimer: BLINK_ON
          > 2007-07-21 21:50:52.479 Vim[11594] blinkCursorTimer: BLINK_OFF
          > 2007-07-21 21:50:52.879 Vim[11594] blinkCursorTimer: BLINK_ON
          > 2007-07-21 21:50:53.130 Vim[11594] blinkCursorTimer: BLINK_OFF
          > 2007-07-21 21:50:53.531 Vim[11594] blinkCursorTimer: BLINK_ON
          > 2007-07-21 21:50:53.782 Vim[11594] blinkCursorTimer: BLINK_OFF
          > 2007-07-21 21:50:54.183 Vim[11594] blinkCursorTimer: BLINK_ON
          > 2007-07-21 21:50:54.434 Vim[11594] blinkCursorTimer: BLINK_OFF
          > 2007-07-21 21:50:54.835 Vim[11594] blinkCursorTimer: BLINK_ON
          > 2007-07-21 21:50:54.877 Vim[11594] gui_mch_stop_blink
          > 2007-07-21 21:50:54.878 Vim[11594] gui_mch_start_blink
          > 2007-07-21 21:50:55.578 Vim[11594] blinkCursorTimer: BLINK_ON
          > 2007-07-21 21:50:55.829 Vim[11594] blinkCursorTimer: BLINK_OFF
          > 2007-07-21 21:50:56.230 Vim[11594] blinkCursorTimer: BLINK_ON
          > 2007-07-21 21:50:56.481 Vim[11594] blinkCursorTimer: BLINK_OFF
          > 2007-07-21 21:50:56.882 Vim[11594] blinkCursorTimer: BLINK_ON
          > 2007-07-21 21:50:57.132 Vim[11594] blinkCursorTimer: BLINK_OFF
          > 2007-07-21 21:50:57.533 Vim[11594] blinkCursorTimer: BLINK_ON
          > 2007-07-21 21:50:57.784 Vim[11594] blinkCursorTimer: BLINK_OFF
          > 2007-07-21 21:50:58.185 Vim[11594] blinkCursorTimer: BLINK_ON
          > 2007-07-21 21:50:58.436 Vim[11594] blinkCursorTimer: BLINK_OFF
          > 2007-07-21 21:50:58.837 Vim[11594] blinkCursorTimer: BLINK_ON
          > 2007-07-21 21:50:58.893 Vim[11594] gui_mch_stop_blink
          > 2007-07-21 21:50:58.895 Vim[11594] gui_mch_start_blink
          >
          > It means, for example, in 2007-07-21 21:50:54.835, blinkCursorTimer is
          > getting called, it finds out that current blink_state is BLINK_ON, so it
          > will undraw the cursor, then create a new timer to be fired after 0.25
          > second, but only after 0.04 second, in 2007-07-21 21:50:54.878,
          > gui_mch_start_blink will cause the cursor to show up again, until
          > 0.7 second (blink_wait time) later, it's turned off.
          >
          > Because the regular cursor off time is 0.25 second, the 0.04 second
          > off time caused by gui_mch_start_blink will make cursor looked like
          > a flash, which is inconsistent with the regular on and off, on and off
          > period.
          >
          > Do you aware of if there is a solution to avoid this inconsistency?

          I would not worry about this. This is in the generic GUI code. It is
          probably caused by the 'updatetime' option.

          --
          If they don't keep on exercising their lips, he thought, their brains
          start working.
          -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
          /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
          \\\ download, build and distribute -- http://www.A-A-P.org ///
          \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_mac" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        Your message has been successfully submitted and would be delivered to recipients shortly.