When assigning or deleting list item no error raised for out-of-range index.

  :let list = []
  :let list[0] = 0
  :echo list
  []

  :let list = []
  :unlet list[0]

I expected "E684: list index out of range: 0" or similar error.

And slice assignment do nothing for empty slice.

  :let list = []
  :let list[0:9] = [1, 2]
  :echo list
  []

  :let list = [0]
  :let list[9:] = [1, 2]
  :echo list
  [0]

  :let list = []
  :let list[:] = [1, 2]
  :echo list
  []

For non-empty slice, value is assigned and/or error is raised instead.

  :let list = [0]
  :let list[0:9] = [1, 2]
  E711: List value has not enough items
  :echo list
  [1, 2]

  :let list = [0]
  :let list[0:0] = [1, 2]
  E710: List value has more items than target
  :echo list
  [1]

  :let list = [0]
  :let list[:] = [1, 2]
  :echo list
  [1, 2]


--
Yukihiro Nakadaira - [email protected]

--
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

Raspunde prin e-mail lui