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

Re: unexpected screen redraw in complete function

Expand Messages
  • KKde
    ... Can someone please help on this?? Regards, Kkde -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the text
    Message 1 of 8 , Jul 10, 2010
      > > Have you tried using winsaveview() before moving the cursor around and
      > > then winrestview()?
      >
      > As per the help manual (:he complete-functions)
      > "The function is allowed to move the cursor, it is restored
      > afterwards.  This
      > option cannot be set from a |modeline| or in the |sandbox|, for
      > security
      > reasons."
      >
      > so wouldn't it be the job of 'complete functions' to restore the
      > cursor?
      >

      Can someone please help on this??

      Regards,
      Kkde

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • KKde
      Can someone please help on this? Regards, Kkde -- You received this message from the vim_dev maillist. Do not top-post! Type your reply below the text you
      Message 2 of 8 , Jul 14, 2010
        Can someone please help on this?

        Regards,
        Kkde

        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • James Vega
        ... Why do you have the while loop? searchpair() returns the line on which the paired item was found, 0 if it couldn t find a matching pair, or -1 if the skip
        Message 3 of 8 , Jul 14, 2010
          On Thu, Jul 8, 2010 at 12:00 PM, KKde <khekadestroyer@...> wrote:
          > I have written my own user defined complete function(written
          > completely in vim scripting only, no other lang's used). In complete
          > function, one part of code finds the line no of opening parenthesis of
          > a function.
          > I have used the below code to do that.
          >
          > let line=1
          > while ( line != 0)
          >            let line = searchpair('(', '', ')', 'bW',
          > 'synIDattr(synID(line("."), col("."), 1), "name") =~ "cComment"')
          > endwhile
          >
          > The problem with the above code is searchpair function is very slow.
          > It takes 6-7 seconds to match the opening parenthesis (Note: opening
          > parenthesis not farther than 10-15 lines).

          Why do you have the while loop? searchpair() returns the line on which
          the paired item was found, 0 if it couldn't find a matching pair, or -1
          if the skip expression caused an error while being evaluated.

          By using the while loop, you're not only discarding any match that you
          do find, but you're then causing Vim to search the entire buffer
          previous to the cursor position for any other match. That's likely the
          cause for the delay you're seeing.

          --
          James
          GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan@...>

          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • KKde
          ... I removed the while loop around searchpair(). Now it isn t taking much time. Thanks! My other question still remains unanswered. why screen flickers or
          Message 4 of 8 , Jul 15, 2010
            >
            > Why do you have the while loop?  searchpair() returns the line on which
            > the paired item was found, 0 if it couldn't find a matching pair, or -1
            > if the skip expression caused an error while being evaluated.
            >
            > By using the while loop, you're not only discarding any match that you
            > do find, but you're then causing Vim to search the entire buffer
            > previous to the cursor position for any other match.  That's likely the
            > cause for the delay you're seeing.

            I removed the while loop around searchpair(). Now it isn't taking much
            time. Thanks!

            My other question still remains unanswered.

            why screen flickers or cursor line is disturbed in complete
            function when I used normal commands?

            Regards,
            Kkde

            --
            You received this message from the "vim_dev" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          Your message has been successfully submitted and would be delivered to recipients shortly.