On 7月17日, 下午4时23分, Tony Mechelynck <[email protected]>
wrote:
> On 17/07/09 09:40, StarWing wrote:
>
>
>
>
>
> > On 7月17日, 上午10时31分, Ben Fritz<[email protected]> wrote:
> >> On Jul 15, 5:33 am, StarWing<[email protected]> wrote:
>
> >>> OKay, changenr() is more or less enough. but in doc, it says "After
> >>> undo it is one less than the number of the undone change."
>
> >>> so, how can I get the exactly serial number of current buffer? the one
> >>> I can use in undo command. (changenr() can't use in undo command, exec
> >>> changenr()."u" is not always current status of buffer).
>
> >> What do you mean changenr() can't be used in the undo command? It says
> >> right in the help that it can be! What exactly are you trying to do,
> >> and what do you get instead? What is the "serial number of current
> >> buffer"? Are you looking for :help changetick instead?
>
> >> You give an example trying to do :exec changenr()."u" Don't you
> >> want :exec "undo ".changenr()? It doesn't look like :undo takes a
> >> count...it takes an argument.
>
> > Thank you for attention my problem!!! :-)
>
> > first, my purpose is confirm the state of buffer. that's see, when I
> > press 'u<C-R>','<C-R>u>', 'ifoobaru', 'g+g-', etc. we can know the
> > state of buffer is not change. so I can't use b:changetick...
>
> > then, the doc of changenr() said, when you do a undo, changenr() just
> > return the state number you are undo FORM substract 1, e.g. you are in
> > state 5, you press u and return to state 2, but changenr() doesn't
> > return 2, it returns 5-1 = 4! you can do a expriement:
>
> > 1. input "ione<ESC>". (changenr() 1, state 1)
> > 2. input "i too<ESC>". (changenr() 2, state 2)
> > 3. input "u". (changenr() 1, state 1)
> > 4. input "i two<esc>". (changenr() 3, state 3)
> > 5. input "u" (changenr() 2, but state is 1)
>
> > so, I can't use changenr() for this purpose :-(
>
> > at last, in ex_cmds.h, undo item is just:
>
> > EX(CMD_undo, "undo", ex_undo,
> > RANGE|NOTADR|COUNT|ZEROR|TRLBAR|CMDWIN),
>
> > it can accept a count and even a range, but not NEEDARG. so maybe we
> > should update the doc undo.txt...
>
> Looks like you can do it after an undo-redo (provided of course that
> there is at least one undoable change). changenr() will then return the
> number of the change which has just been redone, and that is what you
> call the "state" in the above example.
>
> ":undo" can accept an integer argument, which is an undo number. Vim
> treats it internally as a count even though it isn't a "number of times
> to repeat the same action". Similarly, ":wincmd w" accepts a "count"
> which is not a number of repeats but a window number.
>
> From what I see with ":cs find s NEEDARG" in the Vim source, NEEDARG
> seems to be for non-numeric arguments, such as filenames, "xterm" or
> "mswin" in the ":behave" command, ex-commands after ":silent" ":browse"
> ":botright", etc.
>
> Best regards,
> Tony.
> --
> Schlattwhapper, n.:
> The window shade that allows itself to be pulled down,
> hesitates for a second, then snaps up in your face.
> -- Rich Hall, "Sniglets"
Thank you. undo-redo is just a way to provide that, though one state
can't reach...and it may be slow.
it caused in undo.c u_undoredo() function, 1300lines. can any one fix
it?
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---