Re: Issue in match() function with multi-byte characters

2014-03-30 Fir de Conversatie Nikolay Pavlov
On Mar 30, 2014 5:54 AM, Andre Sihera andre.sih...@hotmail.co.jp wrote: On 30/03/14 09:03, Nikolay Pavlov wrote: On Mar 30, 2014 3:35 AM, Dmitry Frank dimon.fr...@gmail.com wrote: Hello all. match() function returns index of first match, but if there are multi-byte chars before first

Re: Issue in match() function with multi-byte characters

2014-03-30 Fir de Conversatie Andre Sihera
On 30/03/14 16:40, Nikolay Pavlov wrote: On Mar 30, 2014 5:54 AM, Andre Sihera andre.sih...@hotmail.co.jp mailto:andre.sih...@hotmail.co.jp wrote: On 30/03/14 09:03, Nikolay Pavlov wrote: On Mar 30, 2014 3:35 AM, Dmitry Frank dimon.fr...@gmail.com mailto:dimon.fr...@gmail.com

Re: Issue in match() function with multi-byte characters

2014-03-30 Fir de Conversatie Nikolay Pavlov
On Mar 30, 2014 4:19 AM, Dmitry Frank dimon.fr...@gmail.com wrote: Then, how can I get the symbol index (not byte offset) of a match? There is awesome plugin PreciseJump: http://www.vim.org/scripts/script.php?script_id=3437 , it gets array of all symbols of the line, like that: let

Re: Issue in match() function with multi-byte characters

2014-03-30 Fir de Conversatie Dmitry Frank
2014-03-30 12:51 GMT+04:00 Nikolay Pavlov zyx@gmail.com: On Mar 30, 2014 4:19 AM, Dmitry Frank dimon.fr...@gmail.com wrote: Then, how can I get the symbol index (not byte offset) of a match? There is awesome plugin PreciseJump: http://www.vim.org/scripts/script.php?script_id=3437 ,

[PATCH] “:let g {0==1 ? a : b}” does not work

2014-03-30 Fir de Conversatie ZyX
Consider the following script: let g=1 let a=2 let b=3 let g let {0==1 ? a : b} let {0==1 ? a : b} g let g {0 ? a : b} let g {0==1 ? a : b} . It will output the following: fourth :let: g #1 fifth :let: b #3 sixths :let: b #3

Re: Issue in match() function with multi-byte characters

2014-03-30 Fir de Conversatie Nikolay Pavlov
On Mar 30, 2014 12:59 PM, Dmitry Frank dimon.fr...@gmail.com wrote: 2014-03-30 12:51 GMT+04:00 Nikolay Pavlov zyx@gmail.com: On Mar 30, 2014 4:19 AM, Dmitry Frank dimon.fr...@gmail.com wrote: Then, how can I get the symbol index (not byte offset) of a match? There is awesome

Re: Issue in match() function with multi-byte characters

2014-03-30 Fir de Conversatie Yasuhiro MATSUMOTO
index(sprit(こんにちわ世界, \zs), 世) should return 5 On 3/30/14, Dmitry Frank dimon.fr...@gmail.com wrote: Then, how can I get the symbol index (not byte offset) of a match? There is awesome plugin PreciseJump: http://www.vim.org/scripts/script.php?script_id=3437 , it gets array of all symbols of

Re: Issue in match() function with multi-byte characters

2014-03-30 Fir de Conversatie Dmitry Frank
2014-03-30 15:32 GMT+04:00 Yasuhiro MATSUMOTO mattn...@gmail.com: index(sprit(こんにちわ世界, \zs), 世) should return 5 It does, but you have 2 typos: not sprit but split, and \zs should be in single quotes, not double: index(split(こんにちわ世界, '\zs'), 世) But anyway all these solutions are so dirty

Re: Issue in match() function with multi-byte characters

2014-03-30 Fir de Conversatie Andre Sihera
On 30/03/14 20:32, Yasuhiro MATSUMOTO wrote: index(sprit(こんにちわ世界, \zs), 世) should return 5 Now this is interesting. index() does indeed split on character, not byteboundaries. However, even if I can do this: split(こんにちわ世界, '\zs') to get this: ['こ', 'ん', 'に', 'ち', 'わ', '世', '界']

Re: Issue in match() function with multi-byte characters

2014-03-30 Fir de Conversatie Dmitry Frank
2014-03-30 17:00 GMT+04:00 Andre Sihera andre.sih...@hotmail.co.jp: On 30/03/14 20:32, Yasuhiro MATSUMOTO wrote: index(sprit(こんにちわ世界, \zs), 世) should return 5 Now this is interesting. index() does indeed split on character, not byteboundaries. However, even if I can do this:

Re: Issue in match() function with multi-byte characters

2014-03-30 Fir de Conversatie ZyX
On Sunday, March 30, 2014 5:00:13 PM UTC+4, Andre Sihera wrote: On 30/03/14 20:32, Yasuhiro MATSUMOTO wrote: Now this is interesting. index() does indeed split on character, not byteboundaries. However, even if I can do this: split(こんにちわ世界, '\zs') to get this: ['こ', 'ん',

Re: back- and forwardslash Inconsistency for viminfo

2014-03-30 Fir de Conversatie Bram Moolenaar
Enno Nagel wrote: Under Windows, the undo-, backup- and swapdir-settings accept back- or forward-slashes, but viminfo only the backslash variant. That's strange. What value do you use and what is the error you experience? -- I learned the customs and mannerisms of engineers by observing

Re: Issue in match() function with multi-byte characters

2014-03-30 Fir de Conversatie ZyX
String indexing *must* not fixed. As I said there is a number of plugins that need *exactly* bytes: any plugin implementing hash function. char2nr(s[i]) is guaranteed to return a value between 0x00 and 0xFF (inclusive) (0x00 is returned only if s[i] is an empty string). There are basically

Re: Patch 7.4.153

2014-03-30 Fir de Conversatie Bram Moolenaar
Ken Takata wrote: I had a report from nakinor that compiler warnings occur after 7.4.153. E.g.: In file included from if_python3.c:773: ./if_py_both.h:2331:27: warning: incompatible pointer types passing 'PySliceObject *' to parameter of type 'PyObject *' (aka 'struct

Re: Issue in match() function with multi-byte characters

2014-03-30 Fir de Conversatie Andre Sihera
On 30/03/14 22:46, Dmitry Frank wrote: let my_str = こんにちわ世界 let match_start = match(my_str, 世界, 0, 1) echo strchars(my_str[: match_start - 1]) So it is. And the reason I didn't know about this cunning trick is due to a documentation bug. The function strchars() works perfectly in my version

Re: Patch 7.4.153

2014-03-30 Fir de Conversatie Ken Takata
Hi, 2014/3/30 Sun 23:12:39 UTC+9 Bram Moolenaar: This doesn't work, because PySliceObject_T is used in if_python3.c before including if_py_both.h. I'll move the #if to if_python3.c to make it work. Oops, sorry for that. Regards, Ken Takata -- -- You received this message from the vim_dev

Re: Issue in match() function with multi-byte characters

2014-03-30 Fir de Conversatie Andre Sihera
On 30/03/14 22:58, ZyX wrote: This is not good. These inconsistencies need to be fixed. String indexing*must* not fixed. As I said there is a number of plugins that need*exactly* bytes: any plugin implementing hash function. char2nr(s[i]) is guaranteed to return a value between 0x00 and

Re: Issue in match() function with multi-byte characters

2014-03-30 Fir de Conversatie ZyX
On Sunday, March 30, 2014 5:59:34 PM UTC+4, Andre Sihera wrote: On 30/03/14 22:46, Dmitry Frank wrote: let my_str = こんにちわ世界 let match_start = match(my_str, 世界, 0, 1) echo strchars(my_str[: match_start - 1]) So it is. And the reason I didn't know about this cunning trick is due

Patch 7.4.229

2014-03-30 Fir de Conversatie Bram Moolenaar
Patch 7.4.229 Problem:Using :let for listing variables and the second one is a curly braces expression may fail. Solution: Check for an = in a better way. (ZyX) Files: src/eval.c, src/testdir/test104.in, src/testdir/test104.ok *** ../vim-7.4.228/src/eval.c 2014-03-25

Re: [PATCH] “:let g {0==1 ? a : b}” does not work

2014-03-30 Fir de Conversatie Bram Moolenaar
ZyX wrote: Consider the following script: let g=1 let a=2 let b=3 let g let {0==1 ? a : b} let {0==1 ? a : b} g let g {0 ? a : b} let g {0==1 ? a : b} . It will output the following: fourth :let: g #1 fifth :let: b #3

Re: Issue in match() function with multi-byte characters

2014-03-30 Fir de Conversatie Andre Sihera
On 30/03/14 23:52, ZyX wrote: Thanks for your insights. It's not perfect but it's much better than I was originally thinking. I didn't say that string indexing has to be fixed. I said the inconsistencies had to be fixed. There is a difference.

Re: Page on developing Vim

2014-03-30 Fir de Conversatie Ben Fritz
On Saturday, March 29, 2014 10:10:03 AM UTC-5, Bram Moolenaar wrote: I have asked Christian Brabandt to write down how he creates and maintains patches for Vim. You can read it here: http://www.vim.org/develop.php I hope this is useful. If you have suggestions to improve this page,

Re: Issue in match() function with multi-byte characters

2014-03-30 Fir de Conversatie Yasuhiro MATSUMOTO
This is not good. These inconsistencies need to be fixed. No, don't break compatibility. vim script should handle bytes as index. On 3/30/14, Andre Sihera andre.sih...@hotmail.co.jp wrote: On 30/03/14 20:32, Yasuhiro MATSUMOTO wrote: index(sprit(こんにちわ世界, \zs), 世) should return 5 Now this is

Re: Issue in match() function with multi-byte characters

2014-03-30 Fir de Conversatie Dmitry Frank
2014-03-30 20:04 GMT+04:00 Yasuhiro MATSUMOTO mattn...@gmail.com: This is not good. These inconsistencies need to be fixed. No, don't break compatibility. vim script should handle bytes as index. We already have mentioned, and not once, that nobody wants to break compatibility, but we want

[BUG] `:e +` does not position cursor at the start of the file

2014-03-30 Fir de Conversatie ZyX
According to the documentation `:e + file` should position cursor to the last line of the file. This works for `:e + ` (`:espace+space`) and for `:e + file` (again there is a space). But if you use `:e +` (`:espace+`, no trailing space) it will position the cursor at the start of the file. Fix