From 8924e75f3477b20f0ef4e3df64b56bf496b197ae Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Thu, 2 Mar 2017 23:04:57 +0100 Subject: vim-patch:7.4.2170 Problem: Cannot get information about timers. Solution: Add timer_info(). https://github.com/vim/vim/commit/8e97bd74b5377753597e3d98e7123d8985c7fffd --- src/nvim/eval.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/nvim/eval.lua | 1 + src/nvim/version.c | 2 +- 3 files changed, 57 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index d4daffb469..537e9e696f 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -17931,6 +17931,61 @@ static bool set_ref_in_callback(Callback *callback, int copyID, return false; } +static void add_timer_info(typval_T *rettv, timer_T *timer) +{ + list_T *list = rettv->vval.v_list; + dict_T *dict = dict_alloc(); + + list_append_dict(list, dict); + dict_add_nr_str(dict, "id", (long)timer->timer_id, NULL); + dict_add_nr_str(dict, "time", timer->timeout, NULL); + + dict_add_nr_str(dict, "repeat", + (long)(timer->repeat_count < 0 ? -1 : timer->repeat_count), + NULL); + + dictitem_T *di = dictitem_alloc((char_u *)"callback"); + if (dict_add(dict, di) == FAIL) { + xfree(di); + return; + } + + if (timer->callback.type == kCallbackPartial) { + di->di_tv.v_type = VAR_PARTIAL; + di->di_tv.vval.v_partial = timer->callback.data.partial; + timer->callback.data.partial->pt_refcount++; + } else if (timer->callback.type == kCallbackFuncref) { + di->di_tv.v_type = VAR_FUNC; + di->di_tv.vval.v_string = vim_strsave(timer->callback.data.funcref); + } + di->di_tv.v_lock = 0; +} + +static void add_timer_info_all(typval_T *rettv) +{ + timer_T *timer; + map_foreach_value(timers, timer, { + add_timer_info(rettv, timer); + }) +} + +/// "timer_info([timer])" function +static void f_timer_info(typval_T *argvars, typval_T *rettv, FunPtr fptr) +{ + rettv_list_alloc(rettv); + if (argvars[0].v_type != VAR_UNKNOWN) { + if (argvars[0].v_type != VAR_NUMBER) { + EMSG(_(e_number_exp)); + } else { + timer_T *timer = pmap_get(uint64_t)(timers, get_tv_number(&argvars[0])); + if (timer != NULL) { + add_timer_info(rettv, timer); + } + } + } else { + add_timer_info_all(rettv); + } +} /// "timer_start(timeout, callback, opts)" function static void f_timer_start(typval_T *argvars, typval_T *rettv, FunPtr fptr) diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index e3c5981b32..e923fee316 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -306,6 +306,7 @@ return { tempname={}, termopen={args={1, 2}}, test_garbagecollect_now={}, + timer_info={args={0,1}}, timer_start={args={2,3}}, timer_stop={args=1}, tolower={args=1}, diff --git a/src/nvim/version.c b/src/nvim/version.c index 8fd0fce329..b283059c7a 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -271,7 +271,7 @@ static int included_patches[] = { // 2173, // 2172, // 2171, - // 2170, + 2170, // 2169, // 2168 NA // 2167 NA -- cgit From 5b8ce2feed6b528bae4bceba6f234be000949971 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Sun, 5 Mar 2017 16:25:40 +0100 Subject: vim-patch:7.4.2180 Problem: There is no easy way to stop all timers. There is no way to temporary pause a timer. Solution: Add timer_stopall() and timer_pause(). https://github.com/vim/vim/commit/b73598e2f022a22fec512ea681c70d2775e8fd87 --- src/nvim/eval.c | 34 +++++++++++++--- src/nvim/eval.lua | 2 + src/nvim/testdir/shared.vim | 17 ++++++++ src/nvim/testdir/test_timers.vim | 86 +++++++++++++++++++++++++++++++++------- src/nvim/version.c | 2 +- 5 files changed, 120 insertions(+), 21 deletions(-) create mode 100644 src/nvim/testdir/shared.vim (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 537e9e696f..062999e73b 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -446,6 +446,7 @@ typedef struct { int refcount; long timeout; bool stopped; + bool paused; Callback callback; } timer_T; @@ -17939,6 +17940,7 @@ static void add_timer_info(typval_T *rettv, timer_T *timer) list_append_dict(list, dict); dict_add_nr_str(dict, "id", (long)timer->timer_id, NULL); dict_add_nr_str(dict, "time", timer->timeout, NULL); + dict_add_nr_str(dict, "paused", (long)timer->paused, NULL); dict_add_nr_str(dict, "repeat", (long)(timer->repeat_count < 0 ? -1 : timer->repeat_count), @@ -17965,7 +17967,9 @@ static void add_timer_info_all(typval_T *rettv) { timer_T *timer; map_foreach_value(timers, timer, { - add_timer_info(rettv, timer); + if (!timer->stopped) { + add_timer_info(rettv, timer); + } }) } @@ -17978,7 +17982,7 @@ static void f_timer_info(typval_T *argvars, typval_T *rettv, FunPtr fptr) EMSG(_(e_number_exp)); } else { timer_T *timer = pmap_get(uint64_t)(timers, get_tv_number(&argvars[0])); - if (timer != NULL) { + if (timer != NULL && !timer->stopped) { add_timer_info(rettv, timer); } } @@ -17987,6 +17991,20 @@ static void f_timer_info(typval_T *argvars, typval_T *rettv, FunPtr fptr) } } +/// "timer_pause(timer, paused)" function +static void f_timer_pause(typval_T *argvars, typval_T *unused, FunPtr fptr) +{ + if (argvars[0].v_type != VAR_NUMBER) { + EMSG(_(e_number_exp)); + } else { + int paused = (bool)get_tv_number(&argvars[1]); + timer_T *timer = pmap_get(uint64_t)(timers, get_tv_number(&argvars[0])); + if (timer != NULL) { + timer->paused = paused; + } + } +} + /// "timer_start(timeout, callback, opts)" function static void f_timer_start(typval_T *argvars, typval_T *rettv, FunPtr fptr) { @@ -18019,6 +18037,7 @@ static void f_timer_start(typval_T *argvars, typval_T *rettv, FunPtr fptr) timer = xmalloc(sizeof *timer); timer->refcount = 1; timer->stopped = false; + timer->paused = false; timer->repeat_count = repeat; timer->timeout = timeout; timer->timer_id = last_timer_id++; @@ -18028,8 +18047,7 @@ static void f_timer_start(typval_T *argvars, typval_T *rettv, FunPtr fptr) timer->tw.events = multiqueue_new_child(main_loop.events); // if main loop is blocked, don't queue up multiple events timer->tw.blockable = true; - time_watcher_start(&timer->tw, timer_due_cb, timeout, - timeout * (repeat != 1)); + time_watcher_start(&timer->tw, timer_due_cb, timeout, timeout); pmap_put(uint64_t)(timers, timer->timer_id, timer); rettv->vval.v_number = timer->timer_id; @@ -18053,13 +18071,19 @@ static void f_timer_stop(typval_T *argvars, typval_T *rettv, FunPtr fptr) timer_stop(timer); } +static void f_timer_stopall(typval_T *argvars, typval_T *unused, FunPtr fptr) +{ + timer_teardown(); +} + // invoked on the main loop static void timer_due_cb(TimeWatcher *tw, void *data) { timer_T *timer = (timer_T *)data; - if (timer->stopped) { + if (timer->stopped || timer->paused) { return; } + timer->refcount++; // if repeat was negative repeat forever if (timer->repeat_count >= 0 && --timer->repeat_count == 0) { diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index e923fee316..d30d34135b 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -307,8 +307,10 @@ return { termopen={args={1, 2}}, test_garbagecollect_now={}, timer_info={args={0,1}}, + timer_pause={args=2}, timer_start={args={2,3}}, timer_stop={args=1}, + timer_stopall={args=0}, tolower={args=1}, toupper={args=1}, tr={args=3}, diff --git a/src/nvim/testdir/shared.vim b/src/nvim/testdir/shared.vim new file mode 100644 index 0000000000..9573f5a9c3 --- /dev/null +++ b/src/nvim/testdir/shared.vim @@ -0,0 +1,17 @@ +" Functions shared by several tests. + +" Wait for up to a second for "expr" to become true. +" Return time slept in milliseconds. +func WaitFor(expr) + let slept = 0 + for i in range(100) + try + if eval(a:expr) + return slept + endif + catch + endtry + let slept += 10 + sleep 10m + endfor +endfunc diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index 56f9feef66..b03295bd01 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -4,8 +4,10 @@ if !has('timers') finish endif +source shared.vim + func MyHandler(timer) - let s:val += 1 + let g:val += 1 endfunc func MyHandlerWithLists(lists, timer) @@ -13,44 +15,98 @@ func MyHandlerWithLists(lists, timer) endfunc func Test_oneshot() - let s:val = 0 + let g:val = 0 let timer = timer_start(50, 'MyHandler') - sleep 200m - call assert_equal(1, s:val) + let slept = WaitFor('g:val == 1') + call assert_equal(1, g:val) + call assert_inrange(30, 100, slept) endfunc func Test_repeat_three() - let s:val = 0 + let g:val = 0 let timer = timer_start(50, 'MyHandler', {'repeat': 3}) - sleep 500m - call assert_equal(3, s:val) + let slept = WaitFor('g:val == 3') + call assert_equal(3, g:val) + call assert_inrange(100, 250, slept) endfunc func Test_repeat_many() - let s:val = 0 + let g:val = 0 let timer = timer_start(50, 'MyHandler', {'repeat': -1}) sleep 200m call timer_stop(timer) - call assert_true(s:val > 1) - call assert_true(s:val < 5) + call assert_inrange(2, 4, g:val) endfunc func Test_with_partial_callback() - let s:val = 0 + let g:val = 0 let s:meow = {} function s:meow.bite(...) - let s:val += 1 + let g:val += 1 endfunction call timer_start(50, s:meow.bite) - sleep 200m - call assert_equal(1, s:val) + let slept = WaitFor('g:val == 1') + call assert_equal(1, g:val) + call assert_inrange(30, 100, slept) endfunc func Test_retain_partial() - call timer_start(100, function('MyHandlerWithLists', [['a']])) + call timer_start(50, function('MyHandlerWithLists', [['a']])) call garbagecollect() + sleep 100m +endfunc + +func Test_info() + let id = timer_start(1000, 'MyHandler') + let info = timer_info(id) + call assert_equal(id, info[0]['id']) + call assert_equal(1000, info[0]['time']) + call assert_equal("function('MyHandler')", string(info[0]['callback'])) + + let found = 0 + for info in timer_info() + if info['id'] == id + let found += 1 + endif + endfor + call assert_equal(1, found) + + call timer_stop(id) + call assert_equal([], timer_info(id)) +endfunc + +func Test_stopall() + let id1 = timer_start(1000, 'MyHandler') + let id2 = timer_start(2000, 'MyHandler') + let info = timer_info() + call assert_equal(2, len(info)) + + call timer_stopall() + let info = timer_info() + call assert_equal(0, len(info)) +endfunc + +func Test_paused() + let g:val = 0 + + let id = timer_start(50, 'MyHandler') + let info = timer_info(id) + call assert_equal(0, info[0]['paused']) + + call timer_pause(id, 1) + let info = timer_info(id) + call assert_equal(1, info[0]['paused']) sleep 200m + call assert_equal(0, g:val) + + call timer_pause(id, 0) + let info = timer_info(id) + call assert_equal(0, info[0]['paused']) + + let slept = WaitFor('g:val == 1') + call assert_equal(1, g:val) + call assert_inrange(0, 10, slept) endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/version.c b/src/nvim/version.c index b283059c7a..4da970d43b 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -261,7 +261,7 @@ static int included_patches[] = { 2183, // 2182 NA // 2181, - // 2180, + 2180, // 2179, // 2178, // 2177, -- cgit From 420a9955fa969ee0460f41798c60c1374476fd08 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Mon, 6 Mar 2017 07:15:19 +0100 Subject: version.c: Mark 7.4.2171 and 7.4.2181 as NA. --- src/nvim/version.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/version.c b/src/nvim/version.c index 4da970d43b..0bf0f10b56 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -260,7 +260,7 @@ static int included_patches[] = { // 2184, 2183, // 2182 NA - // 2181, + // 2181 NA 2180, // 2179, // 2178, @@ -270,7 +270,7 @@ static int included_patches[] = { 2174, // 2173, // 2172, - // 2171, + // 2171 NA 2170, // 2169, // 2168 NA -- cgit From 5c2f1e29e3dfdfab8c2a9b31962d9cc12c171e46 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Mon, 20 Mar 2017 20:52:54 +0100 Subject: vim-patch:7.4.2240 Problem: Tests using the sleep time can be flaky. Solution: Use reltime() if available. (Partly by Shane Harper) https://github.com/vim/vim/commit/f267f8bdf777073e392ada5b31d837c7b6090eb4 --- src/nvim/testdir/shared.vim | 21 ++++++++++++++++----- src/nvim/testdir/test_timers.vim | 24 ++++++++++++++++++++---- src/nvim/version.c | 2 +- 3 files changed, 37 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/shared.vim b/src/nvim/testdir/shared.vim index 9573f5a9c3..1138ceba4d 100644 --- a/src/nvim/testdir/shared.vim +++ b/src/nvim/testdir/shared.vim @@ -1,17 +1,28 @@ " Functions shared by several tests. -" Wait for up to a second for "expr" to become true. -" Return time slept in milliseconds. +" Return time slept in milliseconds. With the +reltime feature this can be +" more than the actual waiting time. Without +reltime it can also be less. func WaitFor(expr) - let slept = 0 + " using reltime() is more accurate, but not always available + if has('reltime') + let start = reltime() + else + let slept = 0 + endif for i in range(100) try if eval(a:expr) - return slept + if has('reltime') + return float2nr(reltimefloat(reltime(start)) * 1000) + endif + return slept endif catch endtry - let slept += 10 + if !has('reltime') + let slept += 10 + endif sleep 10m endfor + return 1000 endfunc diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index b03295bd01..2a5fa5c662 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -19,7 +19,11 @@ func Test_oneshot() let timer = timer_start(50, 'MyHandler') let slept = WaitFor('g:val == 1') call assert_equal(1, g:val) - call assert_inrange(30, 100, slept) + if has('reltime') + call assert_inrange(50, 100, slept) + else + call assert_inrange(20, 100, slept) + endif endfunc func Test_repeat_three() @@ -27,7 +31,11 @@ func Test_repeat_three() let timer = timer_start(50, 'MyHandler', {'repeat': 3}) let slept = WaitFor('g:val == 3') call assert_equal(3, g:val) - call assert_inrange(100, 250, slept) + if has('reltime') + call assert_inrange(150, 200, slept) + else + call assert_inrange(80, 200, slept) + endif endfunc func Test_repeat_many() @@ -48,7 +56,11 @@ func Test_with_partial_callback() call timer_start(50, s:meow.bite) let slept = WaitFor('g:val == 1') call assert_equal(1, g:val) - call assert_inrange(30, 100, slept) + if has('reltime') + call assert_inrange(50, 100, slept) + else + call assert_inrange(20, 100, slept) + endif endfunc func Test_retain_partial() @@ -106,7 +118,11 @@ func Test_paused() let slept = WaitFor('g:val == 1') call assert_equal(1, g:val) - call assert_inrange(0, 10, slept) + if has('reltime') + call assert_inrange(0, 30, slept) + else + call assert_inrange(0, 10, slept) + endif endfunc " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/version.c b/src/nvim/version.c index 0bf0f10b56..ef6c9d1454 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -201,7 +201,7 @@ static int included_patches[] = { // 2243 NA // 2242, // 2241, - // 2240, + 2240, // 2239, // 2238 NA 2237, -- cgit From 3558f89d22faad613e0049592d2187ad35f5bec8 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Mon, 20 Mar 2017 21:11:24 +0100 Subject: vim-patch:7.4.2241 Problem: Timer test sometimes fails. Solution: Increase the maximum time for repeating timer. https://github.com/vim/vim/commit/973365dcc40a41e6b72ece56f15cebfee69b1329 --- src/nvim/testdir/test_timers.vim | 2 +- src/nvim/version.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index 2a5fa5c662..8829b5de59 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -32,7 +32,7 @@ func Test_repeat_three() let slept = WaitFor('g:val == 3') call assert_equal(3, g:val) if has('reltime') - call assert_inrange(150, 200, slept) + call assert_inrange(150, 250, slept) else call assert_inrange(80, 200, slept) endif diff --git a/src/nvim/version.c b/src/nvim/version.c index ef6c9d1454..b7516e443a 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -200,7 +200,7 @@ static int included_patches[] = { // 2244, // 2243 NA // 2242, - // 2241, + 2241, 2240, // 2239, // 2238 NA -- cgit From 4f69a8fb8854698adb2de8956ad0d86ff35a6f68 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Mon, 20 Mar 2017 21:12:31 +0100 Subject: vim-patch:7.4.2242 Problem: Timer test sometimes fails. Solution: Increase the maximum time for callback timer test. https://github.com/vim/vim/commit/17f1347b867cbcc0ce380bf9a2466b4c31896f04 --- src/nvim/testdir/test_timers.vim | 2 +- src/nvim/version.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index 8829b5de59..db10f351ae 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -57,7 +57,7 @@ func Test_with_partial_callback() let slept = WaitFor('g:val == 1') call assert_equal(1, g:val) if has('reltime') - call assert_inrange(50, 100, slept) + call assert_inrange(50, 130, slept) else call assert_inrange(20, 100, slept) endif diff --git a/src/nvim/version.c b/src/nvim/version.c index b7516e443a..91c37658aa 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -199,7 +199,7 @@ static int included_patches[] = { // 2245, // 2244, // 2243 NA - // 2242, + 2242, 2241, 2240, // 2239, -- cgit From 3116f870ba274862fa6d6643d9fa0870215fed12 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Wed, 29 Mar 2017 16:30:06 -0400 Subject: coverity/161195: Increase scope of exe_name Since exe_name is a stack allocated array, we need it to be in scope for the lifetime that vim_path points to it. --- src/nvim/os/env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index a73d753e46..a10c835591 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -615,9 +615,9 @@ char *vim_getenv(const char *name) vim_path = (char *)p_hf; } + char exe_name[MAXPATHL]; // Find runtime path relative to the nvim binary: ../share/nvim/runtime if (vim_path == NULL) { - char exe_name[MAXPATHL]; size_t exe_name_len = MAXPATHL; if (os_exepath(exe_name, &exe_name_len) == 0) { char *path_end = (char *)path_tail_with_sep((char_u *)exe_name); -- cgit From 1c6ae58fd1301bfe2b27ed168b5a117e92c9c4cd Mon Sep 17 00:00:00 2001 From: James McCoy Date: Wed, 29 Mar 2017 16:51:46 -0400 Subject: coverity/161194: Restore check for 'keywordprg' being ":help" 998d0ffc09d5c7358db62dc88c2e2b87622f60b5 removed the explicit check for ":help", relying instead on whether the user was in a help buffer. However, this breaks escaping the identifier for use in the lookup command. 2f54d6927cc02484b528a5e8b25b64c8d6580ddd tried to fix this by removing "!kp_ex" in "if (cmdchar == 'K' && !kp_ex)", but that causes shell escaping to be used instead of escaping for tag lookup. --- src/nvim/normal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/normal.c b/src/nvim/normal.c index d4919dc3b6..388ddfc8bb 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -4670,6 +4670,7 @@ static void nv_ident(cmdarg_T *cap) char_u *kp = *curbuf->b_p_kp == NUL ? p_kp : curbuf->b_p_kp; // 'keywordprg' assert(*kp != NUL); // option.c:do_set() should default to ":help" if empty. bool kp_ex = (*kp == ':'); // 'keywordprg' is an ex command + bool kp_help = (STRCMP(kp, ":he") == 0 || STRCMP(kp, ":help") == 0); size_t buf_size = n * 2 + 30 + STRLEN(kp); char *buf = xmalloc(buf_size); buf[0] = NUL; @@ -4692,7 +4693,9 @@ static void nv_ident(cmdarg_T *cap) break; case 'K': - if (kp_ex) { + if (kp_help) { + STRCPY(buf, "he! "); + } else if (kp_ex) { if (cap->count0 != 0) { // Send the count to the ex command. snprintf(buf, buf_size, "%" PRId64, (int64_t)(cap->count0)); } @@ -4755,7 +4758,7 @@ static void nv_ident(cmdarg_T *cap) } // Now grab the chars in the identifier - if (cmdchar == 'K') { + if (cmdchar == 'K' && !kp_help) { ptr = vim_strnsave(ptr, n); if (kp_ex) { // Escape the argument properly for an Ex command -- cgit From 91dfebf0506c4389af77071323798fdd7360c589 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Wed, 29 Mar 2017 20:45:22 -0400 Subject: ci: Update Coverity model for typval refactoring [ci skip] --- src/coverity-model.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/coverity-model.c b/src/coverity-model.c index a01ea6d316..3c38e4ae4d 100644 --- a/src/coverity-model.c +++ b/src/coverity-model.c @@ -64,7 +64,7 @@ void *je_realloc(void *ptr, size_t size) // of the memory allocated for item. typedef struct {} dictitem_T; typedef struct {} dict_T; -int dict_add(dict_T *d, dictitem_T *item) +int tv_dict_add(dict_T *const d, dictitem_T *const item) { __coverity_escape__(item); } -- cgit From 1222c82799b9a853c5adaf8761309b616e664c95 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Wed, 29 Mar 2017 21:34:04 -0400 Subject: coverity/16127: Verify lang is non-NULL before calling strlen --- src/nvim/option.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/option.c b/src/nvim/option.c index 9b31e14ea7..69c12e2cc7 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1054,13 +1054,15 @@ void set_init_3(void) */ void set_helplang_default(const char *lang) { - int idx; + if (lang == NULL) { + return; + } const size_t lang_len = strlen(lang); - if (lang == NULL || lang_len < 2) { // safety check + if (lang_len < 2) { // safety check return; } - idx = findoption("hlg"); + int idx = findoption("hlg"); if (idx >= 0 && !(options[idx].flags & P_WAS_SET)) { if (options[idx].flags & P_ALLOCED) free_string_option(p_hlg); -- cgit From 831eb2a9bf9fdffc1b6942e4c43bc2458f4af794 Mon Sep 17 00:00:00 2001 From: Michael Ennen Date: Thu, 30 Mar 2017 16:07:39 -0700 Subject: vim-patch:7.4.2104 (#6332) Problem: Code duplication when unreferencing a function. Solution: De-duplicate. https://github.com/vim/vim/commit/97baee80f0906ee2f651ee1215ec033e84f866ad --- src/nvim/eval.c | 8 +------- src/nvim/version.c | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 80c2fe10d7..a83e93090a 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -20711,13 +20711,7 @@ void func_unref(char_u *name) abort(); #endif } - if (fp != NULL && --fp->uf_refcount <= 0) { - // Only delete it when it's not being used. Otherwise it's done - // when "uf_calls" becomes zero. - if (fp->uf_calls == 0) { - func_clear_free(fp, false); - } - } + func_ptr_unref(fp); } /// Unreference a Function: decrement the reference count and free it when it diff --git a/src/nvim/version.c b/src/nvim/version.c index 9275a2e5bd..fdf5436a98 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -337,7 +337,7 @@ static const int included_patches[] = { 2107, 2106, // 2105 NA - // 2104, + 2104, 2103, // 2102 NA 2101, -- cgit From 3a9dd13f9e6471215a738cf22bf180e60a2e0bcd Mon Sep 17 00:00:00 2001 From: Matthew Malcomson Date: Fri, 31 Mar 2017 00:21:26 +0100 Subject: fold.c: more edge-cases when updating (#6207) When foldUpdateIEMSRecurse() re-uses an existing fold, it misses the case where the existing fold spans from before startlnum to after firstlnum, the new fold does not span this range, and there is no "forced start" of a fold. We add a case for this in. Ensure that if there was no forced break in folds, we merge folds that now touch each other. Include testing for a tricky foldmethod=expr case that has never been a bug. This case works at the moment because of some effects that are not obvious when reading the code. A test for this could be useful to ensure a regression doesn't happen. vim-patch:8.0.0408 --- src/nvim/fold.c | 71 +++++++++++++++++-------- src/nvim/testdir/test_fold.vim | 118 +++++++++++++++++++++++++++++++++++------ 2 files changed, 152 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/nvim/fold.c b/src/nvim/fold.c index 36a5b0efd7..d810aee0ce 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -2232,32 +2232,51 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *gap, int level, * before where we started looking, extend it. If it * starts at another line, update nested folds to keep * their position, compensating for the new fd_top. */ - if (fp->fd_top >= startlnum && fp->fd_top != firstlnum) { - if (fp->fd_top > firstlnum) - /* like lines are inserted */ + if (fp->fd_top == firstlnum) { + // We have found a fold beginning exactly where we want one. + } else if (fp->fd_top >= startlnum) { + if (fp->fd_top > firstlnum) { + // We will move the start of this fold up, hence we move all + // nested folds (with relative line numbers) down. foldMarkAdjustRecurse(&fp->fd_nested, - (linenr_T)0, (linenr_T)MAXLNUM, - (long)(fp->fd_top - firstlnum), 0L); - else - /* like lines are deleted */ + (linenr_T)0, (linenr_T)MAXLNUM, + (long)(fp->fd_top - firstlnum), 0L); + } else { + // Will move fold down, move nested folds relatively up. foldMarkAdjustRecurse(&fp->fd_nested, - (linenr_T)0, - (long)(firstlnum - fp->fd_top - 1), - (linenr_T)MAXLNUM, - (long)(fp->fd_top - firstlnum)); + (linenr_T)0, + (long)(firstlnum - fp->fd_top - 1), + (linenr_T)MAXLNUM, + (long)(fp->fd_top - firstlnum)); + } fp->fd_len += fp->fd_top - firstlnum; fp->fd_top = firstlnum; - fold_changed = TRUE; - } else if (flp->start != 0 && lvl == level - && fp->fd_top != firstlnum) { - /* Existing fold that includes startlnum must stop - * if we find the start of a new fold at the same - * level. Split it. Delete contained folds at - * this point to split them too. */ - foldRemove(&fp->fd_nested, flp->lnum - fp->fd_top, - flp->lnum - fp->fd_top); + fold_changed = true; + } else if ((flp->start != 0 && lvl == level) + || (firstlnum != startlnum)) { + // Before there was a fold spanning from above startlnum to below + // firstlnum. This fold is valid above startlnum (because we are + // not updating that range), but there is now a break in it. + // If the break is because we are now forced to start a new fold + // at the level "level" at line fline->lnum, then we need to + // split the fold at fline->lnum. + // If the break is because the range [startlnum, firstlnum) is + // now at a lower indent than "level", we need to split the fold + // in this range. + // Any splits have to be done recursively. + linenr_T breakstart; + linenr_T breakend; + if (firstlnum != startlnum) { + breakstart = startlnum; + breakend = firstlnum; + } else { + breakstart = flp->lnum; + breakend = flp->lnum; + } + foldRemove(&fp->fd_nested, breakstart - fp->fd_top, + breakend - fp->fd_top); i = (int)(fp - (fold_T *)gap->ga_data); - foldSplit(gap, i, flp->lnum, flp->lnum - 1); + foldSplit(gap, i, breakstart, breakend - 1); fp = (fold_T *)gap->ga_data + i + 1; /* If using the "marker" or "syntax" method, we * need to continue until the end of the fold is @@ -2267,6 +2286,16 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *gap, int level, || getlevel == foldlevelSyntax) finish = TRUE; } + if (fp->fd_top == startlnum && concat) { + i = (int)(fp - (fold_T *)gap->ga_data); + if (i != 0) { + fp2 = fp - 1; + if (fp2->fd_top + fp2->fd_len == fp->fd_top) { + foldMerge(fp2, gap, fp); + fp = fp2; + } + } + } break; } if (fp->fd_top >= startlnum) { diff --git a/src/nvim/testdir/test_fold.vim b/src/nvim/testdir/test_fold.vim index 976c6b5cd1..46c54e8614 100644 --- a/src/nvim/testdir/test_fold.vim +++ b/src/nvim/testdir/test_fold.vim @@ -100,22 +100,6 @@ func! Test_indent_fold2() bw! endfunc -func Test_folds_marker_in_comment() - new - call setline(1, ['" foo', 'bar', 'baz']) - setl fen fdm=marker - setl com=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\" cms=\"%s - norm! zf2j - setl nofen - :1y - call assert_equal(['" foo{{{'], getreg(0,1,1)) - :+2y - call assert_equal(['baz"}}}'], getreg(0,1,1)) - - set foldmethod& - bwipe! -endfunc - func Test_manual_fold_with_filter() if !executable('cat') return @@ -138,6 +122,108 @@ func Test_manual_fold_with_filter() endfor endfunc +func! Test_indent_fold_with_read() + new + set foldmethod=indent + call setline(1, repeat(["\a"], 4)) + for n in range(1, 4) + call assert_equal(1, foldlevel(n)) + endfor + + call writefile(["a", "", "\a"], 'Xfile') + foldopen + 2read Xfile + %foldclose + call assert_equal(1, foldlevel(1)) + call assert_equal(2, foldclosedend(1)) + call assert_equal(0, foldlevel(3)) + call assert_equal(0, foldlevel(4)) + call assert_equal(1, foldlevel(5)) + call assert_equal(7, foldclosedend(5)) + + bwipe! + set foldmethod& + call delete('Xfile') +endfunc + +func Test_combining_folds_indent() + new + let one = "\a" + let zero = 'a' + call setline(1, [one, one, zero, zero, zero, one, one, one]) + set foldmethod=indent + 3,5d + %foldclose + call assert_equal(5, foldclosedend(1)) + + set foldmethod& + bwipe! +endfunc + +func Test_combining_folds_marker() + new + call setline(1, ['{{{', '}}}', '', '', '', '{{{', '', '}}}']) + set foldmethod=marker + 3,5d + %foldclose + call assert_equal(2, foldclosedend(1)) + + set foldmethod& + bwipe! +endfunc + +func Test_folds_marker_in_comment() + new + call setline(1, ['" foo', 'bar', 'baz']) + setl fen fdm=marker + setl com=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\" cms=\"%s + norm! zf2j + setl nofen + :1y + call assert_equal(['" foo{{{'], getreg(0,1,1)) + :+2y + call assert_equal(['baz"}}}'], getreg(0,1,1)) + + set foldmethod& + bwipe! +endfunc + +func s:TestFoldExpr(lnum) + let thisline = getline(a:lnum) + if thisline == 'a' + return 1 + elseif thisline == 'b' + return 0 + elseif thisline == 'c' + return '<1' + elseif thisline == 'd' + return '>1' + endif + return 0 +endfunction + +func Test_update_folds_expr_read() + new + call setline(1, ['a', 'a', 'a', 'a', 'a', 'a']) + set foldmethod=expr + set foldexpr=s:TestFoldExpr(v:lnum) + 2 + foldopen + call writefile(['b', 'b', 'a', 'a', 'd', 'a', 'a', 'c'], 'Xfile') + read Xfile + %foldclose + call assert_equal(2, foldclosedend(1)) + call assert_equal(0, foldlevel(3)) + call assert_equal(0, foldlevel(4)) + call assert_equal(6, foldclosedend(5)) + call assert_equal(10, foldclosedend(7)) + call assert_equal(14, foldclosedend(11)) + + call delete('Xfile') + bwipe! + set foldmethod& foldexpr& +endfunc + func! Test_move_folds_around_manual() new let input = PrepIndent("a") + PrepIndent("b") + PrepIndent("c") -- cgit From f4a3a96b6852f2eb5cf68d26b2bf58123c39c602 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 30 Mar 2017 11:06:26 -0400 Subject: Add handling for MSGPACK_OBJECT_FLOAT{32,64} msgpack-c previously only had MSGPACK_OBJECT_FLOAT, which was a 64-bit value. Now, 32-bit and 64-bit floats are supported as distinct types, but we'll simply continue to treat everything as 64-bit types. --- src/nvim/eval/decode.c | 8 +++++++- src/nvim/msgpack_rpc/helpers.c | 13 ++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/eval/decode.c b/src/nvim/eval/decode.c index 3cb68e093b..fb31a65971 100644 --- a/src/nvim/eval/decode.c +++ b/src/nvim/eval/decode.c @@ -973,7 +973,13 @@ int msgpack_to_vim(const msgpack_object mobj, typval_T *const rettv) } break; } - case MSGPACK_OBJECT_FLOAT: { +#ifdef NVIM_MSGPACK_HAS_FLOAT32 + case MSGPACK_OBJECT_FLOAT32: + case MSGPACK_OBJECT_FLOAT64: +#else + case MSGPACK_OBJECT_FLOAT: +#endif + { *rettv = (typval_T) { .v_type = VAR_FLOAT, .v_lock = VAR_UNLOCKED, diff --git a/src/nvim/msgpack_rpc/helpers.c b/src/nvim/msgpack_rpc/helpers.c index 808bb863fd..4d8a9984e1 100644 --- a/src/nvim/msgpack_rpc/helpers.c +++ b/src/nvim/msgpack_rpc/helpers.c @@ -114,7 +114,13 @@ bool msgpack_rpc_to_object(const msgpack_object *const obj, Object *const arg) } break; } - case MSGPACK_OBJECT_FLOAT: { +#ifdef NVIM_MSGPACK_HAS_FLOAT32 + case MSGPACK_OBJECT_FLOAT32: + case MSGPACK_OBJECT_FLOAT64: +#else + case MSGPACK_OBJECT_FLOAT: +#endif + { STATIC_ASSERT(sizeof(Float) == sizeof(cur.mobj->via.f64), "Msgpack floating-point size does not match API integer"); *cur.aobj = FLOATING_OBJ(cur.mobj->via.f64); @@ -181,7 +187,12 @@ bool msgpack_rpc_to_object(const msgpack_object *const obj, Object *const arg) case MSGPACK_OBJECT_BOOLEAN: case MSGPACK_OBJECT_POSITIVE_INTEGER: case MSGPACK_OBJECT_NEGATIVE_INTEGER: +#ifdef NVIM_MSGPACK_HAS_FLOAT32 + case MSGPACK_OBJECT_FLOAT32: + case MSGPACK_OBJECT_FLOAT64: +#else case MSGPACK_OBJECT_FLOAT: +#endif case MSGPACK_OBJECT_EXT: case MSGPACK_OBJECT_MAP: case MSGPACK_OBJECT_ARRAY: { -- cgit From 338da727cdb19a15a0b001707e8778e10977e65c Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 30 Mar 2017 22:11:40 -0400 Subject: coverity/161216: Ensure buf is valid for lifetime of defstr Depending on the type of argument for input()/inputdialog()'s {text} argument, defstr may point to buf. Therefore it needs to be in scope for the lifetime of defstr. Also, use a different buffer for the handling of the 3rd argument to input()/inputdialog(). Although the buffer defstr points to is used immediately, it avoids potential mishaps if the code changes. --- src/nvim/eval.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 80c2fe10d7..c683fe4e10 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -11008,18 +11008,19 @@ static void get_user_input(typval_T *argvars, typval_T *rettv, int inputdialog) cmdline_row = msg_row; const char *defstr = ""; + char buf[NUMBUFLEN]; if (argvars[1].v_type != VAR_UNKNOWN) { - char buf[NUMBUFLEN]; defstr = tv_get_string_buf_chk(&argvars[1], buf); if (defstr != NULL) { stuffReadbuffSpec(defstr); } if (!inputdialog && argvars[2].v_type != VAR_UNKNOWN) { + char buf2[NUMBUFLEN]; // input() with a third argument: completion rettv->vval.v_string = NULL; - const char *const xp_name = tv_get_string_buf_chk(&argvars[2], buf); + const char *const xp_name = tv_get_string_buf_chk(&argvars[2], buf2); if (xp_name == NULL) { return; } -- cgit From 030c0588a04c7b201ed21ab6bcbc38c040e3d5b6 Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 31 Mar 2017 10:51:41 +0300 Subject: cmake: Add `clint` target to build Makefile Allows linting only modified files and linting multiple files in parallel. In the current state is rather slow because errors.json is a 6 MiB file and needs to be reparsed each time. Results on my system (6-core): # In build dir, actually parallel make -j5 clint 241.24s user 8.39s system 334% cpu 1:14.74 total # In root, one process make -j5 clint 60.69s user 0.37s system 93% cpu 1:05.19 total In both cases download time included. That is not well for travis (though I would keep travis as-is because new variant will fail before checking all files), but already good enough for regular development: total times are nearly identical and this is the *full* build, further `make -C build clint` will check only modified files. --- src/nvim/CMakeLists.txt | 147 ++++++++++++++++++++++++++++++------------------ 1 file changed, 92 insertions(+), 55 deletions(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index a3bacaa9d2..68c0339dc5 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -10,6 +10,7 @@ if(USE_GCOV) endif() endif() +set(TOUCHES_DIR ${PROJECT_BINARY_DIR}/touches) set(GENERATED_DIR ${PROJECT_BINARY_DIR}/src/nvim/auto) set(DISPATCH_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/gendispatch.lua) file(GLOB API_HEADERS api/*.h) @@ -34,11 +35,16 @@ set(UNICODE_TABLES_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/genunicodetables.lua) set(UNICODE_DIR ${PROJECT_SOURCE_DIR}/unicode) file(GLOB UNICODE_FILES ${UNICODE_DIR}/*.txt) set(GENERATED_UNICODE_TABLES ${GENERATED_DIR}/unicode_tables.generated.h) +set(LINT_SUPPRESS_FILE ${PROJECT_BINARY_DIR}/errors.json) +set(LINT_SUPPRESS_URL "https://raw.githubusercontent.com/neovim/doc/gh-pages/reports/clint/errors.json") +set(LINT_PRG ${PROJECT_SOURCE_DIR}/src/clint.py) +set(DOWNLOAD_SCRIPT ${PROJECT_SOURCE_DIR}/cmake/Download.cmake) include_directories(${GENERATED_DIR}) include_directories(${CACHED_GENERATED_DIR}) include_directories(${GENERATED_INCLUDES_DIR}) +file(MAKE_DIRECTORY ${TOUCHES_DIR}) file(MAKE_DIRECTORY ${GENERATED_DIR}) file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}) @@ -73,6 +79,8 @@ file(GLOB UNIT_TEST_FIXTURES ${PROJECT_SOURCE_DIR}/test/unit/fixtures/*.c) list(SORT NVIM_SOURCES) list(SORT NVIM_HEADERS) +list(APPEND LINT_NVIM_SOURCES ${NVIM_SOURCES} ${NVIM_HEADERS}) + foreach(sfile ${NVIM_SOURCES}) get_filename_component(f ${sfile} NAME) if(${f} MATCHES "^(regexp_nfa.c)$") @@ -393,76 +401,82 @@ add_library(nvim-test MODULE EXCLUDE_FROM_ALL ${NVIM_GENERATED_FOR_SOURCES} ${NV target_link_libraries(nvim-test ${NVIM_LINK_LIBRARIES}) set_property(TARGET nvim-test APPEND_STRING PROPERTY COMPILE_FLAGS -DUNIT_TESTING) -set(NO_SINGLE_CHECK_HEADERS - cursor_shape - diff - digraph - ex_cmds - ex_getln - file_search - fold - getchar - hardcopy - if_cscope - if_cscope_defs - mark - mbyte - memfile_defs - memline - memline_defs - menu - misc2 - move - msgpack_rpc/server - ops - option - os/shell - os_unix - os/win_defs - popupmnu - quickfix - regexp - regexp_defs - screen - search - sha256 - sign_defs - spell - spellfile - syntax - syntax_defs - tag - terminal - tui/tui - ugrid - ui - ui_bridge - undo - undo_defs - version - window -) -foreach(hfile ${NVIM_HEADERS}) - get_filename_component(full_d ${hfile} PATH) +function(get_test_target prefix sfile relative_path_var target_var) + get_filename_component(full_d "${sfile}" PATH) file(RELATIVE_PATH d "${PROJECT_SOURCE_DIR}/src/nvim" "${full_d}") if(${d} MATCHES "^[.][.]") file(RELATIVE_PATH d "${GENERATED_DIR}" "${full_d}") endif() - get_filename_component(r ${hfile} NAME_WE) + get_filename_component(r "${sfile}" NAME) if(NOT ${d} EQUAL ".") set(r "${d}/${r}") endif() + string(REGEX REPLACE "[/.]" "-" suffix "${r}") + set(${relative_path_var} ${r} PARENT_SCOPE) + set(${target_var} "${prefix}-${suffix}" PARENT_SCOPE) +endfunction() + +set(NO_SINGLE_CHECK_HEADERS + cursor_shape.h + diff.h + digraph.h + ex_cmds.h + ex_getln.h + file_search.h + fold.h + getchar.h + hardcopy.h + if_cscope.h + if_cscope_defs.h + mark.h + mbyte.h + memfile_defs.h + memline.h + memline_defs.h + menu.h + misc2.h + move.h + msgpack_rpc/server.h + ops.h + option.h + os/shell.h + os_unix.h + os/win_defs.h + popupmnu.h + quickfix.h + regexp.h + regexp_defs.h + screen.h + search.h + sha256.h + sign_defs.h + spell.h + spellfile.h + syntax.h + syntax_defs.h + tag.h + terminal.h + tui/tui.h + ugrid.h + ui.h + ui_bridge.h + undo.h + undo_defs.h + version.h + window.h +) +foreach(hfile ${NVIM_HEADERS}) + get_test_target(test-includes "${hfile}" relative_path texe) if(NOT ${hfile} MATCHES "[.]c[.]h$") - set(tsource "${GENERATED_DIR}/${r}.test-include.c") - string(REPLACE "/" "-" texe "test-incl-${r}") + set(tsource "${GENERATED_DIR}/${relative_path}.test-include.c") write_file("${tsource}" "#include \"${hfile}\"\nint main(int argc, char **argv) { return 0; }") add_executable( ${texe} EXCLUDE_FROM_ALL ${tsource} ${NVIM_HEADERS} ${NVIM_GENERATED_FOR_HEADERS}) - list(FIND NO_SINGLE_CHECK_HEADERS "${r}" hfile_exclude_idx) + list(FIND NO_SINGLE_CHECK_HEADERS "${relative_path}" hfile_exclude_idx) if(${hfile_exclude_idx} EQUAL -1) list(APPEND HEADER_CHECK_TARGETS ${texe}) endif() @@ -470,4 +484,27 @@ foreach(hfile ${NVIM_HEADERS}) endforeach() add_custom_target(check-single-includes DEPENDS ${HEADER_CHECK_TARGETS}) +function(add_download output url) + add_custom_command( + OUTPUT "${output}" + COMMAND ${CMAKE_COMMAND} -DURL=${url} -DFILE=${output} -P ${DOWNLOAD_SCRIPT} + DEPENDS ${DOWNLOAD_SCRIPT} + ) +endfunction() + +add_download(${LINT_SUPPRESS_FILE} ${LINT_SUPPRESS_URL}) + +foreach(sfile ${LINT_NVIM_SOURCES}) + get_test_target("${TOUCHES_DIR}/ran-clint" "${sfile}" r touch_file) + add_custom_command( + OUTPUT ${touch_file} + COMMAND ${LINT_PRG} --suppress-errors=${LINT_SUPPRESS_FILE} src/nvim/${r} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} -E touch ${touch_file} + DEPENDS ${sfile} ${LINT_SUPPRESS_FILE} + ) + list(APPEND LINT_TARGETS ${touch_file}) +endforeach() +add_custom_target(clint DEPENDS ${LINT_TARGETS}) + add_subdirectory(po) -- cgit From 0b528fc4b55a8875579d0a1a5dde852b6c3f55dc Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 31 Mar 2017 11:38:08 +0300 Subject: cmake: Use file-specific supprresses `make -C build clint` time is now make -j5 clint 95.29s user 1.86s system 409% cpu 23.751 total *without* downloading anything (much worse if something was not cached, still a bit better then top-level `make clint`). But since without neovim/bot-ci#95 it is downloading each file one-by-one total time with download (download also parallel!) is make -j5 -B clint 99.29s user 2.98s system 258% cpu 39.634 total Top-level makefile still gives make -j5 clint 59.33s user 0.28s system 95% cpu 1:02.41 total --- src/nvim/CMakeLists.txt | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 68c0339dc5..b4bc3afc05 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -36,9 +36,12 @@ set(UNICODE_DIR ${PROJECT_SOURCE_DIR}/unicode) file(GLOB UNICODE_FILES ${UNICODE_DIR}/*.txt) set(GENERATED_UNICODE_TABLES ${GENERATED_DIR}/unicode_tables.generated.h) set(LINT_SUPPRESS_FILE ${PROJECT_BINARY_DIR}/errors.json) -set(LINT_SUPPRESS_URL "https://raw.githubusercontent.com/neovim/doc/gh-pages/reports/clint/errors.json") +set(LINT_SUPPRESS_URL_BASE "https://raw.githubusercontent.com/neovim/doc/gh-pages/reports/clint") +set(LINT_SUPPRESS_URL "${LINT_SUPPRESS_URL_BASE}/errors.json") set(LINT_PRG ${PROJECT_SOURCE_DIR}/src/clint.py) set(DOWNLOAD_SCRIPT ${PROJECT_SOURCE_DIR}/cmake/Download.cmake) +set(LINT_SUPPRESSES_ROOT ${PROJECT_BINARY_DIR}/errors) +set(LINT_SUPPRESSES_URL "https://raw.githubusercontent.com/neovim/doc/gh-pages/reports/clint/errors.tar.gz") include_directories(${GENERATED_DIR}) include_directories(${CACHED_GENERATED_DIR}) @@ -404,16 +407,20 @@ set_property(TARGET nvim-test APPEND_STRING PROPERTY COMPILE_FLAGS -DUNIT_TESTIN function(get_test_target prefix sfile relative_path_var target_var) get_filename_component(full_d "${sfile}" PATH) file(RELATIVE_PATH d "${PROJECT_SOURCE_DIR}/src/nvim" "${full_d}") - if(${d} MATCHES "^[.][.]") + if(d MATCHES "^[.][.]") file(RELATIVE_PATH d "${GENERATED_DIR}" "${full_d}") endif() get_filename_component(r "${sfile}" NAME) - if(NOT ${d} EQUAL ".") + if(NOT d MATCHES "^[.]?$") set(r "${d}/${r}") endif() string(REGEX REPLACE "[/.]" "-" suffix "${r}") set(${relative_path_var} ${r} PARENT_SCOPE) - set(${target_var} "${prefix}-${suffix}" PARENT_SCOPE) + if(prefix STREQUAL "") + set(${target_var} "${suffix}" PARENT_SCOPE) + else() + set(${target_var} "${prefix}-${suffix}" PARENT_SCOPE) + endif() endfunction() set(NO_SINGLE_CHECK_HEADERS @@ -495,13 +502,17 @@ endfunction() add_download(${LINT_SUPPRESS_FILE} ${LINT_SUPPRESS_URL}) foreach(sfile ${LINT_NVIM_SOURCES}) - get_test_target("${TOUCHES_DIR}/ran-clint" "${sfile}" r touch_file) + get_test_target("" "${sfile}" r suffix) + set(suppress_file ${LINT_SUPPRESSES_ROOT}/${suffix}.json) + set(suppress_url "${LINT_SUPPRESS_URL_BASE}/${suffix}.json") + add_download(${suppress_file} ${suppress_url}) + set(touch_file "${TOUCHES_DIR}/ran-clint-${suffix}") add_custom_command( OUTPUT ${touch_file} - COMMAND ${LINT_PRG} --suppress-errors=${LINT_SUPPRESS_FILE} src/nvim/${r} + COMMAND ${LINT_PRG} --suppress-errors=${suppress_file} src/nvim/${r} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${CMAKE_COMMAND} -E touch ${touch_file} - DEPENDS ${sfile} ${LINT_SUPPRESS_FILE} + DEPENDS ${sfile} ${suppress_file} ) list(APPEND LINT_TARGETS ${touch_file}) endforeach() -- cgit From 24fd125893203c667789cb574b289fc1c9eaf6bc Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 31 Mar 2017 11:49:18 +0300 Subject: cmake: Allow failing to download small suppress files --- src/nvim/CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index b4bc3afc05..f5f4173879 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -491,21 +491,25 @@ foreach(hfile ${NVIM_HEADERS}) endforeach() add_custom_target(check-single-includes DEPENDS ${HEADER_CHECK_TARGETS}) -function(add_download output url) +function(add_download output url allow_failure) add_custom_command( OUTPUT "${output}" - COMMAND ${CMAKE_COMMAND} -DURL=${url} -DFILE=${output} -P ${DOWNLOAD_SCRIPT} + COMMAND + ${CMAKE_COMMAND} + -DURL=${url} -DFILE=${output} + -DALLOW_FAILURE=${allow_failure} + -P ${DOWNLOAD_SCRIPT} DEPENDS ${DOWNLOAD_SCRIPT} ) endfunction() -add_download(${LINT_SUPPRESS_FILE} ${LINT_SUPPRESS_URL}) +add_download(${LINT_SUPPRESS_FILE} ${LINT_SUPPRESS_URL} off) foreach(sfile ${LINT_NVIM_SOURCES}) get_test_target("" "${sfile}" r suffix) set(suppress_file ${LINT_SUPPRESSES_ROOT}/${suffix}.json) set(suppress_url "${LINT_SUPPRESS_URL_BASE}/${suffix}.json") - add_download(${suppress_file} ${suppress_url}) + add_download(${suppress_file} ${suppress_url} on) set(touch_file "${TOUCHES_DIR}/ran-clint-${suffix}") add_custom_command( OUTPUT ${touch_file} -- cgit From c61858a9978504c645f09de60daf4f9786c2220e Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 31 Mar 2017 12:02:59 +0300 Subject: cmake: Replace RunLint.cmake with code in src/nvim/CMakeLists.txt This also removes LINT_FILE environment variable, other then that functionality is kept. It is expected that developers needing partial linting will use `make lint`, touching interesting file before (if not done already by writing to them). --- src/nvim/CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index f5f4173879..b19bdf2326 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -505,21 +505,32 @@ endfunction() add_download(${LINT_SUPPRESS_FILE} ${LINT_SUPPRESS_URL} off) +set(LINT_NVIM_REL_SOURCES) foreach(sfile ${LINT_NVIM_SOURCES}) get_test_target("" "${sfile}" r suffix) set(suppress_file ${LINT_SUPPRESSES_ROOT}/${suffix}.json) set(suppress_url "${LINT_SUPPRESS_URL_BASE}/${suffix}.json") + set(rsfile src/nvim/${r}) add_download(${suppress_file} ${suppress_url} on) set(touch_file "${TOUCHES_DIR}/ran-clint-${suffix}") add_custom_command( OUTPUT ${touch_file} - COMMAND ${LINT_PRG} --suppress-errors=${suppress_file} src/nvim/${r} + COMMAND ${LINT_PRG} --suppress-errors=${suppress_file} ${rsfile} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${CMAKE_COMMAND} -E touch ${touch_file} DEPENDS ${sfile} ${suppress_file} ) list(APPEND LINT_TARGETS ${touch_file}) + list(APPEND LINT_NVIM_REL_SOURCES ${rsfile}) endforeach() add_custom_target(clint DEPENDS ${LINT_TARGETS}) +add_custom_target( + clint-full + COMMAND + ${LINT_PRG} --suppress-errors=${LINT_SUPPRESS_FILE} ${LINT_NVIM_REL_SOURCES} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + DEPENDS ${LINT_NVIM_SOURCES} ${LINT_SUPPRESS_FILE} +) + add_subdirectory(po) -- cgit From 4fc2be490cd075d08ef8532f954424051fe49300 Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 31 Mar 2017 12:27:13 +0300 Subject: clint: Do not report zero errors --- src/clint.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/clint.py b/src/clint.py index 61c53d128e..5174521fb8 100755 --- a/src/clint.py +++ b/src/clint.py @@ -571,7 +571,8 @@ class _CppLintState(object): for category, count in self.errors_by_category.items(): sys.stderr.write('Category \'%s\' errors found: %d\n' % (category, count)) - sys.stderr.write('Total errors found: %d\n' % self.error_count) + if self.error_count: + sys.stderr.write('Total errors found: %d\n' % self.error_count) def SuppressErrorsFrom(self, fname): """Open file and read a list of suppressed errors from it""" -- cgit From 4d0f90f94db6040841b9987d02a021b785cfe0f3 Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 31 Mar 2017 12:28:10 +0300 Subject: cmake: Also depend on LINT_PRG --- src/nvim/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index b19bdf2326..5a5ebc4415 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -518,7 +518,7 @@ foreach(sfile ${LINT_NVIM_SOURCES}) COMMAND ${LINT_PRG} --suppress-errors=${suppress_file} ${rsfile} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${CMAKE_COMMAND} -E touch ${touch_file} - DEPENDS ${sfile} ${suppress_file} + DEPENDS ${LINT_PRG} ${sfile} ${suppress_file} ) list(APPEND LINT_TARGETS ${touch_file}) list(APPEND LINT_NVIM_REL_SOURCES ${rsfile}) @@ -530,7 +530,7 @@ add_custom_target( COMMAND ${LINT_PRG} --suppress-errors=${LINT_SUPPRESS_FILE} ${LINT_NVIM_REL_SOURCES} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - DEPENDS ${LINT_NVIM_SOURCES} ${LINT_SUPPRESS_FILE} + DEPENDS ${LINT_PRG} ${LINT_NVIM_SOURCES} ${LINT_SUPPRESS_FILE} ) add_subdirectory(po) -- cgit From 53da57d27a8ee47fe42604ad07bb7c956d9012f5 Mon Sep 17 00:00:00 2001 From: lonerover Date: Wed, 22 Mar 2017 12:24:07 +0800 Subject: vim-patch:7.4.2236 Problem: The 'langnoremap' option leads to double negatives. And it does not work for the last character of a mapping. Solution: Add 'langremap' with the opposite value. Keep 'langnoremap' for backwards compatibility. Make it work for the last character of a mapping. Make the test work. https://github.com/vim/vim/commit/920694c1b60fac8017b8909efcc24f189804a9bb --- src/nvim/macros.h | 2 +- src/nvim/option.c | 6 ++++ src/nvim/option_defs.h | 5 +-- src/nvim/options.lua | 6 ++++ src/nvim/testdir/test_mapping.vim | 74 +++++++++++++++++++++++++++++++-------- src/nvim/version.c | 2 +- 6 files changed, 76 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/nvim/macros.h b/src/nvim/macros.h index 5042663041..a8df6322cf 100644 --- a/src/nvim/macros.h +++ b/src/nvim/macros.h @@ -94,7 +94,7 @@ do { \ if (*p_langmap \ && (condition) \ - && (!p_lnr || (p_lnr && typebuf_maplen() == 0)) \ + && (p_lrm || (!p_lrm && KeyTyped)) \ && !KeyStuffed \ && (c) >= 0) \ { \ diff --git a/src/nvim/option.c b/src/nvim/option.c index 0b4d9aae5d..b3b4dc1e0a 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -3630,6 +3630,12 @@ static char *set_bool_option(const int opt_idx, char_u *const varp, } else if ((int *)varp == &p_force_off && p_force_off == true) { p_force_off = false; return (char *)e_unsupportedoption; + } else if ((int *)varp == &p_lrm) { + // 'langremap' -> !'langnoremap' + p_lnr = !p_lrm; + } else if ((int *)varp == &p_lnr) { + // 'langnoremap' -> !'langremap' + p_lrm = !p_lnr; // 'undofile' } else if ((int *)varp == &curbuf->b_p_udf || (int *)varp == &p_udf) { // Only take action when the option was set. When reset we do not diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 2475a0b6a1..4ee0f4f225 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -476,8 +476,9 @@ EXTERN char_u *p_isp; // 'isprint' EXTERN int p_js; // 'joinspaces' EXTERN char_u *p_kp; // 'keywordprg' EXTERN char_u *p_km; // 'keymodel' -EXTERN char_u *p_langmap; // 'langmap'*/ -EXTERN int p_lnr; // 'langnoremap'*/ +EXTERN char_u *p_langmap; // 'langmap' +EXTERN int p_lnr; // 'langnoremap' +EXTERN int p_lrm; // 'langremap' EXTERN char_u *p_lm; // 'langmenu' EXTERN char_u *p_lispwords; // 'lispwords' EXTERN long p_ls; // 'laststatus' diff --git a/src/nvim/options.lua b/src/nvim/options.lua index ee2b8a563d..9dff3410d6 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -1346,6 +1346,12 @@ return { varname='p_lnr', defaults={if_true={vi=false, vim=true}} }, + { + full_name='langremap', abbreviation='lrm', + type='bool', scope={'global'}, + varname='p_lrm', + defaults={if_true={vi=true, vim=false}} + }, { full_name='laststatus', abbreviation='ls', type='number', scope={'global'}, diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim index d937565ce5..3b6dcdccf5 100644 --- a/src/nvim/testdir/test_mapping.vim +++ b/src/nvim/testdir/test_mapping.vim @@ -35,29 +35,73 @@ func Test_map_ctrl_c_visual() endfunc func Test_map_langmap() - " langmap should not get remapped in insert mode - inoremap { FAIL_ilangmap - set langmap=+{ langnoremap + if !has('langmap') + return + endif + + " check langmap applies in normal mode + set langmap=+- nolangremap + new + call setline(1, ['a', 'b', 'c']) + 2 + call assert_equal('b', getline('.')) + call feedkeys("+", "xt") + call assert_equal('a', getline('.')) + + " check no remapping + map x + + 2 + call feedkeys("x", "xt") + call assert_equal('c', getline('.')) + + " check with remapping + set langremap + 2 + call feedkeys("x", "xt") + call assert_equal('a', getline('.')) + + unmap x + bwipe! + + " 'langnoremap' follows 'langremap' and vise versa + set langremap + set langnoremap + call assert_equal(0, &langremap) + set langremap + call assert_equal(0, &langnoremap) + set nolangremap + call assert_equal(1, &langnoremap) + + " langmap should not apply in insert mode, 'langremap' doesn't matter + set langmap=+{ nolangremap call feedkeys("Go+\", "xt") call assert_equal('+', getline('$')) - - " Insert-mode expr mapping with langmap - inoremap { "FAIL_iexplangmap" + set langmap=+{ langremap call feedkeys("Go+\", "xt") call assert_equal('+', getline('$')) - iunmap { - " langmap should not get remapped in Command-line mode - cnoremap { FAIL_clangmap + " langmap used for register name in insert mode. + call setreg('a', 'aaaa') + call setreg('b', 'bbbb') + call setreg('c', 'cccc') + set langmap=ab langremap + call feedkeys("Go\a\", "xt") + call assert_equal('bbbb', getline('$')) + call feedkeys("Go\\a\", "xt") + call assert_equal('bbbb', getline('$')) + " mapping does not apply + imap c a + call feedkeys("Go\c\", "xt") + call assert_equal('cccc', getline('$')) + imap a c + call feedkeys("Go\a\", "xt") + call assert_equal('bbbb', getline('$')) + + " langmap should not apply in Command-line mode + set langmap=+{ nolangremap call feedkeys(":call append(line('$'), '+')\", "xt") call assert_equal('+', getline('$')) - cunmap { - " Command-line mode expr mapping with langmap - cnoremap { "FAIL_cexplangmap" - call feedkeys(":call append(line('$'), '+')\", "xt") - call assert_equal('+', getline('$')) - cunmap { set nomodified endfunc diff --git a/src/nvim/version.c b/src/nvim/version.c index fdf5436a98..ba1ebc8f2c 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -205,7 +205,7 @@ static const int included_patches[] = { // 2239, // 2238 NA 2237, - // 2236, + 2236, 2235, // 2234 NA 2233, -- cgit From 45a13c4bbc4a7c4f62a299c832ecc192d8f3cd0a Mon Sep 17 00:00:00 2001 From: lonerover Date: Wed, 22 Mar 2017 12:52:15 +0800 Subject: vim-patch:7.4.2306 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Default value for 'langremap' is wrong. Solution: Set the right value. (Jürgen Krämer) Add a test. https://github.com/vim/vim/commit/da9ce2cde11ddd0e16cdfbab6d4ac4e8110218e1 --- src/nvim/testdir/test_mapping.vim | 8 ++++++++ src/nvim/version.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim index 3b6dcdccf5..6b313ff54f 100644 --- a/src/nvim/testdir/test_mapping.vim +++ b/src/nvim/testdir/test_mapping.vim @@ -72,6 +72,14 @@ func Test_map_langmap() set nolangremap call assert_equal(1, &langnoremap) + " check default values + set langnoremap& + call assert_equal(1, &langnoremap) + call assert_equal(0, &langremap) + set langremap& + call assert_equal(1, &langnoremap) + call assert_equal(0, &langremap) + " langmap should not apply in insert mode, 'langremap' doesn't matter set langmap=+{ nolangremap call feedkeys("Go+\", "xt") diff --git a/src/nvim/version.c b/src/nvim/version.c index ba1ebc8f2c..0ee0419849 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -135,7 +135,7 @@ static const int included_patches[] = { 2309, // 2308 NA 2307, - // 2306, + 2306, 2305, // 2304 NA 2303, -- cgit From cc4523013f8e693f92de3b96ff36065895c60974 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 1 Apr 2017 21:13:21 +0300 Subject: eval,fileio: Omit additional fsync() call Fixes #6420 --- src/nvim/eval.c | 2 +- src/nvim/os/fileio.c | 31 +++++++++++++++++++++++-------- 2 files changed, 24 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 15b712e7de..a6774a3a0b 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -17289,7 +17289,7 @@ static bool write_list(FileDescriptor *const fp, const list_T *const list, } } } - if ((error = file_fsync(fp)) != 0) { + if ((error = file_flush(fp)) != 0) { goto write_list_error; } return true; diff --git a/src/nvim/os/fileio.c b/src/nvim/os/fileio.c index 775f2bd449..3c928363cc 100644 --- a/src/nvim/os/fileio.c +++ b/src/nvim/os/fileio.c @@ -143,21 +143,36 @@ int file_free(FileDescriptor *const fp) FUNC_ATTR_NONNULL_ALL /// @param[in,out] fp File to work with. /// /// @return 0 or error code. -int file_fsync(FileDescriptor *const fp) +int file_flush(FileDescriptor *const fp) FUNC_ATTR_NONNULL_ALL { if (!fp->wr) { return 0; } file_rb_write_full_cb(fp->rv, fp); - if (fp->_error != 0) { - const int error = fp->_error; - fp->_error = 0; - return error; + const int error = fp->_error; + fp->_error = 0; + return error; +} + +/// Flush file modifications to disk and run fsync() +/// +/// @param[in,out] fp File to work with. +/// +/// @return 0 or error code. +int file_fsync(FileDescriptor *const fp) + FUNC_ATTR_NONNULL_ALL +{ + if (!fp->wr) { + return 0; } - const int error = os_fsync(fp->fd); - if (error != UV_EINVAL && error != UV_EROFS) { - return error; + const int flush_error = file_flush(fp); + if (flush_error != 0) { + return flush_error; + } + const int fsync_error = os_fsync(fp->fd); + if (fsync_error != UV_EINVAL && fsync_error != UV_EROFS) { + return fsync_error; } return 0; } -- cgit From 19690d4a25f15dfa752ac3723384f1d33f06329a Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 1 Apr 2017 22:26:50 +0300 Subject: eval: Do not allocate FileDescriptor --- src/nvim/eval.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index a6774a3a0b..f0d78a2508 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -17439,21 +17439,21 @@ static void f_writefile(typval_T *argvars, typval_T *rettv, FunPtr fptr) if (fname == NULL) { return; } - FileDescriptor *fp; + FileDescriptor fp; int error; rettv->vval.v_number = -1; if (*fname == NUL) { EMSG(_("E482: Can't open file with an empty name")); - } else if ((fp = file_open_new(&error, fname, - ((append ? kFileAppend : kFileTruncate) - | kFileCreate), 0666)) == NULL) { + } else if ((error = file_open(&fp, fname, + ((append ? kFileAppend : kFileTruncate) + | kFileCreate), 0666)) != 0) { emsgf(_("E482: Can't open file %s for writing: %s"), fname, os_strerror(error)); } else { - if (write_list(fp, argvars[0].vval.v_list, binary)) { + if (write_list(&fp, argvars[0].vval.v_list, binary)) { rettv->vval.v_number = 0; } - if ((error = file_free(fp)) != 0) { + if ((error = file_close(&fp)) != 0) { emsgf(_("E80: Error when closing file %s: %s"), fname, os_strerror(error)); } -- cgit From 337b6179df852350b52409fd3806e4b47ab2875b Mon Sep 17 00:00:00 2001 From: Matthew Malcomson Date: Sat, 1 Apr 2017 20:50:29 +0100 Subject: 'pastetoggle': support value >1 char (#6421) If we `set pastetoggle=abcde`, and manually type it, then `vgetorpeek()` sees part of the option before it has all been inserted into the typebuffer. To signify this it sets `keylen = KEYLEN_PART_KEY`, but the condition about whether to return the current key from `vgetorpeek()` only checks for `keylen = KEYLEN_PART_MAP`. Add a check for `KEYLEN_PART_KEY` to account for the `'pastetoggle'` option. --- src/nvim/getchar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 7143819e21..b83681ad01 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1903,7 +1903,7 @@ static int vgetorpeek(int advance) } if ((mp == NULL || max_mlen >= mp_match_len) - && keylen != KEYLEN_PART_MAP) { + && keylen != KEYLEN_PART_MAP && keylen != KEYLEN_PART_KEY) { // No matching mapping found or found a non-matching mapping that // matches at least what the matching mapping matched keylen = 0; -- cgit From dd4a5fcbb65ade08b5d2c7951b2924d2d04dc99e Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Mon, 20 Mar 2017 22:56:58 +0100 Subject: tui: 'guicursor' shape #6044 Closes #2583 --- src/nvim/api/ui.c | 10 +++ src/nvim/cursor_shape.c | 140 +++++++++++++++++++++++++++------------ src/nvim/cursor_shape.h | 73 +++++++++++---------- src/nvim/syntax.c | 53 +++++++-------- src/nvim/tui/tui.c | 170 +++++++++++++++++++++++++++++++++++------------- src/nvim/tui/tui.h | 2 + src/nvim/ui.c | 9 +++ src/nvim/ui.h | 1 + src/nvim/ui_bridge.c | 19 ++++++ 9 files changed, 330 insertions(+), 147 deletions(-) (limited to 'src') diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 625bcc6b4b..a95be0fabb 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -12,6 +12,7 @@ #include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/popupmnu.h" +#include "nvim/cursor_shape.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "api/ui.c.generated.h" @@ -69,6 +70,7 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, ui->clear = remote_ui_clear; ui->eol_clear = remote_ui_eol_clear; ui->cursor_goto = remote_ui_cursor_goto; + ui->cursor_style_set = remote_ui_cursor_style_set; ui->update_menu = remote_ui_update_menu; ui->busy_start = remote_ui_busy_start; ui->busy_stop = remote_ui_busy_stop; @@ -298,6 +300,14 @@ static void remote_ui_scroll(UI *ui, int count) push_call(ui, "scroll", args); } +static void remote_ui_cursor_style_set(UI *ui, Dictionary styles) +{ + Array args = ARRAY_DICT_INIT; + Object copy = copy_object(DICTIONARY_OBJ(styles)); + ADD(args, copy); + push_call(ui, "cursor_style_set", args); +} + static void remote_ui_highlight_set(UI *ui, HlAttrs attrs) { Array args = ARRAY_DICT_INIT; diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c index b50462664c..9f0eb215ef 100644 --- a/src/nvim/cursor_shape.c +++ b/src/nvim/cursor_shape.c @@ -7,40 +7,84 @@ #include "nvim/charset.h" #include "nvim/strings.h" #include "nvim/syntax.h" +#include "nvim/api/private/helpers.h" +#include "nvim/ui.h" -/* - * Handling of cursor and mouse pointer shapes in various modes. - */ - +/// Handling of cursor and mouse pointer shapes in various modes. static cursorentry_T shape_table[SHAPE_IDX_COUNT] = { - /* The values will be filled in from the 'guicursor' and 'mouseshape' - * defaults when Vim starts. - * Adjust the SHAPE_IDX_ defines when making changes! */ - {0, 0, 0, 700L, 400L, 250L, 0, 0, "n", SHAPE_CURSOR+SHAPE_MOUSE}, - {0, 0, 0, 700L, 400L, 250L, 0, 0, "v", SHAPE_CURSOR+SHAPE_MOUSE}, - {0, 0, 0, 700L, 400L, 250L, 0, 0, "i", SHAPE_CURSOR+SHAPE_MOUSE}, - {0, 0, 0, 700L, 400L, 250L, 0, 0, "r", SHAPE_CURSOR+SHAPE_MOUSE}, - {0, 0, 0, 700L, 400L, 250L, 0, 0, "c", SHAPE_CURSOR+SHAPE_MOUSE}, - {0, 0, 0, 700L, 400L, 250L, 0, 0, "ci", SHAPE_CURSOR+SHAPE_MOUSE}, - {0, 0, 0, 700L, 400L, 250L, 0, 0, "cr", SHAPE_CURSOR+SHAPE_MOUSE}, - {0, 0, 0, 700L, 400L, 250L, 0, 0, "o", SHAPE_CURSOR+SHAPE_MOUSE}, - {0, 0, 0, 700L, 400L, 250L, 0, 0, "ve", SHAPE_CURSOR+SHAPE_MOUSE}, - {0, 0, 0, 0L, 0L, 0L, 0, 0, "e", SHAPE_MOUSE}, - {0, 0, 0, 0L, 0L, 0L, 0, 0, "s", SHAPE_MOUSE}, - {0, 0, 0, 0L, 0L, 0L, 0, 0, "sd", SHAPE_MOUSE}, - {0, 0, 0, 0L, 0L, 0L, 0, 0, "vs", SHAPE_MOUSE}, - {0, 0, 0, 0L, 0L, 0L, 0, 0, "vd", SHAPE_MOUSE}, - {0, 0, 0, 0L, 0L, 0L, 0, 0, "m", SHAPE_MOUSE}, - {0, 0, 0, 0L, 0L, 0L, 0, 0, "ml", SHAPE_MOUSE}, - {0, 0, 0, 100L, 100L, 100L, 0, 0, "sm", SHAPE_CURSOR}, + // The values will be filled in from the 'guicursor' and 'mouseshape' + // defaults when Vim starts. + // Adjust the SHAPE_IDX_ defines when making changes! + { "normal", + 0, 0, 0, 700L, 400L, 250L, 0, 0, "n", SHAPE_CURSOR+SHAPE_MOUSE }, + { "visual", + 0, 0, 0, 700L, 400L, 250L, 0, 0, "v", SHAPE_CURSOR+SHAPE_MOUSE }, + { "insert", + 0, 0, 0, 700L, 400L, 250L, 0, 0, "i", SHAPE_CURSOR+SHAPE_MOUSE }, + { "replace", + 0, 0, 0, 700L, 400L, 250L, 0, 0, "r", SHAPE_CURSOR+SHAPE_MOUSE }, + { "cmd_normal", + 0, 0, 0, 700L, 400L, 250L, 0, 0, "c", SHAPE_CURSOR+SHAPE_MOUSE }, + { "cmd_insert", 0, + 0, 0, 700L, 400L, 250L, 0, 0, "ci", SHAPE_CURSOR+SHAPE_MOUSE }, + { "cmd_replace", + 0, 0, 0, 700L, 400L, 250L, 0, 0, "cr", SHAPE_CURSOR+SHAPE_MOUSE }, + { "pending", + 0, 0, 0, 700L, 400L, 250L, 0, 0, "o", SHAPE_CURSOR+SHAPE_MOUSE }, + { "visual_select", + 0, 0, 0, 700L, 400L, 250L, 0, 0, "ve", SHAPE_CURSOR+SHAPE_MOUSE }, + { "cmd_line", 0, 0, 0, 0L, 0L, 0L, 0, 0, "e", SHAPE_MOUSE }, + { "statusline", 0, 0, 0, 0L, 0L, 0L, 0, 0, "s", SHAPE_MOUSE }, + { "drag_statusline", 0, 0, 0, 0L, 0L, 0L, 0, 0, "sd", SHAPE_MOUSE }, + { "vsep", 0, 0, 0, 0L, 0L, 0L, 0, 0, "vs", SHAPE_MOUSE }, + { "vdrag", 0, 0, 0, 0L, 0L, 0L, 0, 0, "vd", SHAPE_MOUSE }, + { "more", 0, 0, 0, 0L, 0L, 0L, 0, 0, "m", SHAPE_MOUSE }, + { "more_lastline", 0, 0, 0, 0L, 0L, 0L, 0, 0, "ml", SHAPE_MOUSE }, + { "match_paren", 0, 0, 0, 100L, 100L, 100L, 0, 0, "sm", SHAPE_CURSOR }, }; -/* - * Parse the 'guicursor' option ("what" is SHAPE_CURSOR) or 'mouseshape' - * ("what" is SHAPE_MOUSE). - * Returns error message for an illegal option, NULL otherwise. - */ +/// Converts cursor_shapes into a Dictionary of dictionaries +/// @return a dictionary of the form {"normal" : { "cursor_shape": ... }, ...} +Dictionary cursor_shape_dict(void) +{ + Dictionary all = ARRAY_DICT_INIT; + + for (int i = 0; i < SHAPE_IDX_COUNT; i++) { + Dictionary dic = ARRAY_DICT_INIT; + cursorentry_T *cur = &shape_table[i]; + if (cur->used_for & SHAPE_MOUSE) { + PUT(dic, "mouse_shape", INTEGER_OBJ(cur->mshape)); + } + if (cur->used_for & SHAPE_CURSOR) { + String shape_str; + switch (cur->shape) { + case SHAPE_BLOCK: shape_str = cstr_to_string("block"); break; + case SHAPE_VER: shape_str = cstr_to_string("vertical"); break; + case SHAPE_HOR: shape_str = cstr_to_string("horizontal"); break; + default: shape_str = cstr_to_string("unknown"); + } + PUT(dic, "cursor_shape", STRING_OBJ(shape_str)); + PUT(dic, "cell_percentage", INTEGER_OBJ(cur->percentage)); + PUT(dic, "blinkwait", INTEGER_OBJ(cur->blinkwait)); + PUT(dic, "blinkon", INTEGER_OBJ(cur->blinkon)); + PUT(dic, "blinkoff", INTEGER_OBJ(cur->blinkoff)); + PUT(dic, "hl_id", INTEGER_OBJ(cur->id)); + PUT(dic, "id_lm", INTEGER_OBJ(cur->id_lm)); + } + PUT(dic, "short_name", STRING_OBJ(cstr_to_string(cur->name))); + + PUT(all, cur->full_name, DICTIONARY_OBJ(dic)); + } + + return all; +} + +/// Parse the 'guicursor' option +/// +/// @param what either SHAPE_CURSOR or SHAPE_MOUSE ('mouseshape') +/// +/// @returns error message for an illegal option, NULL otherwise. char_u *parse_shape_opt(int what) { char_u *modep; @@ -71,19 +115,18 @@ char_u *parse_shape_opt(int what) return (char_u *)N_("E546: Illegal mode"); commap = vim_strchr(modep, ','); - /* - * Repeat for all mode's before the colon. - * For the 'a' mode, we loop to handle all the modes. - */ + // Repeat for all mode's before the colon. + // For the 'a' mode, we loop to handle all the modes. all_idx = -1; assert(modep < colonp); while (modep < colonp || all_idx >= 0) { if (all_idx < 0) { - /* Find the mode. */ - if (modep[1] == '-' || modep[1] == ':') + // Find the mode + if (modep[1] == '-' || modep[1] == ':') { len = 1; - else + } else { len = 2; + } if (len == 1 && TOLOWER_ASC(modep[0]) == 'a') { all_idx = SHAPE_IDX_COUNT - 1; @@ -100,11 +143,11 @@ char_u *parse_shape_opt(int what) modep += len + 1; } - if (all_idx >= 0) + if (all_idx >= 0) { idx = all_idx--; - else if (round == 2) { + } else if (round == 2) { { - /* Set the defaults, for the missing parts */ + // Set the defaults, for the missing parts shape_table[idx].shape = SHAPE_BLOCK; shape_table[idx].blinkwait = 700L; shape_table[idx].blinkon = 400L; @@ -208,6 +251,23 @@ char_u *parse_shape_opt(int what) shape_table[SHAPE_IDX_VE].id_lm = shape_table[SHAPE_IDX_V].id_lm; } } - + ui_cursor_style_set(); return NULL; } + + +/// Map cursor mode from string to integer +/// +/// @param mode Fullname of the mode whose id we are looking for +/// @return -1 in case of failure, else the matching SHAPE_ID* integer +int cursor_mode_str2int(const char *mode) +{ + for (int current_mode = 0; current_mode < SHAPE_IDX_COUNT; current_mode++) { + if (strcmp(shape_table[current_mode].full_name, mode) == 0) { + return current_mode; + } + } + ELOG("Unknown mode %s", mode); + return -1; +} + diff --git a/src/nvim/cursor_shape.h b/src/nvim/cursor_shape.h index 9ce1b6e0a0..127d0df555 100644 --- a/src/nvim/cursor_shape.h +++ b/src/nvim/cursor_shape.h @@ -1,32 +1,34 @@ #ifndef NVIM_CURSOR_SHAPE_H #define NVIM_CURSOR_SHAPE_H -/* - * struct to store values from 'guicursor' and 'mouseshape' - */ -/* Indexes in shape_table[] */ -#define SHAPE_IDX_N 0 /* Normal mode */ -#define SHAPE_IDX_V 1 /* Visual mode */ -#define SHAPE_IDX_I 2 /* Insert mode */ -#define SHAPE_IDX_R 3 /* Replace mode */ -#define SHAPE_IDX_C 4 /* Command line Normal mode */ -#define SHAPE_IDX_CI 5 /* Command line Insert mode */ -#define SHAPE_IDX_CR 6 /* Command line Replace mode */ -#define SHAPE_IDX_O 7 /* Operator-pending mode */ -#define SHAPE_IDX_VE 8 /* Visual mode with 'selection' exclusive */ -#define SHAPE_IDX_CLINE 9 /* On command line */ -#define SHAPE_IDX_STATUS 10 /* A status line */ -#define SHAPE_IDX_SDRAG 11 /* dragging a status line */ -#define SHAPE_IDX_VSEP 12 /* A vertical separator line */ -#define SHAPE_IDX_VDRAG 13 /* dragging a vertical separator line */ -#define SHAPE_IDX_MORE 14 /* Hit-return or More */ -#define SHAPE_IDX_MOREL 15 /* Hit-return or More in last line */ -#define SHAPE_IDX_SM 16 /* showing matching paren */ -#define SHAPE_IDX_COUNT 17 +/// struct to store values from 'guicursor' and 'mouseshape' +/// Indexes in shape_table[] +typedef enum { +SHAPE_IDX_N = 0, ///< Normal mode +SHAPE_IDX_V = 1, ///< Visual mode +SHAPE_IDX_I = 2, ///< Insert mode +SHAPE_IDX_R = 3, ///< Replace mode +SHAPE_IDX_C = 4, ///< Command line Normal mode +SHAPE_IDX_CI = 5, ///< Command line Insert mode +SHAPE_IDX_CR = 6, ///< Command line Replace mode +SHAPE_IDX_O = 7, ///< Operator-pending mode +SHAPE_IDX_VE = 8, ///< Visual mode with 'selection' exclusive +SHAPE_IDX_CLINE = 9, ///< On command line +SHAPE_IDX_STATUS = 10, ///< status line +SHAPE_IDX_SDRAG = 11, ///< dragging a status line +SHAPE_IDX_VSEP = 12, ///< A vertical separator line +SHAPE_IDX_VDRAG = 13, ///< dragging a vertical separator line +SHAPE_IDX_MORE = 14, ///< Hit-return or More +SHAPE_IDX_MOREL = 15, ///< Hit-return or More in last line +SHAPE_IDX_SM = 16, ///< showing matching paren +SHAPE_IDX_COUNT = 17 +} MouseMode; -#define SHAPE_BLOCK 0 /* block cursor */ -#define SHAPE_HOR 1 /* horizontal bar cursor */ -#define SHAPE_VER 2 /* vertical bar cursor */ +typedef enum { +SHAPE_BLOCK = 0, ///< block cursor +SHAPE_HOR = 1, ///< horizontal bar cursor +SHAPE_VER = 2 ///< vertical bar cursor +} CursorShape; #define MSHAPE_NUMBERED 1000 /* offset for shapes identified by number */ #define MSHAPE_HIDE 1 /* hide mouse pointer */ @@ -35,16 +37,17 @@ #define SHAPE_CURSOR 2 /* used for text cursor shape */ typedef struct cursor_entry { - int shape; /* one of the SHAPE_ defines */ - int mshape; /* one of the MSHAPE defines */ - int percentage; /* percentage of cell for bar */ - long blinkwait; /* blinking, wait time before blinking starts */ - long blinkon; /* blinking, on time */ - long blinkoff; /* blinking, off time */ - int id; /* highlight group ID */ - int id_lm; /* highlight group ID for :lmap mode */ - char *name; /* mode name (fixed) */ - char used_for; /* SHAPE_MOUSE and/or SHAPE_CURSOR */ + char *full_name; ///< mode full name + CursorShape shape; ///< cursor shape: one of the SHAPE_ defines + int mshape; ///< mouse shape: one of the MSHAPE defines + int percentage; ///< percentage of cell for bar + long blinkwait; ///< blinking, wait time before blinking starts + long blinkon; ///< blinking, on time + long blinkoff; ///< blinking, off time + int id; ///< highlight group ID + int id_lm; ///< highlight group ID for :lmap mode + char *name; ///< mode short name + char used_for; ///< SHAPE_MOUSE and/or SHAPE_CURSOR } cursorentry_T; diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 4a7b4a0eac..4f2f44ff86 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -42,29 +42,29 @@ static bool did_syntax_onoff = false; -// Structure that stores information about a highlight group. -// The ID of a highlight group is also called group ID. It is the index in -// the highlight_ga array PLUS ONE. +/// Structure that stores information about a highlight group. +/// The ID of a highlight group is also called group ID. It is the index in +/// the highlight_ga array PLUS ONE. struct hl_group { - char_u *sg_name; // highlight group name - char_u *sg_name_u; // uppercase of sg_name - int sg_attr; // Screen attr - int sg_link; // link to this highlight group ID - int sg_set; // combination of SG_* flags - scid_T sg_scriptID; // script in which the group was last set + char_u *sg_name; ///< highlight group name + char_u *sg_name_u; ///< uppercase of sg_name + int sg_attr; ///< Screen attr + int sg_link; ///< link to this highlight group ID + int sg_set; ///< combination of SG_* flags + scid_T sg_scriptID; ///< script in which the group was last set // for terminal UIs - int sg_cterm; // "cterm=" highlighting attr - int sg_cterm_fg; // terminal fg color number + 1 - int sg_cterm_bg; // terminal bg color number + 1 - int sg_cterm_bold; // bold attr was set for light color + int sg_cterm; ///< "cterm=" highlighting attr + int sg_cterm_fg; ///< terminal fg color number + 1 + int sg_cterm_bg; ///< terminal bg color number + 1 + int sg_cterm_bold; ///< bold attr was set for light color // for RGB UIs - int sg_gui; // "gui=" highlighting attributes - RgbValue sg_rgb_fg; // RGB foreground color - RgbValue sg_rgb_bg; // RGB background color - RgbValue sg_rgb_sp; // RGB special color - uint8_t *sg_rgb_fg_name; // RGB foreground color name - uint8_t *sg_rgb_bg_name; // RGB background color name - uint8_t *sg_rgb_sp_name; // RGB special color name + int sg_gui; ///< "gui=" highlighting attributes + RgbValue sg_rgb_fg; ///< RGB foreground color + RgbValue sg_rgb_bg; ///< RGB background color + RgbValue sg_rgb_sp; ///< RGB special color + uint8_t *sg_rgb_fg_name; ///< RGB foreground color name + uint8_t *sg_rgb_bg_name; ///< RGB background color name + uint8_t *sg_rgb_sp_name; ///< RGB special color name }; #define SG_CTERM 2 // cterm has been set @@ -7165,12 +7165,13 @@ int syn_namen2id(char_u *linep, int len) return id; } -/* - * Find highlight group name in the table and return it's ID. - * The argument is a pointer to the name and the length of the name. - * If it doesn't exist yet, a new entry is created. - * Return 0 for failure. - */ +/// Find highlight group name in the table and return it's ID. +/// If it doesn't exist yet, a new entry is created. +/// +/// @param pp Highlight group name +/// @param len length of \p pp +/// +/// @return 0 for failure else the id of the group int syn_check_group(char_u *pp, int len) { char_u *name = vim_strnsave(pp, len); diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index ebdfb1e7a1..ebcef33fa1 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -31,6 +31,8 @@ #include "nvim/ugrid.h" #include "nvim/tui/input.h" #include "nvim/tui/tui.h" +#include "nvim/cursor_shape.h" +#include "nvim/syntax.h" // Space reserved in the output buffer to restore the cursor to normal when // flushing. No existing terminal will require 32 bytes to do that. @@ -69,12 +71,12 @@ typedef struct { bool can_use_terminal_scroll; bool mouse_enabled; bool busy; + cursorentry_T cursor_shapes[SHAPE_IDX_COUNT]; HlAttrs print_attrs; int showing_mode; struct { int enable_mouse, disable_mouse; int enable_bracketed_paste, disable_bracketed_paste; - int set_cursor_shape_bar, set_cursor_shape_ul, set_cursor_shape_block; int set_rgb_foreground, set_rgb_background; int enable_focus_reporting, disable_focus_reporting; } unibi_ext; @@ -97,6 +99,7 @@ UI *tui_start(void) ui->clear = tui_clear; ui->eol_clear = tui_eol_clear; ui->cursor_goto = tui_cursor_goto; + ui->cursor_style_set = tui_cursor_style_set; ui->update_menu = tui_update_menu; ui->busy_start = tui_busy_start; ui->busy_stop = tui_busy_stop; @@ -131,9 +134,6 @@ static void terminfo_start(UI *ui) data->unibi_ext.disable_mouse = -1; data->unibi_ext.enable_bracketed_paste = -1; data->unibi_ext.disable_bracketed_paste = -1; - data->unibi_ext.set_cursor_shape_bar = -1; - data->unibi_ext.set_cursor_shape_ul = -1; - data->unibi_ext.set_cursor_shape_block = -1; data->unibi_ext.enable_focus_reporting = -1; data->unibi_ext.disable_focus_reporting = -1; data->out_fd = 1; @@ -147,7 +147,6 @@ static void terminfo_start(UI *ui) } fix_terminfo(data); // Initialize the cursor shape. - unibi_out(ui, data->unibi_ext.set_cursor_shape_block); // Set 't_Co' from the result of unibilium & fix_terminfo. t_colors = unibi_get_num(data->ut, unibi_max_colors); // Enter alternate screen and clear @@ -434,6 +433,64 @@ static void tui_cursor_goto(UI *ui, int row, int col) unibi_goto(ui, row, col); } +CursorShape tui_cursor_decode_shape(const char *shape_str) +{ + CursorShape shape = 0; + if (strcmp(shape_str, "block") == 0) { + shape = SHAPE_BLOCK; + } else if (strcmp(shape_str, "vertical") == 0) { + shape = SHAPE_VER; + } else if (strcmp(shape_str, "horizontal") == 0) { + shape = SHAPE_HOR; + } else { + EMSG2(_(e_invarg2), shape_str); + } + return shape; +} + +static cursorentry_T decode_cursor_entry(Dictionary args) +{ + cursorentry_T r; + + for (size_t i = 0; i < args.size; i++) { + char *keyStr = args.items[i].key.data; + Object value = args.items[i].value; + + if (strcmp(keyStr, "cursor_shape") == 0) { + r.shape = tui_cursor_decode_shape(args.items[i].value.data.string.data); + } else if (strcmp(keyStr, "blinkon") == 0) { + r.blinkon = (int)value.data.integer; + } else if (strcmp(keyStr, "blinkoff") == 0) { + r.blinkoff = (int)value.data.integer; + } else if (strcmp(keyStr, "hl_id") == 0) { + r.id = (int)value.data.integer; + } + } + return r; +} + +static void tui_cursor_style_set(UI *ui, Dictionary args) +{ + TUIData *data = ui->data; + + for (size_t i = 0; i < args.size; i++) { + char *mode_name = args.items[i].key.data; + const int mode_id = cursor_mode_str2int(mode_name); + + if (mode_id < 0) { + WLOG("Unknown mode '%s'", mode_name); + continue; + } + cursorentry_T r = decode_cursor_entry(args.items[i].value.data.dictionary); + r.full_name = mode_name; + data->cursor_shapes[mode_id] = r; + } + + // force redrawal + MouseMode cursor_mode = tui_mode2cursor(data->showing_mode); + tui_set_cursor(ui, cursor_mode); +} + static void tui_update_menu(UI *ui) { // Do nothing; menus are for GUI only @@ -467,33 +524,90 @@ static void tui_mouse_off(UI *ui) } } +/// @param mode one of SHAPE_XXX +static void tui_set_cursor(UI *ui, MouseMode mode) +{ + TUIData *data = ui->data; + cursorentry_T c = data->cursor_shapes[mode]; + int shape = c.shape; + bool inside_tmux = os_getenv("TMUX") != NULL; + unibi_var_t vars[26 + 26] = { { 0 } }; + +# define TMUX_WRAP(seq) (inside_tmux ? "\x1bPtmux;\x1b" seq "\x1b\\" : seq) + // Support changing cursor shape on some popular terminals. + const char *term_prog = os_getenv("TERM_PROGRAM"); + const char *vte_version = os_getenv("VTE_VERSION"); + + if ((term_prog && !strcmp(term_prog, "Konsole")) + || os_getenv("KONSOLE_DBUS_SESSION") != NULL) { + // Konsole uses a proprietary escape code to set the cursor shape + // and does not support DECSCUSR. + switch (shape) { + case SHAPE_BLOCK: shape = 0; break; + case SHAPE_VER: shape = 1; break; + case SHAPE_HOR: shape = 3; break; + default: WLOG("Unknown shape value %d", shape); break; + } + printf(TMUX_WRAP("\x1b]50;CursorShape=%d;BlinkingCursorEnabled=%d\x07"), + shape, (c.blinkon !=0)); + } else if (!vte_version || atoi(vte_version) >= 3900) { + // Assume that the terminal supports DECSCUSR unless it is an + // old VTE based terminal. This should not get wrapped for tmux, + // which will handle it via its Ss/Se terminfo extension - usually + // according to its terminal-overrides. + + switch (shape) { + case SHAPE_BLOCK: shape = 1; break; + case SHAPE_VER: shape = 5; break; + case SHAPE_HOR: shape = 3; break; + default: WLOG("Unknown shape value %d", shape); break; + } + data->params[0].i = shape + (c.blinkon ==0); + unibi_format(vars, vars + 26, "\x1b[%p1%d q", + data->params, out, ui, NULL, NULL); + } +} + +/// Returns cursor mode from edit mode +static MouseMode tui_mode2cursor(int mode) +{ + switch (mode) { + case INSERT: return SHAPE_IDX_I; + case CMDLINE: return SHAPE_IDX_C; + case REPLACE: return SHAPE_IDX_R; + case NORMAL: + default: return SHAPE_IDX_N; + } +} + +/// @param mode editor mode static void tui_mode_change(UI *ui, int mode) { TUIData *data = ui->data; if (mode == INSERT) { if (data->showing_mode != INSERT) { - unibi_out(ui, data->unibi_ext.set_cursor_shape_bar); + tui_set_cursor(ui, SHAPE_IDX_I); } } else if (mode == CMDLINE) { if (data->showing_mode != CMDLINE) { - unibi_out(ui, data->unibi_ext.set_cursor_shape_bar); + tui_set_cursor(ui, SHAPE_IDX_C); } } else if (mode == REPLACE) { if (data->showing_mode != REPLACE) { - unibi_out(ui, data->unibi_ext.set_cursor_shape_ul); + tui_set_cursor(ui, SHAPE_IDX_R); } } else { assert(mode == NORMAL); if (data->showing_mode != NORMAL) { - unibi_out(ui, data->unibi_ext.set_cursor_shape_block); + tui_set_cursor(ui, SHAPE_IDX_N); } } data->showing_mode = mode; } static void tui_set_scroll_region(UI *ui, int top, int bot, int left, - int right) + int right) { TUIData *data = ui->data; ugrid_set_scroll_region(&data->grid, top, bot, left, right); @@ -831,8 +945,6 @@ static void fix_terminfo(TUIData *data) goto end; } - bool inside_tmux = os_getenv("TMUX") != NULL; - #define STARTS_WITH(str, prefix) (!memcmp(str, prefix, sizeof(prefix) - 1)) if (STARTS_WITH(term, "rxvt")) { @@ -890,40 +1002,6 @@ static void fix_terminfo(TUIData *data) unibi_set_str(ut, unibi_set_a_background, XTERM_SETAB); } - const char * env_cusr_shape = os_getenv("NVIM_TUI_ENABLE_CURSOR_SHAPE"); - if (env_cusr_shape && strncmp(env_cusr_shape, "0", 1) == 0) { - goto end; - } - bool cusr_blink = env_cusr_shape && strncmp(env_cusr_shape, "2", 1) == 0; - -#define TMUX_WRAP(seq) (inside_tmux ? "\x1bPtmux;\x1b" seq "\x1b\\" : seq) - // Support changing cursor shape on some popular terminals. - const char *term_prog = os_getenv("TERM_PROGRAM"); - const char *vte_version = os_getenv("VTE_VERSION"); - - if ((term_prog && !strcmp(term_prog, "Konsole")) - || os_getenv("KONSOLE_DBUS_SESSION") != NULL) { - // Konsole uses a proprietary escape code to set the cursor shape - // and does not support DECSCUSR. - data->unibi_ext.set_cursor_shape_bar = (int)unibi_add_ext_str(ut, NULL, - TMUX_WRAP("\x1b]50;CursorShape=1\x07")); - data->unibi_ext.set_cursor_shape_ul = (int)unibi_add_ext_str(ut, NULL, - TMUX_WRAP("\x1b]50;CursorShape=2\x07")); - data->unibi_ext.set_cursor_shape_block = (int)unibi_add_ext_str(ut, NULL, - TMUX_WRAP("\x1b]50;CursorShape=0\x07")); - } else if (!vte_version || atoi(vte_version) >= 3900) { - // Assume that the terminal supports DECSCUSR unless it is an - // old VTE based terminal. This should not get wrapped for tmux, - // which will handle it via its Ss/Se terminfo extension - usually - // according to its terminal-overrides. - data->unibi_ext.set_cursor_shape_bar = - (int)unibi_add_ext_str(ut, NULL, cusr_blink ? "\x1b[5 q" : "\x1b[6 q"); - data->unibi_ext.set_cursor_shape_ul = - (int)unibi_add_ext_str(ut, NULL, cusr_blink ? "\x1b[3 q" : "\x1b[4 q"); - data->unibi_ext.set_cursor_shape_block = - (int)unibi_add_ext_str(ut, NULL, cusr_blink ? "\x1b[1 q" : "\x1b[2 q"); - } - end: // Fill some empty slots with common terminal strings data->unibi_ext.enable_mouse = (int)unibi_add_ext_str(ut, NULL, diff --git a/src/nvim/tui/tui.h b/src/nvim/tui/tui.h index 07523bc124..2915b0e2f8 100644 --- a/src/nvim/tui/tui.h +++ b/src/nvim/tui/tui.h @@ -1,6 +1,8 @@ #ifndef NVIM_TUI_TUI_H #define NVIM_TUI_TUI_H +#include "nvim/cursor_shape.h" + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "tui/tui.h.generated.h" #endif diff --git a/src/nvim/ui.c b/src/nvim/ui.c index ea42e3e357..babb4efa96 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -29,6 +29,7 @@ #include "nvim/screen.h" #include "nvim/syntax.h" #include "nvim/window.h" +#include "nvim/cursor_shape.h" #ifdef FEAT_TUI # include "nvim/tui/tui.h" #else @@ -179,6 +180,7 @@ void ui_refresh(void) row = col = 0; screen_resize(width, height); pum_set_external(pum_external); + ui_cursor_style_set(); } static void ui_refresh_event(void **argv) @@ -376,6 +378,13 @@ void ui_cursor_goto(int new_row, int new_col) pending_cursor_update = true; } +void ui_cursor_style_set(void) +{ + Dictionary style = cursor_shape_dict(); + UI_CALL(cursor_style_set, style); + api_free_dictionary(style); +} + void ui_update_menu(void) { UI_CALL(update_menu); diff --git a/src/nvim/ui.h b/src/nvim/ui.h index d14bc5812c..0af0c0db65 100644 --- a/src/nvim/ui.h +++ b/src/nvim/ui.h @@ -22,6 +22,7 @@ struct ui_t { void (*clear)(UI *ui); void (*eol_clear)(UI *ui); void (*cursor_goto)(UI *ui, int row, int col); + void (*cursor_style_set)(UI *ui, Dictionary cursor_shapes); void (*update_menu)(UI *ui); void (*busy_start)(UI *ui); void (*busy_stop)(UI *ui); diff --git a/src/nvim/ui_bridge.c b/src/nvim/ui_bridge.c index 25861abc1b..c9bad6b254 100644 --- a/src/nvim/ui_bridge.c +++ b/src/nvim/ui_bridge.c @@ -13,6 +13,7 @@ #include "nvim/memory.h" #include "nvim/ui_bridge.h" #include "nvim/ugrid.h" +#include "nvim/api/private/helpers.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "ui_bridge.c.generated.h" @@ -59,6 +60,7 @@ UI *ui_bridge_attach(UI *ui, ui_main_fn ui_main, event_scheduler scheduler) rv->bridge.clear = ui_bridge_clear; rv->bridge.eol_clear = ui_bridge_eol_clear; rv->bridge.cursor_goto = ui_bridge_cursor_goto; + rv->bridge.cursor_style_set = ui_bridge_cursor_styleset; rv->bridge.update_menu = ui_bridge_update_menu; rv->bridge.busy_start = ui_bridge_busy_start; rv->bridge.busy_stop = ui_bridge_busy_stop; @@ -178,6 +180,23 @@ static void ui_bridge_cursor_goto_event(void **argv) ui->cursor_goto(ui, PTR2INT(argv[1]), PTR2INT(argv[2])); } +static void ui_bridge_cursor_styleset(UI *b, Dictionary style) +{ + Object copy = copy_object(DICTIONARY_OBJ(style)); + Object *pobj = xmalloc(sizeof(copy)); + *pobj = copy; + UI_CALL(b, cursor_styleset, 2, b, pobj); +} +static void ui_bridge_cursor_styleset_event(void **argv) +{ + UI *ui = UI(argv[0]); + Object *styles = (Object *)argv[1]; + + ui->cursor_style_set(ui, styles->data.dictionary); + api_free_object(*styles); + xfree(styles); +} + static void ui_bridge_update_menu(UI *b) { UI_CALL(b, update_menu, 1, b); -- cgit From 54bab0019b3638f213608757b523062195be156b Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Tue, 21 Mar 2017 00:03:01 +0100 Subject: tui: 'guicursor' color For now only supports valid hex colors (does not check for the validity the hex color) when termguicolors is set, otherwise it won't attempt to change the cursor color. --- src/nvim/syntax.c | 45 +++++++++++++++++++++++++++------------------ src/nvim/syntax.h | 10 ++++++---- src/nvim/tui/tui.c | 19 +++++++++++++++++-- 3 files changed, 50 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 4f2f44ff86..acda25e738 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -48,9 +48,9 @@ static bool did_syntax_onoff = false; struct hl_group { char_u *sg_name; ///< highlight group name char_u *sg_name_u; ///< uppercase of sg_name - int sg_attr; ///< Screen attr + int sg_attr; ///< Screen attr @see ATTR_ENTRY int sg_link; ///< link to this highlight group ID - int sg_set; ///< combination of SG_* flags + int sg_set; ///< combination of flags in \ref SG_SET scid_T sg_scriptID; ///< script in which the group was last set // for terminal UIs int sg_cterm; ///< "cterm=" highlighting attr @@ -59,6 +59,7 @@ struct hl_group { int sg_cterm_bold; ///< bold attr was set for light color // for RGB UIs int sg_gui; ///< "gui=" highlighting attributes + ///< (combination of \ref HL_ATTRIBUTES) RgbValue sg_rgb_fg; ///< RGB foreground color RgbValue sg_rgb_bg; ///< RGB background color RgbValue sg_rgb_sp; ///< RGB special color @@ -67,9 +68,12 @@ struct hl_group { uint8_t *sg_rgb_sp_name; ///< RGB special color name }; +/// \addtogroup SG_SET +/// @{ #define SG_CTERM 2 // cterm has been set #define SG_GUI 4 // gui has been set #define SG_LINK 8 // link has been set +/// @} // highlight groups for 'highlight' option static garray_T highlight_ga = GA_EMPTY_INIT_VALUE; @@ -6093,16 +6097,16 @@ int load_colors(char_u *name) return retval; } -/* - * Handle the ":highlight .." command. - * When using ":hi clear" this is called recursively for each group with - * "forceit" and "init" both TRUE. - */ -void -do_highlight ( + +/// Handle the ":highlight .." command. +/// When using ":hi clear" this is called recursively for each group with +/// "forceit" and "init" both TRUE. +/// @param init TRUE when called for initializing +void +do_highlight( char_u *line, int forceit, - int init /* TRUE when called for initializing */ + int init ) { char_u *name_end; @@ -6704,12 +6708,10 @@ static garray_T attr_table = GA_EMPTY_INIT_VALUE; #define ATTR_ENTRY(idx) ((attrentry_T *)attr_table.ga_data)[idx] -/* - * Return the attr number for a set of colors and font. - * Add a new entry to the term_attr_table, attr_table or gui_attr_table - * if the combination is new. - * Return 0 for error. - */ +/// Return the attr number for a set of colors and font. +/// Add a new entry to the term_attr_table, attr_table or gui_attr_table +/// if the combination is new. +/// @return 0 for error. int get_attr_entry(attrentry_T *aep) { garray_T *table = &attr_table; @@ -6932,7 +6934,7 @@ static int highlight_list_arg(int id, int didh, int type, int iarg, char_u *sarg /// Check whether highlight group has attribute /// -/// @param[in] id Highilght group to check. +/// @param[in] id Highlight group to check. /// @param[in] flag Attribute to check. /// @param[in] modec 'g' for GUI, 'c' for term. /// @@ -8245,7 +8247,14 @@ color_name_table_T color_name_table[] = { { NULL, 0 }, }; -RgbValue name_to_color(uint8_t *name) + +/// Translate to RgbValue if \p name is an hex value (e.g. #XXXXXX), +/// else look into color_name_table to translate a color name to its +/// hex value +/// +/// @param[in] name string value to convert to RGB +/// return the hex value or -1 if could not find a correct value +RgbValue name_to_color(const uint8_t *name) { if (name[0] == '#' && isxdigit(name[1]) && isxdigit(name[2]) diff --git a/src/nvim/syntax.h b/src/nvim/syntax.h index af2ac719c6..574e3372e2 100644 --- a/src/nvim/syntax.h +++ b/src/nvim/syntax.h @@ -5,10 +5,11 @@ #include "nvim/buffer_defs.h" -/* - * Terminal highlighting attribute bits. - * Attributes above HL_ALL are used for syntax highlighting. - */ + +/// Terminal highlighting attribute bits. +/// Attributes above HL_ALL are used for syntax highlighting. +/// \addtogroup HL_ATTRIBUTES +/// @{ #define HL_NORMAL 0x00 #define HL_INVERSE 0x01 #define HL_BOLD 0x02 @@ -16,6 +17,7 @@ #define HL_UNDERLINE 0x08 #define HL_UNDERCURL 0x10 #define HL_STANDOUT 0x20 +/// @} #define HL_CONTAINED 0x01 /* not used on toplevel */ #define HL_TRANSP 0x02 /* has no highlighting */ diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index ebcef33fa1..12281246fe 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -78,6 +78,7 @@ typedef struct { int enable_mouse, disable_mouse; int enable_bracketed_paste, disable_bracketed_paste; int set_rgb_foreground, set_rgb_background; + int set_cursor_color; int enable_focus_reporting, disable_focus_reporting; } unibi_ext; } TUIData; @@ -132,6 +133,7 @@ static void terminfo_start(UI *ui) data->showing_mode = 0; data->unibi_ext.enable_mouse = -1; data->unibi_ext.disable_mouse = -1; + data->unibi_ext.set_cursor_color = -1; data->unibi_ext.enable_bracketed_paste = -1; data->unibi_ext.disable_bracketed_paste = -1; data->unibi_ext.enable_focus_reporting = -1; @@ -548,8 +550,12 @@ static void tui_set_cursor(UI *ui, MouseMode mode) case SHAPE_HOR: shape = 3; break; default: WLOG("Unknown shape value %d", shape); break; } - printf(TMUX_WRAP("\x1b]50;CursorShape=%d;BlinkingCursorEnabled=%d\x07"), - shape, (c.blinkon !=0)); + data->params[0].i = shape; + data->params[1].i = (c.blinkon ==0); + + unibi_format(vars, vars + 26, + TMUX_WRAP("\x1b]50;CursorShape=%p1%d;BlinkingCursorEnabled=%p2%d\x07"), + data->params, out, ui, NULL, NULL); } else if (!vte_version || atoi(vte_version) >= 3900) { // Assume that the terminal supports DECSCUSR unless it is an // old VTE based terminal. This should not get wrapped for tmux, @@ -566,6 +572,13 @@ static void tui_set_cursor(UI *ui, MouseMode mode) unibi_format(vars, vars + 26, "\x1b[%p1%d q", data->params, out, ui, NULL, NULL); } + + if (c.id != 0 && ui->rgb) { + int attr = syn_id2attr(c.id); + attrentry_T *aep = syn_cterm_attr2entry(attr); + data->params[0].i = aep->rgb_bg_color; + unibi_out(ui, data->unibi_ext.set_cursor_color); + } } /// Returns cursor mode from edit mode @@ -1004,6 +1017,8 @@ static void fix_terminfo(TUIData *data) end: // Fill some empty slots with common terminal strings + data->unibi_ext.set_cursor_color = (int)unibi_add_ext_str( + ut, NULL, "\033]12;#%p1%06x\007"); data->unibi_ext.enable_mouse = (int)unibi_add_ext_str(ut, NULL, "\x1b[?1002h\x1b[?1006h"); data->unibi_ext.disable_mouse = (int)unibi_add_ext_str(ut, NULL, -- cgit From c2826a7830ddba66261afdf45fcf4d0043506342 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 1 Apr 2017 13:08:42 +0200 Subject: 'guicursor': Empty means "block cursor in all modes". Also: update default 'guicursor' to match the documentation. --- src/nvim/cursor_shape.c | 13 +++++++------ src/nvim/cursor_shape.h | 4 ++-- src/nvim/options.lua | 2 +- src/nvim/tui/tui.c | 1 - 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c index 9f0eb215ef..c78bcbc29d 100644 --- a/src/nvim/cursor_shape.c +++ b/src/nvim/cursor_shape.c @@ -45,7 +45,7 @@ static cursorentry_T shape_table[SHAPE_IDX_COUNT] = }; /// Converts cursor_shapes into a Dictionary of dictionaries -/// @return a dictionary of the form {"normal" : { "cursor_shape": ... }, ...} +/// @return dictionary of the form {"normal" : { "cursor_shape": ... }, ...} Dictionary cursor_shape_dict(void) { Dictionary all = ARRAY_DICT_INIT; @@ -82,7 +82,7 @@ Dictionary cursor_shape_dict(void) /// Parse the 'guicursor' option /// -/// @param what either SHAPE_CURSOR or SHAPE_MOUSE ('mouseshape') +/// @param what SHAPE_CURSOR or SHAPE_MOUSE ('mouseshape') /// /// @returns error message for an illegal option, NULL otherwise. char_u *parse_shape_opt(int what) @@ -103,10 +103,11 @@ char_u *parse_shape_opt(int what) * First round: check for errors; second round: do it for real. */ for (round = 1; round <= 2; ++round) { - /* - * Repeat for all comma separated parts. - */ + // Repeat for all comma separated parts. modep = p_guicursor; + if (*p_guicursor == NUL) { + modep = (char_u *)"a:block-blinkon0"; + } while (*modep != NUL) { colonp = vim_strchr(modep, ':'); if (colonp == NULL) @@ -115,7 +116,7 @@ char_u *parse_shape_opt(int what) return (char_u *)N_("E546: Illegal mode"); commap = vim_strchr(modep, ','); - // Repeat for all mode's before the colon. + // Repeat for all modes before the colon. // For the 'a' mode, we loop to handle all the modes. all_idx = -1; assert(modep < colonp); diff --git a/src/nvim/cursor_shape.h b/src/nvim/cursor_shape.h index 127d0df555..14ace2a861 100644 --- a/src/nvim/cursor_shape.h +++ b/src/nvim/cursor_shape.h @@ -14,7 +14,7 @@ SHAPE_IDX_CR = 6, ///< Command line Replace mode SHAPE_IDX_O = 7, ///< Operator-pending mode SHAPE_IDX_VE = 8, ///< Visual mode with 'selection' exclusive SHAPE_IDX_CLINE = 9, ///< On command line -SHAPE_IDX_STATUS = 10, ///< status line +SHAPE_IDX_STATUS = 10, ///< status line SHAPE_IDX_SDRAG = 11, ///< dragging a status line SHAPE_IDX_VSEP = 12, ///< A vertical separator line SHAPE_IDX_VDRAG = 13, ///< dragging a vertical separator line @@ -37,7 +37,7 @@ SHAPE_VER = 2 ///< vertical bar cursor #define SHAPE_CURSOR 2 /* used for text cursor shape */ typedef struct cursor_entry { - char *full_name; ///< mode full name + char *full_name; ///< mode description CursorShape shape; ///< cursor shape: one of the SHAPE_ defines int mshape; ///< mouse shape: one of the MSHAPE defines int percentage; ///< percentage of cell for bar diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 9dff3410d6..09f016cf5a 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -1000,7 +1000,7 @@ return { deny_duplicates=true, vi_def=true, varname='p_guicursor', - defaults={if_true={vi="n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block"}} + defaults={if_true={vi="n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175"}} }, { full_name='guifont', abbreviation='gfn', diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 12281246fe..e1fec0f678 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -148,7 +148,6 @@ static void terminfo_start(UI *ui) data->ut = unibi_dummy(); } fix_terminfo(data); - // Initialize the cursor shape. // Set 't_Co' from the result of unibilium & fix_terminfo. t_colors = unibi_get_num(data->ut, unibi_max_colors); // Enter alternate screen and clear -- cgit From 3a69dbfca6642463ca8e19f814f71791f66332f3 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 1 Apr 2017 22:32:16 +0200 Subject: api/cursor_style_set: mode descriptions --- src/nvim/cursor_shape.c | 44 +++++++++++++++++--------------------------- src/nvim/cursor_shape.h | 4 ++-- src/nvim/tui/tui.c | 4 ++-- 3 files changed, 21 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c index c78bcbc29d..7ec70bb724 100644 --- a/src/nvim/cursor_shape.c +++ b/src/nvim/cursor_shape.c @@ -13,35 +13,25 @@ /// Handling of cursor and mouse pointer shapes in various modes. static cursorentry_T shape_table[SHAPE_IDX_COUNT] = { - // The values will be filled in from the 'guicursor' and 'mouseshape' - // defaults when Vim starts. - // Adjust the SHAPE_IDX_ defines when making changes! - { "normal", - 0, 0, 0, 700L, 400L, 250L, 0, 0, "n", SHAPE_CURSOR+SHAPE_MOUSE }, - { "visual", - 0, 0, 0, 700L, 400L, 250L, 0, 0, "v", SHAPE_CURSOR+SHAPE_MOUSE }, - { "insert", - 0, 0, 0, 700L, 400L, 250L, 0, 0, "i", SHAPE_CURSOR+SHAPE_MOUSE }, - { "replace", - 0, 0, 0, 700L, 400L, 250L, 0, 0, "r", SHAPE_CURSOR+SHAPE_MOUSE }, - { "cmd_normal", - 0, 0, 0, 700L, 400L, 250L, 0, 0, "c", SHAPE_CURSOR+SHAPE_MOUSE }, - { "cmd_insert", 0, - 0, 0, 700L, 400L, 250L, 0, 0, "ci", SHAPE_CURSOR+SHAPE_MOUSE }, - { "cmd_replace", - 0, 0, 0, 700L, 400L, 250L, 0, 0, "cr", SHAPE_CURSOR+SHAPE_MOUSE }, - { "pending", - 0, 0, 0, 700L, 400L, 250L, 0, 0, "o", SHAPE_CURSOR+SHAPE_MOUSE }, - { "visual_select", - 0, 0, 0, 700L, 400L, 250L, 0, 0, "ve", SHAPE_CURSOR+SHAPE_MOUSE }, - { "cmd_line", 0, 0, 0, 0L, 0L, 0L, 0, 0, "e", SHAPE_MOUSE }, - { "statusline", 0, 0, 0, 0L, 0L, 0L, 0, 0, "s", SHAPE_MOUSE }, - { "drag_statusline", 0, 0, 0, 0L, 0L, 0L, 0, 0, "sd", SHAPE_MOUSE }, - { "vsep", 0, 0, 0, 0L, 0L, 0L, 0, 0, "vs", SHAPE_MOUSE }, - { "vdrag", 0, 0, 0, 0L, 0L, 0L, 0, 0, "vd", SHAPE_MOUSE }, + // Values are set by 'guicursor' and 'mouseshape'. + // Adjust the SHAPE_IDX_ defines when changing this! + { "normal", 0, 0, 0, 700L, 400L, 250L, 0, 0, "n", SHAPE_CURSOR+SHAPE_MOUSE }, + { "visual", 0, 0, 0, 700L, 400L, 250L, 0, 0, "v", SHAPE_CURSOR+SHAPE_MOUSE }, + { "insert", 0, 0, 0, 700L, 400L, 250L, 0, 0, "i", SHAPE_CURSOR+SHAPE_MOUSE }, + { "replace", 0, 0, 0, 700L, 400L, 250L, 0, 0, "r", SHAPE_CURSOR+SHAPE_MOUSE }, + { "cmdline_normal", 0, 0, 0, 700L, 400L, 250L, 0, 0, "c", SHAPE_CURSOR+SHAPE_MOUSE }, + { "cmdline_insert", 0, 0, 0, 700L, 400L, 250L, 0, 0, "ci", SHAPE_CURSOR+SHAPE_MOUSE }, + { "cmdline_replace", 0, 0, 0, 700L, 400L, 250L, 0, 0, "cr", SHAPE_CURSOR+SHAPE_MOUSE }, + { "operator", 0, 0, 0, 700L, 400L, 250L, 0, 0, "o", SHAPE_CURSOR+SHAPE_MOUSE }, + { "visual_select", 0, 0, 0, 700L, 400L, 250L, 0, 0, "ve", SHAPE_CURSOR+SHAPE_MOUSE }, + { "cmdline_hover", 0, 0, 0, 0L, 0L, 0L, 0, 0, "e", SHAPE_MOUSE }, + { "statusline_hover", 0, 0, 0, 0L, 0L, 0L, 0, 0, "s", SHAPE_MOUSE }, + { "statusline_drag", 0, 0, 0, 0L, 0L, 0L, 0, 0, "sd", SHAPE_MOUSE }, + { "vsep_hover", 0, 0, 0, 0L, 0L, 0L, 0, 0, "vs", SHAPE_MOUSE }, + { "vsep_drag", 0, 0, 0, 0L, 0L, 0L, 0, 0, "vd", SHAPE_MOUSE }, { "more", 0, 0, 0, 0L, 0L, 0L, 0, 0, "m", SHAPE_MOUSE }, { "more_lastline", 0, 0, 0, 0L, 0L, 0L, 0, 0, "ml", SHAPE_MOUSE }, - { "match_paren", 0, 0, 0, 100L, 100L, 100L, 0, 0, "sm", SHAPE_CURSOR }, + { "showmatch", 0, 0, 0, 100L, 100L, 100L, 0, 0, "sm", SHAPE_CURSOR }, }; /// Converts cursor_shapes into a Dictionary of dictionaries diff --git a/src/nvim/cursor_shape.h b/src/nvim/cursor_shape.h index 14ace2a861..0006ede31d 100644 --- a/src/nvim/cursor_shape.h +++ b/src/nvim/cursor_shape.h @@ -14,9 +14,9 @@ SHAPE_IDX_CR = 6, ///< Command line Replace mode SHAPE_IDX_O = 7, ///< Operator-pending mode SHAPE_IDX_VE = 8, ///< Visual mode with 'selection' exclusive SHAPE_IDX_CLINE = 9, ///< On command line -SHAPE_IDX_STATUS = 10, ///< status line +SHAPE_IDX_STATUS = 10, ///< On status line SHAPE_IDX_SDRAG = 11, ///< dragging a status line -SHAPE_IDX_VSEP = 12, ///< A vertical separator line +SHAPE_IDX_VSEP = 12, ///< On vertical separator line SHAPE_IDX_VDRAG = 13, ///< dragging a vertical separator line SHAPE_IDX_MORE = 14, ///< Hit-return or More SHAPE_IDX_MOREL = 15, ///< Hit-return or More in last line diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index e1fec0f678..badc0cd870 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -487,7 +487,7 @@ static void tui_cursor_style_set(UI *ui, Dictionary args) data->cursor_shapes[mode_id] = r; } - // force redrawal + // force redraw MouseMode cursor_mode = tui_mode2cursor(data->showing_mode); tui_set_cursor(ui, cursor_mode); } @@ -550,7 +550,7 @@ static void tui_set_cursor(UI *ui, MouseMode mode) default: WLOG("Unknown shape value %d", shape); break; } data->params[0].i = shape; - data->params[1].i = (c.blinkon ==0); + data->params[1].i = (c.blinkon == 0); unibi_format(vars, vars + 26, TMUX_WRAP("\x1b]50;CursorShape=%p1%d;BlinkingCursorEnabled=%p2%d\x07"), -- cgit From 16babc66870b5579f3305fa1289f25e1dc496655 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sat, 1 Apr 2017 18:00:42 -0400 Subject: tui: Only enable/disable mouse when there's something to do (#6411) If we get a mouse_on/mouse_off event, but the mouse is already in the corresponding state, there's no need to send the event up to the terminal. Closes #4394 --- src/nvim/tui/tui.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 55936ad58d..ebdfb1e7a1 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -452,15 +452,19 @@ static void tui_busy_stop(UI *ui) static void tui_mouse_on(UI *ui) { TUIData *data = ui->data; - unibi_out(ui, data->unibi_ext.enable_mouse); - data->mouse_enabled = true; + if (!data->mouse_enabled) { + unibi_out(ui, data->unibi_ext.enable_mouse); + data->mouse_enabled = true; + } } static void tui_mouse_off(UI *ui) { TUIData *data = ui->data; - unibi_out(ui, data->unibi_ext.disable_mouse); - data->mouse_enabled = false; + if (data->mouse_enabled) { + unibi_out(ui, data->unibi_ext.disable_mouse); + data->mouse_enabled = false; + } } static void tui_mode_change(UI *ui, int mode) -- cgit From b10880dadcbd3b3ad368621f95a0f4be7e30dc0d Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 2 Apr 2017 22:11:35 +0300 Subject: eval: Make writefile() able to disable fsync() --- src/nvim/eval.c | 6 +++++- src/nvim/os/fileio.c | 20 ++++++++++++-------- src/nvim/shada.c | 2 +- 3 files changed, 18 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index f0d78a2508..8a3e3f3e22 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -17421,6 +17421,7 @@ static void f_writefile(typval_T *argvars, typval_T *rettv, FunPtr fptr) bool binary = false; bool append = false; + bool do_fsync = true; if (argvars[2].v_type != VAR_UNKNOWN) { const char *const flags = tv_get_string_chk(&argvars[2]); if (flags == NULL) { @@ -17432,6 +17433,9 @@ static void f_writefile(typval_T *argvars, typval_T *rettv, FunPtr fptr) if (strchr(flags, 'a')) { append = true; } + if (strchr(flags, 'S')) { + do_fsync = false; + } } char buf[NUMBUFLEN]; @@ -17453,7 +17457,7 @@ static void f_writefile(typval_T *argvars, typval_T *rettv, FunPtr fptr) if (write_list(&fp, argvars[0].vval.v_list, binary)) { rettv->vval.v_number = 0; } - if ((error = file_close(&fp)) != 0) { + if ((error = file_close(&fp, do_fsync)) != 0) { emsgf(_("E80: Error when closing file %s: %s"), fname, os_strerror(error)); } diff --git a/src/nvim/os/fileio.c b/src/nvim/os/fileio.c index 3c928363cc..4b7b53fc7f 100644 --- a/src/nvim/os/fileio.c +++ b/src/nvim/os/fileio.c @@ -113,27 +113,31 @@ FileDescriptor *file_open_new(int *const error, const char *const fname, /// Close file and free its buffer /// /// @param[in,out] fp File to close. +/// @param[in] do_fsync If true, use fsync() to write changes to disk. /// /// @return 0 or error code. -int file_close(FileDescriptor *const fp) FUNC_ATTR_NONNULL_ALL +int file_close(FileDescriptor *const fp, const bool do_fsync) + FUNC_ATTR_NONNULL_ALL { - const int error = file_fsync(fp); - const int error2 = os_close(fp->fd); + const int flush_error = (do_fsync ? file_fsync(fp) : file_flush(fp)); + const int close_error = os_close(fp->fd); rbuffer_free(fp->rv); - if (error2 != 0) { - return error2; + if (close_error != 0) { + return close_error; } - return error; + return flush_error; } /// Close and free file obtained using file_open_new() /// /// @param[in,out] fp File to close. +/// @param[in] do_fsync If true, use fsync() to write changes to disk. /// /// @return 0 or error code. -int file_free(FileDescriptor *const fp) FUNC_ATTR_NONNULL_ALL +int file_free(FileDescriptor *const fp, const bool do_fsync) + FUNC_ATTR_NONNULL_ALL { - const int ret = file_close(fp); + const int ret = file_close(fp, do_fsync); xfree(fp); return ret; } diff --git a/src/nvim/shada.c b/src/nvim/shada.c index f65fdaf1c0..c7b95958e0 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -811,7 +811,7 @@ static int open_shada_file_for_reading(const char *const fname, /// Wrapper for closing file descriptors static void close_file(void *cookie) { - const int error = file_free(cookie); + const int error = file_free(cookie, true); if (error != 0) { emsgf(_(SERR "System error while closing ShaDa file: %s"), os_strerror(error)); -- cgit From 364709bedb17bfde4eb12d8f2c1427fe958dc6fc Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 3 Apr 2017 00:35:29 +0300 Subject: fileio: Refactor errmsg handling Adds os_strerror() result to a number of places. Also since I could not track where err\* variables are NULL and where they are not, using macros to make sure that all three variables are set at once. Removes #ifdef UNIX around the use of os_fsync, makes it use os_close in place of close in some places. --- src/nvim/fileio.c | 171 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 94 insertions(+), 77 deletions(-) (limited to 'src') diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index bd632b2755..fb44d2cc1d 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -2258,9 +2258,16 @@ buf_write ( int len; linenr_T lnum; long nchars; - char_u *errmsg = NULL; - int errmsg_allocated = FALSE; - char_u *errnum = NULL; +#define SET_ERRMSG_NUM(num, msg) \ + errnum = num ": ", errmsg = msg, errmsgarg = 0 +#define SET_ERRMSG_ARG(msg, error) \ + errnum = NULL, errmsg = msg, errmsgarg = error +#define SET_ERRMSG(msg) \ + errnum = NULL, errmsg = msg, errmsgarg = 0 + const char *errnum = NULL; + char *errmsg = NULL; + int errmsgarg = 0; + bool errmsg_allocated = false; char_u *buffer; char_u smallbuf[SMBUFSIZE]; char_u *backup_ext; @@ -2282,7 +2289,6 @@ buf_write ( /* writing everything */ int whole = (start == 1 && end == buf->b_ml.ml_line_count); linenr_T old_line_count = buf->b_ml.ml_line_count; - int attr; int fileformat; int write_bin; struct bw_info write_info; /* info for buf_write_bytes() */ @@ -2577,13 +2583,11 @@ buf_write ( perm = file_info_old.stat.st_mode; if (!S_ISREG(file_info_old.stat.st_mode)) { /* not a file */ if (S_ISDIR(file_info_old.stat.st_mode)) { - errnum = (char_u *)"E502: "; - errmsg = (char_u *)_("is a directory"); + SET_ERRMSG_NUM("E502", _("is a directory")); goto fail; } if (os_nodetype((char *)fname) != NODE_WRITABLE) { - errnum = (char_u *)"E503: "; - errmsg = (char_u *)_("is not a file or writable device"); + SET_ERRMSG_NUM("E503", _("is not a file or writable device")); goto fail; } /* It's a device of some kind (or a fifo) which we can write to @@ -2599,8 +2603,7 @@ buf_write ( */ c = os_nodetype((char *)fname); if (c == NODE_OTHER) { - errnum = (char_u *)"E503: "; - errmsg = (char_u *)_("is not a file or writable device"); + SET_ERRMSG_NUM("E503", _("is not a file or writable device")); goto fail; } if (c == NODE_WRITABLE) { @@ -2612,8 +2615,7 @@ buf_write ( if (perm < 0) { newfile = true; } else if (os_isdir(fname)) { - errnum = (char_u *)"E502: "; - errmsg = (char_u *)_("is a directory"); + SET_ERRMSG_NUM("E502", _("is a directory")); goto fail; } if (overwriting) { @@ -2632,11 +2634,9 @@ buf_write ( if (!forceit && file_readonly) { if (vim_strchr(p_cpo, CPO_FWRITE) != NULL) { - errnum = (char_u *)"E504: "; - errmsg = (char_u *)_(err_readonly); + SET_ERRMSG_NUM("E504", _(err_readonly)); } else { - errnum = (char_u *)"E505: "; - errmsg = (char_u *)_("is read-only (add ! to override)"); + SET_ERRMSG_NUM("E505", _("is read-only (add ! to override)")); } goto fail; } @@ -2904,23 +2904,27 @@ buf_write ( while ((write_info.bw_len = read_eintr(fd, copybuf, BUFSIZE)) > 0) { if (buf_write_bytes(&write_info) == FAIL) { - errmsg = (char_u *)_( - "E506: Can't write to backup file (add ! to override)"); + SET_ERRMSG(_( + "E506: Can't write to backup file (add ! to override)")); break; } os_breakcheck(); if (got_int) { - errmsg = (char_u *)_(e_interr); + SET_ERRMSG(_(e_interr)); break; } } - if (close(bfd) < 0 && errmsg == NULL) - errmsg = (char_u *)_( - "E507: Close error for backup file (add ! to override)"); - if (write_info.bw_len < 0) - errmsg = (char_u *)_( - "E508: Can't read file for backup (add ! to override)"); + int error; + if ((error = os_close(bfd)) != 0 && errmsg == NULL) { + SET_ERRMSG_ARG(_( + "E507: Close error for backup file (add ! to override): %s"), + error); + } + if (write_info.bw_len < 0) { + SET_ERRMSG(_( + "E508: Can't read file for backup (add ! to override)")); + } #ifdef UNIX set_file_time(backup, file_info_old.stat.st_atim.tv_sec, @@ -2937,18 +2941,19 @@ buf_write ( } } nobackup: - close(fd); /* ignore errors for closing read file */ + os_close(fd); /* ignore errors for closing read file */ xfree(copybuf); - if (backup == NULL && errmsg == NULL) - errmsg = (char_u *)_( - "E509: Cannot create backup file (add ! to override)"); - /* ignore errors when forceit is TRUE */ + if (backup == NULL && errmsg == NULL) { + SET_ERRMSG(_( + "E509: Cannot create backup file (add ! to override)")); + } + // Ignore errors when forceit is TRUE. if ((some_error || errmsg != NULL) && !forceit) { retval = FAIL; goto fail; } - errmsg = NULL; + SET_ERRMSG(NULL); } else { char_u *dirp; char_u *p; @@ -2963,8 +2968,7 @@ nobackup: * anyway, thus we need an extra check here. */ if (file_readonly && vim_strchr(p_cpo, CPO_FWRITE) != NULL) { - errnum = (char_u *)"E504: "; - errmsg = (char_u *)_(err_readonly); + SET_ERRMSG_NUM("E504", _(err_readonly)); goto fail; } @@ -3028,7 +3032,7 @@ nobackup: } } if (backup == NULL && !forceit) { - errmsg = (char_u *)_("E510: Can't make backup file (add ! to override)"); + SET_ERRMSG(_("E510: Can't make backup file (add ! to override)")); goto fail; } } @@ -3069,7 +3073,7 @@ nobackup: && !(exiting && backup != NULL)) { ml_preserve(buf, FALSE); if (got_int) { - errmsg = (char_u *)_(e_interr); + SET_ERRMSG(_(e_interr)); goto restore_backup; } } @@ -3140,8 +3144,8 @@ nobackup: */ if (*p_ccv != NUL) { wfname = vim_tempname(); - if (wfname == NULL) { /* Can't write without a tempfile! */ - errmsg = (char_u *)_("E214: Can't find temp file for writing"); + if (wfname == NULL) { // Can't write without a tempfile! + SET_ERRMSG(_("E214: Can't find temp file for writing")); goto restore_backup; } } @@ -3153,8 +3157,8 @@ nobackup: && wfname == fname ) { if (!forceit) { - errmsg = (char_u *)_( - "E213: Cannot convert (add ! to write without conversion)"); + SET_ERRMSG(_( + "E213: Cannot convert (add ! to write without conversion)")); goto restore_backup; } notconverted = TRUE; @@ -3189,11 +3193,10 @@ nobackup: if ((!newfile && os_fileinfo_hardlinks(&file_info) > 1) || (os_fileinfo_link((char *)fname, &file_info) && !os_fileinfo_id_equal(&file_info, &file_info_old))) { - errmsg = (char_u *)_("E166: Can't open linked file for writing"); - } else + SET_ERRMSG(_("E166: Can't open linked file for writing")); + } else { #endif - { - errmsg = (char_u *)_("E212: Can't open file for writing"); + SET_ERRMSG(_("E212: Can't open file for writing")); if (forceit && vim_strchr(p_cpo, CPO_FWRITE) == NULL && perm >= 0) { #ifdef UNIX @@ -3211,7 +3214,9 @@ nobackup: os_remove((char *)wfname); continue; } +#ifdef UNIX } +#endif } restore_backup: @@ -3253,7 +3258,7 @@ restore_backup: xfree(wfname); goto fail; } - errmsg = NULL; + SET_ERRMSG(NULL); write_info.bw_fd = fd; @@ -3373,7 +3378,6 @@ restore_backup: nchars += len; } -#if defined(UNIX) // On many journalling file systems there is a bug that causes both the // original and the backup file to be lost when halting the system right // after writing the file. That's because only the meta-data is @@ -3382,11 +3386,11 @@ restore_backup: // For a device do try the fsync() but don't complain if it does not work // (could be a pipe). // If the 'fsync' option is FALSE, don't fsync(). Useful for laptops. - if (p_fs && os_fsync(fd) != 0 && !device) { - errmsg = (char_u *)_("E667: Fsync failed"); + int error; + if (p_fs && (error = os_fsync(fd)) != 0 && !device) { + SET_ERRMSG_ARG(_("E667: Fsync failed: %s"), error); end = 0; } -#endif #ifdef HAVE_SELINUX /* Probably need to set the security context. */ @@ -3416,8 +3420,8 @@ restore_backup: } #endif - if (close(fd) != 0) { - errmsg = (char_u *)_("E512: Close failed"); + if ((error = os_close(fd)) != 0) { + SET_ERRMSG_ARG(_("E512: Close failed: %s"), error); end = 0; } @@ -3454,21 +3458,25 @@ restore_backup: if (end == 0) { if (errmsg == NULL) { if (write_info.bw_conv_error) { - if (write_info.bw_conv_error_lnum == 0) - errmsg = (char_u *)_( - "E513: write error, conversion failed (make 'fenc' empty to override)"); + if (write_info.bw_conv_error_lnum == 0) { + SET_ERRMSG(_( + "E513: write error, conversion failed " + "(make 'fenc' empty to override)")); + } else { - errmsg_allocated = TRUE; - errmsg = xmalloc(300); - vim_snprintf((char *)errmsg, 300, - _("E513: write error, conversion failed in line %" PRId64 + errmsg_allocated = true; + SET_ERRMSG(xmalloc(300)); + vim_snprintf( + errmsg, 300, + _("E513: write error, conversion failed in line %" PRIdLINENR " (make 'fenc' empty to override)"), - (int64_t)write_info.bw_conv_error_lnum); + write_info.bw_conv_error_lnum); } - } else if (got_int) - errmsg = (char_u *)_(e_interr); - else - errmsg = (char_u *)_("E514: write error (file system full?)"); + } else if (got_int) { + SET_ERRMSG(_(e_interr)); + } else { + SET_ERRMSG(_("E514: write error (file system full?)")); + } } /* @@ -3673,33 +3681,39 @@ nofail: #endif if (errmsg != NULL) { - int numlen = errnum != NULL ? (int)STRLEN(errnum) : 0; + const size_t numlen = (errnum != NULL ? strlen(errnum) : 0); - attr = hl_attr(HLF_E); /* set highlight for error messages */ - msg_add_fname(buf, + // Put file name in IObuff with quotes. #ifndef UNIX - sfname + msg_add_fname(buf, sfname); #else - fname + msg_add_fname(buf, fname); #endif - ); /* put file name in IObuff with quotes */ - if (STRLEN(IObuff) + STRLEN(errmsg) + numlen >= IOSIZE) - IObuff[IOSIZE - STRLEN(errmsg) - numlen - 1] = NUL; - /* If the error message has the form "is ...", put the error number in - * front of the file name. */ + const size_t errmsglen = strlen(errmsg); + if (STRLEN(IObuff) + errmsglen + numlen >= IOSIZE) { + IObuff[IOSIZE - errmsglen - numlen - 1] = NUL; + } + // If the error message has the form "is ...", put the error number in + // front of the file name. if (errnum != NULL) { STRMOVE(IObuff + numlen, IObuff); - memmove(IObuff, errnum, (size_t)numlen); + memmove(IObuff, errnum, numlen); } - STRCAT(IObuff, errmsg); - emsg(IObuff); - if (errmsg_allocated) + xstrlcat((char *)IObuff, errmsg, IOSIZE); + if (errmsgarg != 0) { + emsgf((const char *)IObuff, os_strerror(errmsgarg)); + } else { + emsgf((const char *)IObuff); + } + if (errmsg_allocated) { xfree(errmsg); + } retval = FAIL; if (end == 0) { + const int attr = hl_attr(HLF_E); // Set highlight for error messages. MSG_PUTS_ATTR(_("\nWARNING: Original file may be lost or damaged\n"), - attr | MSG_HIST); + attr | MSG_HIST); MSG_PUTS_ATTR(_( "don't quit the editor until the file is successfully written!"), attr | MSG_HIST); @@ -3759,6 +3773,9 @@ nofail: got_int |= prev_got_int; return retval; +#undef SET_ERRMSG +#undef SET_ERRMSG_ARG +#undef SET_ERRMSG_NUM } /* -- cgit From 8dd9c6edd87403fb583b1e8b5567987e159fd7e2 Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 3 Apr 2017 00:40:48 +0300 Subject: message: Do not use IObuff in emsgf --- src/nvim/message.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/message.c b/src/nvim/message.c index 83f2735b50..4423b430a5 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -573,16 +573,17 @@ void emsg_invreg(int name) /// Print an error message with unknown number of arguments bool emsgf(const char *const fmt, ...) { + static char errbuf[IOSIZE]; if (emsg_not_now()) { return true; } va_list ap; va_start(ap, fmt); - vim_vsnprintf((char *) IObuff, IOSIZE, fmt, ap, NULL); + vim_vsnprintf(errbuf, sizeof(errbuf), fmt, ap, NULL); va_end(ap); - return emsg(IObuff); + return emsg(errbuf); } static void msg_emsgf_event(void **argv) -- cgit From 8eb598c08ea51731536184a4b3e98000ce073877 Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 3 Apr 2017 00:44:49 +0300 Subject: fixup! --- src/nvim/message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/message.c b/src/nvim/message.c index 4423b430a5..1d3609291a 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -583,7 +583,7 @@ bool emsgf(const char *const fmt, ...) vim_vsnprintf(errbuf, sizeof(errbuf), fmt, ap, NULL); va_end(ap); - return emsg(errbuf); + return emsg((const char_u *)errbuf); } static void msg_emsgf_event(void **argv) -- cgit From 1c41b9c77552618a5010ca69bee92033c4082748 Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 3 Apr 2017 01:39:09 +0300 Subject: fileio: Clean up IObuff-manipulation mess --- src/nvim/fileio.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index fb44d2cc1d..e382faf7a2 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -2259,7 +2259,7 @@ buf_write ( linenr_T lnum; long nchars; #define SET_ERRMSG_NUM(num, msg) \ - errnum = num ": ", errmsg = msg, errmsgarg = 0 + errnum = num, errmsg = msg, errmsgarg = 0 #define SET_ERRMSG_ARG(msg, error) \ errnum = NULL, errmsg = msg, errmsgarg = error #define SET_ERRMSG(msg) \ @@ -3681,29 +3681,21 @@ nofail: #endif if (errmsg != NULL) { - const size_t numlen = (errnum != NULL ? strlen(errnum) : 0); - - // Put file name in IObuff with quotes. #ifndef UNIX msg_add_fname(buf, sfname); #else msg_add_fname(buf, fname); #endif - const size_t errmsglen = strlen(errmsg); - if (STRLEN(IObuff) + errmsglen + numlen >= IOSIZE) { - IObuff[IOSIZE - errmsglen - numlen - 1] = NUL; - } - // If the error message has the form "is ...", put the error number in - // front of the file name. if (errnum != NULL) { - STRMOVE(IObuff + numlen, IObuff); - memmove(IObuff, errnum, numlen); - } - xstrlcat((char *)IObuff, errmsg, IOSIZE); - if (errmsgarg != 0) { - emsgf((const char *)IObuff, os_strerror(errmsgarg)); + if (errmsgarg != 0) { + emsgf("%s: %s%s: %s", errnum, IObuff, errmsg, os_strerror(errmsgarg)); + } else { + emsgf("%s: %s%s", errnum, IObuff, errmsg); + } + } else if (errmsgarg != 0) { + emsgf(errmsg, os_strerror(errmsgarg)); } else { - emsgf((const char *)IObuff); + emsgf(errmsg); } if (errmsg_allocated) { xfree(errmsg); @@ -3822,7 +3814,7 @@ static int set_rw_fname(char_u *fname, char_u *sfname) /* * Put file name into IObuff with quotes. */ -void msg_add_fname(buf_T *buf, char_u *fname) +static void msg_add_fname(buf_T *buf, char_u *fname) { if (fname == NULL) fname = (char_u *)"-stdin-"; -- cgit From 5dcf2804455f45eac8aad7d900bf60464a4b2888 Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 3 Apr 2017 02:03:05 +0300 Subject: fileio: Refactor msg_add_fname to something which needs no comments --- src/nvim/buffer.c | 4 ++-- src/nvim/fileio.c | 58 ++++++++++++++++++++++++++++++------------------------- src/nvim/os/env.c | 7 ++++--- src/nvim/path.c | 14 +++++++------- 4 files changed, 45 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index c9101c5b53..292eb03a16 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -2724,7 +2724,7 @@ fileinfo ( else name = curbuf->b_ffname; home_replace(shorthelp ? curbuf : NULL, name, p, - (int)(IOSIZE - (p - buffer)), TRUE); + (size_t)(IOSIZE - (p - buffer)), true); } vim_snprintf_add((char *)buffer, IOSIZE, "\"%s%s%s%s%s%s", @@ -2889,7 +2889,7 @@ void maketitle(void) buf[off++] = ' '; buf[off++] = '('; home_replace(curbuf, curbuf->b_ffname, - buf + off, SPACE_FOR_DIR - off, TRUE); + buf + off, (size_t)(SPACE_FOR_DIR - off), true); #ifdef BACKSLASH_IN_FILENAME /* avoid "c:/name" to be reduced to "c" */ if (isalpha(buf[off]) && buf[off + 1] == ':') diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index e382faf7a2..1ae73e787d 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -200,18 +200,14 @@ void filemess(buf_T *buf, char_u *name, char_u *s, int attr) { int msg_scroll_save; - if (msg_silent != 0) + if (msg_silent != 0) { return; - msg_add_fname(buf, name); /* put file name in IObuff with quotes */ - /* If it's extremely long, truncate it. */ - if (STRLEN(IObuff) > IOSIZE - 80) - IObuff[IOSIZE - 80] = NUL; - STRCAT(IObuff, s); - /* - * For the first message may have to start a new line. - * For further ones overwrite the previous one, reset msg_scroll before - * calling filemess(). - */ + } + add_quoted_fname((char *)IObuff, IOSIZE - 80, buf,(const char *)name); + xstrlcat((char *)IObuff, (const char *)s, IOSIZE); + // For the first message may have to start a new line. + // For further ones overwrite the previous one, reset msg_scroll before + // calling filemess(). msg_scroll_save = msg_scroll; if (shortmess(SHM_OVERALL) && !exiting && p_verbose == 0) msg_scroll = FALSE; @@ -1800,8 +1796,8 @@ failed: } if (!filtering && !(flags & READ_DUMMY)) { - msg_add_fname(curbuf, sfname); /* fname in IObuff with quotes */ - c = FALSE; + add_quoted_fname((char *)IObuff, IOSIZE, curbuf,(const char *)sfname); + c = false; #ifdef UNIX # ifdef S_ISFIFO @@ -3531,8 +3527,8 @@ restore_backup: fname = sfname; /* use shortname now, for the messages */ #endif if (!filtering) { - msg_add_fname(buf, fname); /* put fname in IObuff with quotes */ - c = FALSE; + add_quoted_fname((char *)IObuff, IOSIZE, buf,(const char *)fname); + c = false; if (write_info.bw_conv_error) { STRCAT(IObuff, _(" CONVERSION ERROR")); c = TRUE; @@ -3681,10 +3677,11 @@ nofail: #endif if (errmsg != NULL) { + // - 100 to save some space for further error message #ifndef UNIX - msg_add_fname(buf, sfname); + add_quoted_fname((char *)IObuff, IOSIZE - 100, buf, (const char *)sfname); #else - msg_add_fname(buf, fname); + add_quoted_fname((char *)IObuff, IOSIZE - 100, buf, (const char *)fname); #endif if (errnum != NULL) { if (errmsgarg != 0) { @@ -3811,16 +3808,25 @@ static int set_rw_fname(char_u *fname, char_u *sfname) return OK; } -/* - * Put file name into IObuff with quotes. - */ -static void msg_add_fname(buf_T *buf, char_u *fname) +/// Put file name into the specified buffer with quotes +/// +/// Replaces home directory at the start with `~`. +/// +/// @param[out] ret_buf Buffer to save results to. +/// @param[in] buf_len ret_buf length. +/// @param[in] buf buf_T file name is coming from. +/// @param[in] fname File name to write. +static void add_quoted_fname(char *const ret_buf, const size_t buf_len, + const buf_T *const buf, const char *fname) + FUNC_ATTR_NONNULL_ARG(1) { - if (fname == NULL) - fname = (char_u *)"-stdin-"; - home_replace(buf, fname, IObuff + 1, IOSIZE - 4, TRUE); - IObuff[0] = '"'; - STRCAT(IObuff, "\" "); + if (fname == NULL) { + fname = "-stdin-"; + } + ret_buf[0] = '"'; + home_replace(buf, (const char_u *)fname, (char_u *)ret_buf + 1, + (int)buf_len - 4, true); + xstrlcat(ret_buf, "\" ", buf_len); } /// Append message for text mode to IObuff. diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index a10c835591..1a97adfa21 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -703,7 +703,8 @@ char *vim_getenv(const char *name) /// @param dstlen Maximum length of the result /// @param one If true, only replace one file name, including spaces and commas /// in the file name -void home_replace(buf_T *buf, char_u *src, char_u *dst, int dstlen, bool one) +void home_replace(const buf_T *const buf, const char_u *src, + char_u *dst, size_t dstlen, bool one) { size_t dirlen = 0, envlen = 0; size_t len; @@ -717,7 +718,7 @@ void home_replace(buf_T *buf, char_u *src, char_u *dst, int dstlen, bool one) * If the file is a help file, remove the path completely. */ if (buf != NULL && buf->b_help) { - STRCPY(dst, path_tail(src)); + xstrlcpy((char *)dst, (char *)path_tail(src), dstlen); return; } @@ -809,7 +810,7 @@ char_u * home_replace_save(buf_T *buf, char_u *src) FUNC_ATTR_NONNULL_RET len += STRLEN(src); } char_u *dst = xmalloc(len); - home_replace(buf, src, dst, (int)len, true); + home_replace(buf, src, dst, len, true); return dst; } diff --git a/src/nvim/path.c b/src/nvim/path.c index d0248690d9..6bf42ed2fa 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -84,15 +84,15 @@ FileComparison path_full_compare(char_u *s1, char_u *s2, int checkname) /// /// @return pointer just past the last path separator (empty string, if fname /// ends in a slash), or empty string if fname is NULL. -char_u *path_tail(char_u *fname) +char_u *path_tail(const char_u *fname) FUNC_ATTR_NONNULL_RET { if (fname == NULL) { return (char_u *)""; } - char_u *tail = get_past_head(fname); - char_u *p = tail; + const char_u *tail = get_past_head(fname); + const char_u *p = tail; // Find last part of path. while (*p != NUL) { if (vim_ispathsep_nocolon(*p)) { @@ -100,7 +100,7 @@ char_u *path_tail(char_u *fname) } mb_ptr_adv(p); } - return tail; + return (char_u *)tail; } /// Get pointer to tail of "fname", including path separators. @@ -174,9 +174,9 @@ const char *path_next_component(const char *fname) /// Get a pointer to one character past the head of a path name. /// Unix: after "/"; Win: after "c:\" /// If there is no head, path is returned. -char_u *get_past_head(char_u *path) +char_u *get_past_head(const char_u *path) { - char_u *retval = path; + const char_u *retval = path; #ifdef WIN32 // May skip "c:" @@ -189,7 +189,7 @@ char_u *get_past_head(char_u *path) ++retval; } - return retval; + return (char_u *)retval; } /* -- cgit From 97a7f4745dd1d75cd176dede1a4430bc4e28f8f7 Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 3 Apr 2017 02:11:27 +0300 Subject: eval: Add s flag, use p_fs by default, error out on unknown flag --- src/nvim/eval.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 8a3e3f3e22..7ab07fe6a2 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -17421,20 +17421,24 @@ static void f_writefile(typval_T *argvars, typval_T *rettv, FunPtr fptr) bool binary = false; bool append = false; - bool do_fsync = true; + bool do_fsync = !!p_fs; if (argvars[2].v_type != VAR_UNKNOWN) { const char *const flags = tv_get_string_chk(&argvars[2]); if (flags == NULL) { return; } - if (strchr(flags, 'b')) { - binary = true; - } - if (strchr(flags, 'a')) { - append = true; - } - if (strchr(flags, 'S')) { - do_fsync = false; + for (const char *p = flags; *p; p++) { + switch (*p) { + case 'b': { binary = true; break; } + case 'a': { append = true; break; } + case 's': { do_fsync = true; break; } + case 'S': { do_fsync = false; break; } + default: { + // Using %s, p and not %c, *p to preserve multibyte characters + emsgf(_("E5060: Unknown flag: %s"), p); + return; + } + } } } -- cgit From 2dbd49f73cba0dac8d430f86b301b6e9c15f3a7f Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 3 Apr 2017 03:02:17 +0300 Subject: fileio: Save details about E212 error --- src/nvim/fileio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 1ae73e787d..8e0e45aee6 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -3192,7 +3192,7 @@ nobackup: SET_ERRMSG(_("E166: Can't open linked file for writing")); } else { #endif - SET_ERRMSG(_("E212: Can't open file for writing")); + SET_ERRMSG_ARG(_("E212: Can't open file for writing: %s"), fd); if (forceit && vim_strchr(p_cpo, CPO_FWRITE) == NULL && perm >= 0) { #ifdef UNIX -- cgit From ac87c7e5ae5fc15ca97150dfce1476408804ae5a Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 3 Apr 2017 03:46:44 +0300 Subject: fileio: Fix most linter errors One error is still kept: buf_write function is too large. --- src/nvim/fileio.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 8e0e45aee6..c1b8203ed1 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -203,7 +203,7 @@ void filemess(buf_T *buf, char_u *name, char_u *s, int attr) if (msg_silent != 0) { return; } - add_quoted_fname((char *)IObuff, IOSIZE - 80, buf,(const char *)name); + add_quoted_fname((char *)IObuff, IOSIZE - 80, buf, (const char *)name); xstrlcat((char *)IObuff, (const char *)s, IOSIZE); // For the first message may have to start a new line. // For further ones overwrite the previous one, reset msg_scroll before @@ -1796,7 +1796,7 @@ failed: } if (!filtering && !(flags & READ_DUMMY)) { - add_quoted_fname((char *)IObuff, IOSIZE, curbuf,(const char *)sfname); + add_quoted_fname((char *)IObuff, IOSIZE, curbuf, (const char *)sfname); c = false; #ifdef UNIX @@ -2913,9 +2913,9 @@ buf_write ( int error; if ((error = os_close(bfd)) != 0 && errmsg == NULL) { - SET_ERRMSG_ARG(_( - "E507: Close error for backup file (add ! to override): %s"), - error); + SET_ERRMSG_ARG(_("E507: Close error for backup file " + "(add ! to override): %s"), + error); } if (write_info.bw_len < 0) { SET_ERRMSG(_( @@ -2937,7 +2937,7 @@ buf_write ( } } nobackup: - os_close(fd); /* ignore errors for closing read file */ + os_close(fd); // Ignore errors for closing read file. xfree(copybuf); if (backup == NULL && errmsg == NULL) { @@ -3458,8 +3458,7 @@ restore_backup: SET_ERRMSG(_( "E513: write error, conversion failed " "(make 'fenc' empty to override)")); - } - else { + } else { errmsg_allocated = true; SET_ERRMSG(xmalloc(300)); vim_snprintf( @@ -3527,7 +3526,7 @@ restore_backup: fname = sfname; /* use shortname now, for the messages */ #endif if (!filtering) { - add_quoted_fname((char *)IObuff, IOSIZE, buf,(const char *)fname); + add_quoted_fname((char *)IObuff, IOSIZE, buf, (const char *)fname); c = false; if (write_info.bw_conv_error) { STRCAT(IObuff, _(" CONVERSION ERROR")); -- cgit From bc6d868d00a739050b683f33994f7493cf81bd61 Mon Sep 17 00:00:00 2001 From: Yichao Zhou Date: Sun, 26 Mar 2017 03:15:52 -0700 Subject: 'listchars': `Whitespace` highlight group #6367 --- src/nvim/globals.h | 3 ++- src/nvim/option.c | 3 ++- src/nvim/screen.c | 8 ++++---- src/nvim/syntax.c | 1 + 4 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/nvim/globals.h b/src/nvim/globals.h index c15287aa38..3c705d88a5 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -464,6 +464,7 @@ typedef enum { , HLF_CUL // 'cursurline' , HLF_MC // 'colorcolumn' , HLF_QFL // selected quickfix line + , HLF_0 // Whitespace , HLF_COUNT // MUST be the last one } hlf_T; @@ -472,7 +473,7 @@ typedef enum { #define HL_FLAGS { '8', '~', 'z', 'Z', '@', 'd', 'e', 'i', 'l', 'm', 'M', 'n', \ 'N', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', 'f', 'F', \ 'A', 'C', 'D', 'T', '-', '>', 'B', 'P', 'R', 'L', '+', '=', \ - 'x', 'X', '*', '#', '_', '!', '.', 'o', 'q' } + 'x', 'X', '*', '#', '_', '!', '.', 'o', 'q', '0' } EXTERN int highlight_attr[HLF_COUNT]; /* Highl. attr for each context. */ EXTERN int highlight_user[9]; /* User[1-9] attributes */ diff --git a/src/nvim/option.c b/src/nvim/option.c index b3b4dc1e0a..695d0edebf 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -245,7 +245,8 @@ typedef struct vimoption { "A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal," \ "B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel," \ "x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill," \ - "!:CursorColumn,.:CursorLine,o:ColorColumn,q:QuickFixLine" + "!:CursorColumn,.:CursorLine,o:ColorColumn,q:QuickFixLine," \ + "0:Whitespace" /* * options[] is initialized here. diff --git a/src/nvim/screen.c b/src/nvim/screen.c index cf460adb82..d9a21aa81f 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -3409,7 +3409,7 @@ win_line ( || (c == ' ' && lcs_space && ptr - line <= trailcol))) { c = (c == ' ') ? lcs_space : lcs_nbsp; n_attr = 1; - extra_attr = hl_attr(HLF_8); + extra_attr = hl_attr(HLF_0); saved_attr2 = char_attr; // save current attr mb_c = c; if (enc_utf8 && (*mb_char2len)(c) > 1) { @@ -3424,7 +3424,7 @@ win_line ( if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ') { c = lcs_trail; n_attr = 1; - extra_attr = hl_attr(HLF_8); + extra_attr = hl_attr(HLF_0); saved_attr2 = char_attr; // save current attr mb_c = c; if (enc_utf8 && (*mb_char2len)(c) > 1) { @@ -3525,8 +3525,8 @@ win_line ( c_extra = lcs_tab2; } n_attr = tab_len + 1; - extra_attr = hl_attr(HLF_8); - saved_attr2 = char_attr; /* save current attr */ + extra_attr = hl_attr(HLF_0); + saved_attr2 = char_attr; // save current attr mb_c = c; if (enc_utf8 && (*mb_char2len)(c) > 1) { mb_utf8 = TRUE; diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index acda25e738..e36b00d770 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -5916,6 +5916,7 @@ static char *highlight_init_both[] = "default link EndOfBuffer NonText", "default link QuickFixLine Search", "default link Substitute Search", + "default link Whitespace NonText", NULL }; -- cgit From 3ccd59ee8216f3da812c5cf81eb392e6a95b539a Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 3 Apr 2017 16:16:21 +0200 Subject: 'guicursor': enabled=false if 'guicursor' is empty Closes #6429 Closes #6430 --- src/nvim/api/ui.c | 6 +++--- src/nvim/cursor_shape.c | 6 ++---- src/nvim/tui/tui.c | 48 ++++++++++++++++++++++++++---------------------- src/nvim/ui.c | 3 ++- src/nvim/ui.h | 2 +- src/nvim/ui_bridge.c | 22 ++++++++++++---------- 6 files changed, 46 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index a95be0fabb..de60339e5f 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -300,11 +300,11 @@ static void remote_ui_scroll(UI *ui, int count) push_call(ui, "scroll", args); } -static void remote_ui_cursor_style_set(UI *ui, Dictionary styles) +static void remote_ui_cursor_style_set(UI *ui, bool enabled, Dictionary data) { Array args = ARRAY_DICT_INIT; - Object copy = copy_object(DICTIONARY_OBJ(styles)); - ADD(args, copy); + ADD(args, BOOLEAN_OBJ(enabled)); + ADD(args, copy_object(DICTIONARY_OBJ(data))); push_call(ui, "cursor_style_set", args); } diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c index 7ec70bb724..34ee53bf75 100644 --- a/src/nvim/cursor_shape.c +++ b/src/nvim/cursor_shape.c @@ -89,10 +89,8 @@ char_u *parse_shape_opt(int what) int found_ve = false; /* found "ve" flag */ int round; - /* - * First round: check for errors; second round: do it for real. - */ - for (round = 1; round <= 2; ++round) { + // First round: check for errors; second round: do it for real. + for (round = 1; round <= 2; round++) { // Repeat for all comma separated parts. modep = p_guicursor; if (*p_guicursor == NUL) { diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index badc0cd870..f34f5f1bc4 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -84,6 +84,7 @@ typedef struct { } TUIData; static bool volatile got_winch = false; +static bool cursor_style_enabled = false; #ifdef INCLUDE_GENERATED_DECLARATIONS # include "tui/tui.c.generated.h" @@ -151,6 +152,7 @@ static void terminfo_start(UI *ui) // Set 't_Co' from the result of unibilium & fix_terminfo. t_colors = unibi_get_num(data->ut, unibi_max_colors); // Enter alternate screen and clear + // NOTE: Do this *before* changing terminal settings. #6433 unibi_out(ui, unibi_enter_ca_mode); unibi_out(ui, unibi_clear_screen); // Enable bracketed paste @@ -437,11 +439,11 @@ static void tui_cursor_goto(UI *ui, int row, int col) CursorShape tui_cursor_decode_shape(const char *shape_str) { CursorShape shape = 0; - if (strcmp(shape_str, "block") == 0) { + if (strequal(shape_str, "block")) { shape = SHAPE_BLOCK; - } else if (strcmp(shape_str, "vertical") == 0) { + } else if (strequal(shape_str, "vertical")) { shape = SHAPE_VER; - } else if (strcmp(shape_str, "horizontal") == 0) { + } else if (strequal(shape_str, "horizontal")) { shape = SHAPE_HOR; } else { EMSG2(_(e_invarg2), shape_str); @@ -454,40 +456,41 @@ static cursorentry_T decode_cursor_entry(Dictionary args) cursorentry_T r; for (size_t i = 0; i < args.size; i++) { - char *keyStr = args.items[i].key.data; + char *key = args.items[i].key.data; Object value = args.items[i].value; - if (strcmp(keyStr, "cursor_shape") == 0) { + if (strequal(key, "cursor_shape")) { r.shape = tui_cursor_decode_shape(args.items[i].value.data.string.data); - } else if (strcmp(keyStr, "blinkon") == 0) { + } else if (strequal(key, "blinkon")) { r.blinkon = (int)value.data.integer; - } else if (strcmp(keyStr, "blinkoff") == 0) { + } else if (strequal(key, "blinkoff")) { r.blinkoff = (int)value.data.integer; - } else if (strcmp(keyStr, "hl_id") == 0) { + } else if (strequal(key, "hl_id")) { r.id = (int)value.data.integer; } } return r; } -static void tui_cursor_style_set(UI *ui, Dictionary args) +static void tui_cursor_style_set(UI *ui, bool enabled, Dictionary args) { + cursor_style_enabled = enabled; + if (!enabled) { + return; // Do not send cursor style control codes. + } TUIData *data = ui->data; + assert(args.size); + // Keys: as defined by `shape_table`. for (size_t i = 0; i < args.size; i++) { char *mode_name = args.items[i].key.data; const int mode_id = cursor_mode_str2int(mode_name); - - if (mode_id < 0) { - WLOG("Unknown mode '%s'", mode_name); - continue; - } + assert(mode_id >= 0); cursorentry_T r = decode_cursor_entry(args.items[i].value.data.dictionary); r.full_name = mode_name; data->cursor_shapes[mode_id] = r; } - // force redraw MouseMode cursor_mode = tui_mode2cursor(data->showing_mode); tui_set_cursor(ui, cursor_mode); } @@ -528,6 +531,9 @@ static void tui_mouse_off(UI *ui) /// @param mode one of SHAPE_XXX static void tui_set_cursor(UI *ui, MouseMode mode) { + if (!cursor_style_enabled) { + return; + } TUIData *data = ui->data; cursorentry_T c = data->cursor_shapes[mode]; int shape = c.shape; @@ -536,17 +542,15 @@ static void tui_set_cursor(UI *ui, MouseMode mode) # define TMUX_WRAP(seq) (inside_tmux ? "\x1bPtmux;\x1b" seq "\x1b\\" : seq) // Support changing cursor shape on some popular terminals. - const char *term_prog = os_getenv("TERM_PROGRAM"); const char *vte_version = os_getenv("VTE_VERSION"); - if ((term_prog && !strcmp(term_prog, "Konsole")) - || os_getenv("KONSOLE_DBUS_SESSION") != NULL) { + if (os_getenv("KONSOLE_PROFILE_NAME") || os_getenv("KONSOLE_DBUS_SESSION")) { // Konsole uses a proprietary escape code to set the cursor shape // and does not support DECSCUSR. switch (shape) { case SHAPE_BLOCK: shape = 0; break; case SHAPE_VER: shape = 1; break; - case SHAPE_HOR: shape = 3; break; + case SHAPE_HOR: shape = 2; break; default: WLOG("Unknown shape value %d", shape); break; } data->params[0].i = shape; @@ -1102,15 +1106,15 @@ static const char *tui_tk_ti_getstr(const char *name, const char *value, stty_erase = tui_get_stty_erase(); } - if (strcmp(name, "key_backspace") == 0) { + if (strequal(name, "key_backspace")) { ILOG("libtermkey:kbs=%s", value); if (stty_erase != NULL && stty_erase[0] != 0) { return stty_erase; } - } else if (strcmp(name, "key_dc") == 0) { + } else if (strequal(name, "key_dc")) { ILOG("libtermkey:kdch1=%s", value); // Vim: "If and are now the same, redefine ." - if (stty_erase != NULL && value != NULL && strcmp(stty_erase, value) == 0) { + if (stty_erase != NULL && value != NULL && strequal(stty_erase, value)) { return stty_erase[0] == DEL ? CTRL_H_STR : DEL_STR; } } diff --git a/src/nvim/ui.c b/src/nvim/ui.c index babb4efa96..28f71b7ef2 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -381,7 +381,8 @@ void ui_cursor_goto(int new_row, int new_col) void ui_cursor_style_set(void) { Dictionary style = cursor_shape_dict(); - UI_CALL(cursor_style_set, style); + bool enabled = (*p_guicursor != NUL); + UI_CALL(cursor_style_set, enabled, style); api_free_dictionary(style); } diff --git a/src/nvim/ui.h b/src/nvim/ui.h index 0af0c0db65..8ffc5a45a6 100644 --- a/src/nvim/ui.h +++ b/src/nvim/ui.h @@ -22,7 +22,7 @@ struct ui_t { void (*clear)(UI *ui); void (*eol_clear)(UI *ui); void (*cursor_goto)(UI *ui, int row, int col); - void (*cursor_style_set)(UI *ui, Dictionary cursor_shapes); + void (*cursor_style_set)(UI *ui, bool enabled, Dictionary cursor_styles); void (*update_menu)(UI *ui); void (*busy_start)(UI *ui); void (*busy_stop)(UI *ui); diff --git a/src/nvim/ui_bridge.c b/src/nvim/ui_bridge.c index c9bad6b254..9f780663ac 100644 --- a/src/nvim/ui_bridge.c +++ b/src/nvim/ui_bridge.c @@ -60,7 +60,7 @@ UI *ui_bridge_attach(UI *ui, ui_main_fn ui_main, event_scheduler scheduler) rv->bridge.clear = ui_bridge_clear; rv->bridge.eol_clear = ui_bridge_eol_clear; rv->bridge.cursor_goto = ui_bridge_cursor_goto; - rv->bridge.cursor_style_set = ui_bridge_cursor_styleset; + rv->bridge.cursor_style_set = ui_bridge_cursor_style_set; rv->bridge.update_menu = ui_bridge_update_menu; rv->bridge.busy_start = ui_bridge_busy_start; rv->bridge.busy_stop = ui_bridge_busy_stop; @@ -180,19 +180,21 @@ static void ui_bridge_cursor_goto_event(void **argv) ui->cursor_goto(ui, PTR2INT(argv[1]), PTR2INT(argv[2])); } -static void ui_bridge_cursor_styleset(UI *b, Dictionary style) +static void ui_bridge_cursor_style_set(UI *b, bool enabled, Dictionary styles) { - Object copy = copy_object(DICTIONARY_OBJ(style)); - Object *pobj = xmalloc(sizeof(copy)); - *pobj = copy; - UI_CALL(b, cursor_styleset, 2, b, pobj); + bool *enabledp = xmalloc(sizeof(*enabledp)); + Object *stylesp = xmalloc(sizeof(*stylesp)); + *enabledp = enabled; + *stylesp = copy_object(DICTIONARY_OBJ(styles)); + UI_CALL(b, cursor_style_set, 3, b, enabledp, stylesp); } -static void ui_bridge_cursor_styleset_event(void **argv) +static void ui_bridge_cursor_style_set_event(void **argv) { UI *ui = UI(argv[0]); - Object *styles = (Object *)argv[1]; - - ui->cursor_style_set(ui, styles->data.dictionary); + bool *enabled = argv[1]; + Object *styles = argv[2]; + ui->cursor_style_set(ui, *enabled, styles->data.dictionary); + xfree(enabled); api_free_object(*styles); xfree(styles); } -- cgit From e348e256f3ed93fe462971447ee79033307b2ddf Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 4 Apr 2017 02:37:43 +0200 Subject: 'guicursor': Disable by default for unknown terminals. User can still set guicursor explicitly in init.vim. Closes #5990 Closes #6403 --- src/nvim/main.c | 2 +- src/nvim/option.c | 20 +++++++++++--------- src/nvim/os/env.c | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/nvim/main.c b/src/nvim/main.c index 33e1551351..7ad42d6776 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -283,7 +283,7 @@ int main(int argc, char **argv) cmdline_row = (int)(Rows - p_ch); msg_row = cmdline_row; screenalloc(false); /* allocate screen buffers */ - set_init_2(); + set_init_2(params.headless); TIME_MSG("inits 2"); msg_scroll = TRUE; diff --git a/src/nvim/option.c b/src/nvim/option.c index 695d0edebf..458d80716c 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -939,11 +939,8 @@ void free_all_options(void) #endif -/* - * Initialize the options, part two: After getting Rows and Columns and - * setting 'term'. - */ -void set_init_2(void) +/// Initialize the options, part two: After getting Rows and Columns. +void set_init_2(bool headless) { int idx; @@ -966,8 +963,12 @@ void set_init_2(void) p_window = Rows - 1; } set_number_default("window", Rows - 1); - parse_shape_opt(SHAPE_CURSOR); /* set cursor shapes from 'guicursor' */ - (void)parse_printoptions(); /* parse 'printoptions' default value */ + if (!headless && !os_term_is_nice()) { + set_string_option_direct((char_u *)"guicursor", -1, (char_u *)"", + OPT_GLOBAL, SID_NONE); + } + parse_shape_opt(SHAPE_CURSOR); // set cursor shapes from 'guicursor' + (void)parse_printoptions(); // parse 'printoptions' default value } /* @@ -2842,9 +2843,10 @@ did_set_string_option ( } } - /* 'guicursor' */ - else if (varp == &p_guicursor) + // 'guicursor' + else if (varp == &p_guicursor) { errmsg = parse_shape_opt(SHAPE_CURSOR); + } else if (varp == &p_popt) errmsg = parse_printoptions(); diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index 1a97adfa21..839e0d1b51 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -889,3 +889,17 @@ bool os_setenv_append_path(const char *fname) } return false; } + +/// Returns true if the terminal can be assumed to silently ignore unknown +/// control codes. +bool os_term_is_nice(void) +{ +#if defined(__APPLE__) || defined(WIN32) + return true; +#else + const char *vte_version = os_getenv("VTE_VERSION"); + return (vte_version && atoi(vte_version) >= 3900) + || NULL != os_getenv("KONSOLE_PROFILE_NAME") + || NULL != os_getenv("KONSOLE_DBUS_SESSION"); +#endif +} -- cgit From a7f34e199144bfb657c180cdc1413093fd34bdf9 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 4 Apr 2017 03:38:57 +0200 Subject: options: remove 'guiheadroom' --- src/nvim/options.lua | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src') diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 09f016cf5a..4ca63f2efe 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -1025,13 +1025,6 @@ return { redraw={'everything'}, enable_if=false, }, - { - full_name='guiheadroom', abbreviation='ghr', - type='number', scope={'global'}, - vi_def=true, - enable_if=false, - defaults={if_true={vi=50}} - }, { full_name='guioptions', abbreviation='go', type='string', list='flags', scope={'global'}, -- cgit From c501d7c432693705482f76a384a98b4b4c0ef1a9 Mon Sep 17 00:00:00 2001 From: Carlo Abelli Date: Thu, 6 Apr 2017 08:48:42 -0400 Subject: refactor/single-include: diff.h (#6443) --- src/nvim/CMakeLists.txt | 1 - src/nvim/diff.h | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 5a5ebc4415..d0f75a2b5b 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -425,7 +425,6 @@ endfunction() set(NO_SINGLE_CHECK_HEADERS cursor_shape.h - diff.h digraph.h ex_cmds.h ex_getln.h diff --git a/src/nvim/diff.h b/src/nvim/diff.h index f6cef1cafd..3624ce29bb 100644 --- a/src/nvim/diff.h +++ b/src/nvim/diff.h @@ -1,6 +1,9 @@ #ifndef NVIM_DIFF_H #define NVIM_DIFF_H +#include "nvim/pos.h" +#include "nvim/ex_cmds_defs.h" + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "diff.h.generated.h" #endif -- cgit From 6a6bbbc6d8fa79a0c14fb913baa3ba2d7046419c Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 6 Apr 2017 08:54:30 -0400 Subject: vim-patch:7.4.2281 Problem: Timer test fails sometimes. Solution: Reduce minimum time by 1 msec. https://github.com/vim/vim/commit/0426bae2abede764d0dd366a28663d1c6e6ab0fe --- src/nvim/testdir/test_timers.vim | 6 +++--- src/nvim/version.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index db10f351ae..16c70b166b 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -20,7 +20,7 @@ func Test_oneshot() let slept = WaitFor('g:val == 1') call assert_equal(1, g:val) if has('reltime') - call assert_inrange(50, 100, slept) + call assert_inrange(49, 100, slept) else call assert_inrange(20, 100, slept) endif @@ -32,7 +32,7 @@ func Test_repeat_three() let slept = WaitFor('g:val == 3') call assert_equal(3, g:val) if has('reltime') - call assert_inrange(150, 250, slept) + call assert_inrange(149, 250, slept) else call assert_inrange(80, 200, slept) endif @@ -57,7 +57,7 @@ func Test_with_partial_callback() let slept = WaitFor('g:val == 1') call assert_equal(1, g:val) if has('reltime') - call assert_inrange(50, 130, slept) + call assert_inrange(49, 130, slept) else call assert_inrange(20, 100, slept) endif diff --git a/src/nvim/version.c b/src/nvim/version.c index ca520c7af5..3944551cb4 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -160,7 +160,7 @@ static const int included_patches[] = { 2284, 2283, // 2282 NA - // 2281 NA + 2281, 2280, 2279, // 2278 NA -- cgit From 0f99645b8faf3e5970e46c185c0cbbd7a9cfe318 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 6 Apr 2017 08:55:51 -0400 Subject: vim-patch:7.4.2304 Problem: In a timer callback the timer itself can't be found or stopped. (Thinca) Solution: Do not remove the timer from the list, remember whether it was freed. https://github.com/vim/vim/commit/417ccd7138d4d230d328de8b0d3892dd82ff1bee --- src/nvim/testdir/test_timers.vim | 15 +++++++++++++++ src/nvim/version.c | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index 16c70b166b..6a8b09c898 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -125,4 +125,19 @@ func Test_paused() endif endfunc +func StopMyself(timer) + let g:called += 1 + if g:called == 2 + call timer_stop(a:timer) + endif +endfunc + +func Test_delete_myself() + let g:called = 0 + let t = timer_start(10, 'StopMyself', {'repeat': -1}) + call WaitFor('g:called == 2') + call assert_equal(2, g:called) + call assert_equal([], timer_info(t)) +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/version.c b/src/nvim/version.c index 3944551cb4..beb23090ec 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -137,7 +137,7 @@ static const int included_patches[] = { 2307, 2306, 2305, - // 2304 NA + 2304, 2303, // 2302 NA // 2301 NA -- cgit From 9edbeec07716cff5607202dbd20b81917416030f Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 6 Apr 2017 08:56:53 -0400 Subject: vim-patch:7.4.2332 Problem: Crash when stop_timer() is called in a callback of a callback. Vim hangs when the timer callback uses too much time. Solution: Set tr_id to -1 when a timer is to be deleted. Don't keep calling callbacks forever. (Ozaki Kiichi) https://github.com/vim/vim/commit/75537a93e985ef32e6c267b06ce93629855dd983 --- src/nvim/testdir/test_timers.vim | 30 ++++++++++++++++++++++++++++++ src/nvim/version.c | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index 6a8b09c898..2a768585ce 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -140,4 +140,34 @@ func Test_delete_myself() call assert_equal([], timer_info(t)) endfunc +func StopTimer1(timer) + let g:timer2 = timer_start(10, 'StopTimer2') + " avoid maxfuncdepth error + call timer_pause(g:timer1, 1) + sleep 40m +endfunc + +func StopTimer2(timer) + call timer_stop(g:timer1) +endfunc + +func Test_stop_in_callback() + let g:timer1 = timer_start(10, 'StopTimer1') + sleep 40m +endfunc + +func StopTimerAll(timer) + call timer_stopall() +endfunc + +func Test_stop_all_in_callback() + let g:timer1 = timer_start(10, 'StopTimerAll') + let info = timer_info() + call assert_equal(1, len(info)) + sleep 40m + let info = timer_info() + call assert_equal(0, len(info)) +endfunc + + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/version.c b/src/nvim/version.c index beb23090ec..d16eab7201 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -109,7 +109,7 @@ static const int included_patches[] = { 2335, 2334, 2333, - // 2332 NA + 2332, 2331, 2330, 2329, -- cgit From 071f2da66bacfd5a2d4ab87bda275d3848ddcc0e Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 6 Apr 2017 08:58:18 -0400 Subject: vim-patch:7.4.2359 Problem: Memory leak in timer_start(). Solution: Check the right field to be NULL. https://github.com/vim/vim/commit/26fe0d56912e42c2b16a61b2480e19ba569aee98 --- src/nvim/testdir/test_timers.vim | 8 ++++---- src/nvim/version.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index 2a768585ce..fd2b50b495 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -48,12 +48,12 @@ endfunc func Test_with_partial_callback() let g:val = 0 - let s:meow = {} - function s:meow.bite(...) - let g:val += 1 + let meow = {'one': 1} + function meow.bite(...) + let g:val += self.one endfunction - call timer_start(50, s:meow.bite) + call timer_start(50, meow.bite) let slept = WaitFor('g:val == 1') call assert_equal(1, g:val) if has('reltime') diff --git a/src/nvim/version.c b/src/nvim/version.c index d16eab7201..9a5d7ce169 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -82,7 +82,7 @@ static const int included_patches[] = { 2362, // 2361 NA // 2360, - // 2359 NA + 2359, // 2358 NA 2357, // 2356, -- cgit From 30e1cda8acb7bd8120348d1812cfd9ecd8be8528 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 6 Apr 2017 21:35:03 +0200 Subject: completion: fix segfault with ignorecase+infercase (#6452) Helped-by: Matthew Malcomson Closes #6451 --- src/nvim/edit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index da09aed3dc..b35504908e 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -2109,7 +2109,7 @@ int ins_compl_add_infercase(char_u *str, int len, int icase, char_u *fname, int xfree(wca); - return ins_compl_add(IObuff, len, icase, fname, NULL, true, dir, flags, + return ins_compl_add(IObuff, len, icase, fname, NULL, false, dir, flags, false); } return ins_compl_add(str, len, icase, fname, NULL, false, dir, flags, false); @@ -2146,7 +2146,7 @@ static int ins_compl_add(char_u *const str, int len, os_breakcheck(); #define FREE_CPTEXT(cptext, cptext_allocated) \ do { \ - if (cptext_allocated) { \ + if (cptext != NULL && cptext_allocated) { \ for (size_t i = 0; i < CPT_COUNT; i++) { \ xfree(cptext[i]); \ } \ -- cgit From 1813076c448f1039db33e08e83b7f1f2011db0ee Mon Sep 17 00:00:00 2001 From: Nicolas Hillegeer Date: Fri, 7 Apr 2017 12:29:17 +0200 Subject: eval: delimit string with NUL byte (#6467) A recent refactor left cpy without a NUL terminator, simplify the code instead of patching over it. Instead of plain memcpy, it'd be better to employ harder to misuse string functions made for this purpose like xstrlcpy(), but path_tail() takes char_u arguments and returns them, leading to a lot of ugly casting. Fixes #6431. --- src/nvim/eval.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 7ab07fe6a2..1636b490d5 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -13416,14 +13416,12 @@ static void f_resolve(typval_T *argvars, typval_T *rettv, FunPtr fptr) q = (char *)path_tail((char_u *)p); } if (q > p && !path_is_absolute_path((const char_u *)buf)) { - // Symlink is relative to directory of argument. + // Symlink is relative to directory of argument. Replace the + // symlink with the resolved name in the same directory. const size_t p_len = strlen(p); const size_t buf_len = strlen(buf); - cpy = xmalloc(p_len + buf_len + 1); - memcpy(cpy, p, p_len); - memcpy(path_tail((char_u *)cpy), buf, buf_len + 1); - xfree(p); - p = cpy; + p = xrealloc(p, p_len + buf_len + 1); + memcpy(path_tail((char_u *)p), buf, buf_len + 1); } else { xfree(p); p = xstrdup(buf); -- cgit From 13352c00f1909d9296c5f276a3735f5e6f231b39 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 7 Apr 2017 19:46:33 +0200 Subject: win: os_get_hostname() #5416 (#6413) --- src/nvim/mbyte.c | 51 ++++++++++++++++++++++++++------------------------- src/nvim/os/env.c | 24 ++++++++++++++++++++---- src/nvim/os/fs.c | 2 +- 3 files changed, 47 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index d96848754c..460528b85f 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -1304,6 +1304,7 @@ static int utf_strnicmp(const char_u *s1, const char_u *s2, size_t n1, # define CP_UTF8 65001 /* magic number from winnls.h */ #endif +/// Reassigns `strw` to a new, allocated pointer to a UTF16 string. int utf8_to_utf16(const char *str, WCHAR **strw) FUNC_ATTR_NONNULL_ALL { @@ -1345,40 +1346,40 @@ int utf8_to_utf16(const char *str, WCHAR **strw) return 0; } +/// Reassigns `str` to a new, allocated pointer to a UTF8 string. int utf16_to_utf8(const WCHAR *strw, char **str) FUNC_ATTR_NONNULL_ALL { // Compute the space required to store the string as UTF-8. - ssize_t utf8_len = WideCharToMultiByte(CP_UTF8, - 0, - strw, - -1, - NULL, - 0, - NULL, - NULL); + DWORD utf8_len = WideCharToMultiByte(CP_UTF8, + 0, + strw, + -1, + NULL, + 0, + NULL, + NULL); if (utf8_len == 0) { return GetLastError(); } - ssize_t buf_sz = utf8_len * sizeof(char); - char *buf = xmalloc(buf_sz); - char *pos = buf; + *str = xmalloc(utf8_len); - // Convert string to UTF-8. - int r = WideCharToMultiByte(CP_UTF8, - 0, - strw, - -1, - pos, - utf8_len, - NULL, - NULL); - assert(r == utf8_len); - if (r != utf8_len) { - EMSG2("WideCharToMultiByte failed: %d", r); - } - *str = pos; + // Convert to UTF-8. + utf8_len = WideCharToMultiByte(CP_UTF8, + 0, + strw, + -1, + *str, + utf8_len, + NULL, + NULL); + if (utf8_len == 0) { + free(*str); + *str = NULL; + return GetLastError(); + } + (*str)[utf8_len] = '\0'; return 0; } diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index 839e0d1b51..12c2da6152 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -118,7 +118,6 @@ char *os_getenvname_at_index(size_t index) return name; } - /// Get the process ID of the Neovim process. /// /// @return the process ID. @@ -145,10 +144,27 @@ void os_get_hostname(char *hostname, size_t size) } else { xstrlcpy(hostname, vutsname.nodename, size); } +#elif defined(WIN32) + WCHAR host_utf16[MAX_COMPUTERNAME_LENGTH + 1]; + DWORD host_wsize = sizeof(host_utf16) / sizeof(host_utf16[0]); + if (GetComputerNameW(host_utf16, &host_wsize) == 0) { + *hostname = '\0'; + DWORD err = GetLastError(); + EMSG2("GetComputerNameW failed: %d", err); + return; + } + host_utf16[host_wsize] = '\0'; + + char *host_utf8; + int conversion_result = utf16_to_utf8(host_utf16, &host_utf8); + if (conversion_result != 0) { + EMSG2("utf16_to_utf8 failed: %d", conversion_result); + return; + } + xstrlcpy(hostname, host_utf8, size); + xfree(host_utf8); #else - // TODO(unknown): Implement this for windows. - // See the implementation used in vim: - // https://code.google.com/p/vim/source/browse/src/os_win32.c?r=6b69d8dde19e32909f4ee3a6337e6a2ecfbb6f72#2899 + EMSG("os_get_hostname failed: missing uname()"); *hostname = '\0'; #endif } diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index 3833a43f5f..c33e1140e8 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -1009,7 +1009,7 @@ char *os_resolve_shortcut(const char *fname) WCHAR *p; const int conversion_result = utf8_to_utf16(fname, &p); if (conversion_result != 0) { - EMSG2("utf8_to_utf16 failed: %s", uv_strerror(conversion_result)); + EMSG2("utf8_to_utf16 failed: %d", conversion_result); } if (p != NULL) { -- cgit From 20dc04470e00a369d2ba917a22b06ef2d173953f Mon Sep 17 00:00:00 2001 From: James McCoy Date: Fri, 7 Apr 2017 16:08:58 -0400 Subject: vim-patch:8.0.0499 Problem: taglist() does not prioritize tags for a buffer. Solution: Add an optional buffer argument. (Duncan McDougall, closes vim/vim#1194) https://github.com/vim/vim/commit/c6aafbaf3ea755e3ab4ee2e3045911126a08b038 --- src/nvim/eval.c | 10 +++++++--- src/nvim/eval.lua | 2 +- src/nvim/tag.c | 10 ++++------ src/nvim/testdir/test_alot.vim | 1 + src/nvim/testdir/test_taglist.vim | 21 +++++++++++++++++++++ 5 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 src/nvim/testdir/test_taglist.vim (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 1636b490d5..e15d6c0240 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -8728,8 +8728,7 @@ static void f_foldtextresult(typval_T *argvars, typval_T *rettv, FunPtr fptr) } fold_count = foldedCount(curwin, lnum, &foldinfo); if (fold_count > 0) { - text = get_foldtext(curwin, lnum, lnum + fold_count - 1, - &foldinfo, buf); + text = get_foldtext(curwin, lnum, lnum + fold_count - 1, &foldinfo, buf); if (text == buf) text = vim_strsave(text); rettv->vval.v_string = text; @@ -16436,7 +16435,12 @@ static void f_taglist(typval_T *argvars, typval_T *rettv, FunPtr fptr) return; } - (void)get_tags(tv_list_alloc_ret(rettv), (char_u *)tag_pattern); + const char *fname = NULL; + if (argvars[1].v_type != VAR_UNKNOWN) { + fname = tv_get_string(&argvars[1]); + } + (void)get_tags(tv_list_alloc_ret(rettv), (char_u *)tag_pattern, + (char_u *)fname); } /* diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index e3c5981b32..6f876e2a96 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -300,7 +300,7 @@ return { tabpagenr={args={0, 1}}, tabpagewinnr={args={1, 2}}, tagfiles={}, - taglist={args=1}, + taglist={args={1, 2}}, tan={args=1, func="float_op_wrapper", data="&tan"}, tanh={args=1, func="float_op_wrapper", data="&tanh"}, tempname={}, diff --git a/src/nvim/tag.c b/src/nvim/tag.c index b812dd2ffd..e4ff829807 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -2797,11 +2797,9 @@ add_tag_field ( return retval; } -/* - * Add the tags matching the specified pattern to the list "list" - * as a dictionary - */ -int get_tags(list_T *list, char_u *pat) +/// Add the tags matching the specified pattern "pat" to the list "list" +/// as a dictionary. Use "buf_fname" for priority, unless NULL. +int get_tags(list_T *list, char_u *pat, char_u *buf_fname) { int num_matches, i, ret; char_u **matches, *p; @@ -2811,7 +2809,7 @@ int get_tags(list_T *list, char_u *pat) bool is_static; ret = find_tags(pat, &num_matches, &matches, - TAG_REGEXP | TAG_NOIC, (int)MAXCOL, NULL); + TAG_REGEXP | TAG_NOIC, (int)MAXCOL, buf_fname); if (ret == OK && num_matches > 0) { for (i = 0; i < num_matches; ++i) { int parse_result = parse_match(matches[i], &tp); diff --git a/src/nvim/testdir/test_alot.vim b/src/nvim/testdir/test_alot.vim index baf49b7ff7..99d9835996 100644 --- a/src/nvim/testdir/test_alot.vim +++ b/src/nvim/testdir/test_alot.vim @@ -26,6 +26,7 @@ source test_tabline.vim " source test_tabpage.vim source test_tagcase.vim source test_tagjump.vim +source test_taglist.vim source test_true_false.vim source test_unlet.vim source test_utf8.vim diff --git a/src/nvim/testdir/test_taglist.vim b/src/nvim/testdir/test_taglist.vim new file mode 100644 index 0000000000..b89b25eae2 --- /dev/null +++ b/src/nvim/testdir/test_taglist.vim @@ -0,0 +1,21 @@ +" test 'taglist' function + +func Test_taglist() + call writefile([ + \ "FFoo\tXfoo\t1", + \ "FBar\tXfoo\t2", + \ "BFoo\tXbar\t1", + \ "BBar\tXbar\t2" + \ ], 'Xtags') + set tags=Xtags + split Xtext + + call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo"), {i, v -> v.name})) + call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo", "Xtext"), {i, v -> v.name})) + call assert_equal(['FFoo', 'BFoo'], map(taglist("Foo", "Xfoo"), {i, v -> v.name})) + call assert_equal(['BFoo', 'FFoo'], map(taglist("Foo", "Xbar"), {i, v -> v.name})) + + call delete('Xtags') + bwipe +endfunc + -- cgit From 98dd9b801281bb6eb82817ba92c4f635bb5f45e0 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Fri, 7 Apr 2017 16:18:25 -0400 Subject: vim-patch:8.0.0550 Problem: Some etags format tags file use 0x01, breaking the parsing. Solution: Use 0x02 for TAG_SEP. (James McCoy, closes vim/vim#1614) https://github.com/vim/vim/commit/9585a1655ba0d34ea88574617112093a9bd4f2e9 --- src/nvim/tag.c | 10 +++++----- src/nvim/testdir/test_taglist.vim | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/nvim/tag.c b/src/nvim/tag.c index e4ff829807..f01b8b8ab1 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -1847,14 +1847,14 @@ parse_line: } } } else { -#define TAG_SEP 0x01 +#define TAG_SEP 0x02 size_t tag_fname_len = STRLEN(tag_fname); // Save the tag in a buffer. - // Use 0x01 to separate fields (Can't use NUL, because the + // Use 0x02 to separate fields (Can't use NUL, because the // hash key is terminated by NUL). - // Emacs tag: - // other tag: - // without Emacs tags: + // Emacs tag: <0x02><0x02> + // other tag: <0x02><0x02> + // without Emacs tags: <0x02> // Here is the "mtt" value plus 1 to avoid NUL. len = (int)tag_fname_len + (int)STRLEN(lbuf) + 3; mfp = xmalloc(sizeof(char_u) + len + 1); diff --git a/src/nvim/testdir/test_taglist.vim b/src/nvim/testdir/test_taglist.vim index b89b25eae2..2d1557ebd9 100644 --- a/src/nvim/testdir/test_taglist.vim +++ b/src/nvim/testdir/test_taglist.vim @@ -19,3 +19,40 @@ func Test_taglist() bwipe endfunc +func Test_taglist_native_etags() + if !has('emacs_tags') + return + endif + call writefile([ + \ "\x0c", + \ "src/os_unix.c,13491", + \ "set_signals(\x7f1335,32699", + \ "reset_signals(\x7f1407,34136", + \ ], 'Xtags') + + set tags=Xtags + + call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']], + \ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]})) + + call delete('Xtags') +endfunc + +func Test_taglist_ctags_etags() + if !has('emacs_tags') + return + endif + call writefile([ + \ "\x0c", + \ "src/os_unix.c,13491", + \ "set_signals(void)\x7fset_signals\x011335,32699", + \ "reset_signals(void)\x7freset_signals\x011407,34136", + \ ], 'Xtags') + + set tags=Xtags + + call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']], + \ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]})) + + call delete('Xtags') +endfunc -- cgit From 123931e65e8f6ca3ac13fff8279720c8328a018e Mon Sep 17 00:00:00 2001 From: James McCoy Date: Fri, 7 Apr 2017 16:38:06 -0400 Subject: lint --- src/nvim/eval.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index e15d6c0240..124d6acfe9 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -8729,8 +8729,9 @@ static void f_foldtextresult(typval_T *argvars, typval_T *rettv, FunPtr fptr) fold_count = foldedCount(curwin, lnum, &foldinfo); if (fold_count > 0) { text = get_foldtext(curwin, lnum, lnum + fold_count - 1, &foldinfo, buf); - if (text == buf) + if (text == buf) { text = vim_strsave(text); + } rettv->vval.v_string = text; } } -- cgit From fd8f18bce25e6dcc66dec1fa4870a7ca5c106dec Mon Sep 17 00:00:00 2001 From: dedmass Date: Tue, 4 Apr 2017 20:30:32 -0400 Subject: refactor/single-include: cursor_shape.h #6442 --- src/nvim/CMakeLists.txt | 1 - src/nvim/cursor_shape.h | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index d0f75a2b5b..db3b406b4a 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -424,7 +424,6 @@ function(get_test_target prefix sfile relative_path_var target_var) endfunction() set(NO_SINGLE_CHECK_HEADERS - cursor_shape.h digraph.h ex_cmds.h ex_getln.h diff --git a/src/nvim/cursor_shape.h b/src/nvim/cursor_shape.h index 0006ede31d..7cf65cba3c 100644 --- a/src/nvim/cursor_shape.h +++ b/src/nvim/cursor_shape.h @@ -1,6 +1,9 @@ #ifndef NVIM_CURSOR_SHAPE_H #define NVIM_CURSOR_SHAPE_H +#include "nvim/types.h" +#include "nvim/api/private/defs.h" + /// struct to store values from 'guicursor' and 'mouseshape' /// Indexes in shape_table[] typedef enum { -- cgit From f4e97fe49988b834fea8d8b7a62de0938325395a Mon Sep 17 00:00:00 2001 From: dedmass Date: Tue, 4 Apr 2017 20:53:26 -0400 Subject: refactor/single-include: digraph.h #6444 --- src/nvim/CMakeLists.txt | 1 - src/nvim/digraph.h | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index db3b406b4a..5524c4d87d 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -424,7 +424,6 @@ function(get_test_target prefix sfile relative_path_var target_var) endfunction() set(NO_SINGLE_CHECK_HEADERS - digraph.h ex_cmds.h ex_getln.h file_search.h diff --git a/src/nvim/digraph.h b/src/nvim/digraph.h index b623969e08..d0f10eaf78 100644 --- a/src/nvim/digraph.h +++ b/src/nvim/digraph.h @@ -1,6 +1,9 @@ #ifndef NVIM_DIGRAPH_H #define NVIM_DIGRAPH_H +#include "nvim/types.h" // for char_u +#include "nvim/ex_cmds_defs.h" // for exarg_T + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "digraph.h.generated.h" #endif -- cgit From 3d4a2ee9c72e772113e69c9928fbc58e9dc4b09b Mon Sep 17 00:00:00 2001 From: dedmass Date: Thu, 6 Apr 2017 09:12:59 -0400 Subject: refactor/single-include: ex_cmds.h #6453 --- src/nvim/CMakeLists.txt | 1 - src/nvim/ex_cmds.h | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 5524c4d87d..843bff3655 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -424,7 +424,6 @@ function(get_test_target prefix sfile relative_path_var target_var) endfunction() set(NO_SINGLE_CHECK_HEADERS - ex_cmds.h ex_getln.h file_search.h fold.h diff --git a/src/nvim/ex_cmds.h b/src/nvim/ex_cmds.h index 65bbd8a99e..792e2f772f 100644 --- a/src/nvim/ex_cmds.h +++ b/src/nvim/ex_cmds.h @@ -6,6 +6,8 @@ #include "nvim/os/time.h" #include "nvim/pos.h" #include "nvim/eval/typval.h" +#include "nvim/buffer_defs.h" // for buf_T and win_T +#include "nvim/ex_cmds_defs.h" // for exarg_T // flags for do_ecmd() #define ECMD_HIDE 0x01 // don't free the current buffer -- cgit From b47e1029a549d6563eeec17e099b82d781925f71 Mon Sep 17 00:00:00 2001 From: dedmass Date: Thu, 6 Apr 2017 21:56:27 -0400 Subject: refactor/single-include: move.h #6469 --- src/nvim/CMakeLists.txt | 1 - src/nvim/move.h | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 843bff3655..cdfc6367e5 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -438,7 +438,6 @@ set(NO_SINGLE_CHECK_HEADERS memline_defs.h menu.h misc2.h - move.h msgpack_rpc/server.h ops.h option.h diff --git a/src/nvim/move.h b/src/nvim/move.h index 3f3bf70929..1cdf1f6f52 100644 --- a/src/nvim/move.h +++ b/src/nvim/move.h @@ -2,6 +2,8 @@ #define NVIM_MOVE_H #include +#include "nvim/buffer_defs.h" // for win_T +#include "nvim/pos.h" // for linenr_T #ifdef INCLUDE_GENERATED_DECLARATIONS # include "move.h.generated.h" -- cgit From 89deb6ff223ffef5c1e93e629b4df2cf666d9cd1 Mon Sep 17 00:00:00 2001 From: dedmass Date: Thu, 6 Apr 2017 17:16:56 -0400 Subject: refactor/single-include: memline_defs.h #6465 --- src/nvim/CMakeLists.txt | 1 - src/nvim/memfile_defs.h | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index cdfc6367e5..4d83e9b1ea 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -435,7 +435,6 @@ set(NO_SINGLE_CHECK_HEADERS mbyte.h memfile_defs.h memline.h - memline_defs.h menu.h misc2.h msgpack_rpc/server.h diff --git a/src/nvim/memfile_defs.h b/src/nvim/memfile_defs.h index cc71e1a7ff..57d8abbe30 100644 --- a/src/nvim/memfile_defs.h +++ b/src/nvim/memfile_defs.h @@ -3,8 +3,10 @@ #include #include +#include // for size_t #include "nvim/types.h" +#include "nvim/pos.h" // for linenr_T /// A block number. /// -- cgit From fd69c3f561ea8862ce4b1ff67a5650acaf5f932d Mon Sep 17 00:00:00 2001 From: dedmass Date: Thu, 6 Apr 2017 09:22:44 -0400 Subject: refactor/single-include: ex_getln.h #6454 --- src/nvim/CMakeLists.txt | 1 - src/nvim/ex_getln.h | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 4d83e9b1ea..3d3d30081a 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -424,7 +424,6 @@ function(get_test_target prefix sfile relative_path_var target_var) endfunction() set(NO_SINGLE_CHECK_HEADERS - ex_getln.h file_search.h fold.h getchar.h diff --git a/src/nvim/ex_getln.h b/src/nvim/ex_getln.h index 5a1ca5213a..a29c8297d5 100644 --- a/src/nvim/ex_getln.h +++ b/src/nvim/ex_getln.h @@ -3,6 +3,9 @@ #include "nvim/eval/typval.h" #include "nvim/ex_cmds.h" +#include "nvim/ex_cmds_defs.h" // for exarg_T +#include "nvim/os/time.h" // for Timestamp +#include "nvim/regexp_defs.h" // for regmatch_T /* Values for nextwild() and ExpandOne(). See ExpandOne() for meaning. */ #define WILD_FREE 1 -- cgit From 3fd9b70c485c55adb95848aa0e2c67bfb3db786a Mon Sep 17 00:00:00 2001 From: dedmass Date: Thu, 6 Apr 2017 09:40:17 -0400 Subject: refactor/single-include: fold.h #6456 --- src/nvim/CMakeLists.txt | 1 - src/nvim/fold.h | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 3d3d30081a..24a6ec8b5e 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -425,7 +425,6 @@ endfunction() set(NO_SINGLE_CHECK_HEADERS file_search.h - fold.h getchar.h hardcopy.h if_cscope.h diff --git a/src/nvim/fold.h b/src/nvim/fold.h index 2ff10c0e91..2393f4ef47 100644 --- a/src/nvim/fold.h +++ b/src/nvim/fold.h @@ -1,7 +1,12 @@ #ifndef NVIM_FOLD_H #define NVIM_FOLD_H +#include // for FILE + #include "nvim/pos.h" +#include "nvim/garray.h" // for garray_T +#include "nvim/types.h" // for char_u +#include "nvim/buffer_defs.h" // for win_T /* * Info used to pass info about a fold from the fold-detection code to the -- cgit From e586047a53d4145db9c797af7f42c71c35143896 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 8 Apr 2017 17:15:56 +0300 Subject: eval/decode,shada: Do not forget to clean up converters --- src/nvim/eval/decode.c | 1 + src/nvim/shada.c | 2 ++ 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/nvim/eval/decode.c b/src/nvim/eval/decode.c index fb31a65971..a4fc6c8eb1 100644 --- a/src/nvim/eval/decode.c +++ b/src/nvim/eval/decode.c @@ -892,6 +892,7 @@ json_decode_string_fail: tv_clear(&(kv_pop(stack).val)); } json_decode_string_ret: + convert_setup(&conv, NULL, NULL); kv_destroy(stack); kv_destroy(container_stack); return ret; diff --git a/src/nvim/shada.c b/src/nvim/shada.c index c7b95958e0..9ee364d962 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -709,6 +709,7 @@ static ptrdiff_t write_file(ShaDaWriteDef *const sd_writer, static void close_sd_reader(ShaDaReadDef *const sd_reader) FUNC_ATTR_NONNULL_ALL { + convert_setup(&sd_reader->sd_conv, NULL, NULL); close_file(sd_reader->cookie); } @@ -716,6 +717,7 @@ static void close_sd_reader(ShaDaReadDef *const sd_reader) static void close_sd_writer(ShaDaWriteDef *const sd_writer) FUNC_ATTR_NONNULL_ALL { + convert_setup(&sd_writer->sd_conv, NULL, NULL); close_file(sd_writer->cookie); } -- cgit From b3587a456b4c235822006aae928667433ab85e66 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 8 Apr 2017 17:18:40 +0300 Subject: shada: Initialize vimconv_T --- src/nvim/shada.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/nvim/shada.c b/src/nvim/shada.c index 9ee364d962..3c4fd8b992 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -800,6 +800,7 @@ static int open_shada_file_for_reading(const char *const fname, .eof = false, .fpos = 0, .cookie = file_open_new(&error, fname, kFileReadOnly, 0), + .sd_conv.vc_type = CONV_NONE, }; if (sd_reader->cookie == NULL) { return error; @@ -2939,6 +2940,7 @@ int shada_write_file(const char *const file, bool nomerge) .write = &write_file, .close = &close_sd_writer, .error = NULL, + .sd_conv.vc_type = CONV_NONE, }; ShaDaReadDef sd_reader = { .close = NULL }; -- cgit From 6006cb74ef7c43b58e8c06e5ecaa5823247b970a Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 8 Apr 2017 17:36:02 +0300 Subject: eval/decode: Omit calling convert_setup for each string Uses the same trick eval/encode does. --- src/nvim/eval/decode.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/nvim/eval/decode.c b/src/nvim/eval/decode.c index a4fc6c8eb1..e8c06b2927 100644 --- a/src/nvim/eval/decode.c +++ b/src/nvim/eval/decode.c @@ -606,6 +606,17 @@ parse_json_number_ret: } \ } while (0) +/// Last used p_enc value +/// +/// Generic pointer: it is not used as a string, only pointer comparisons are +/// performed. Must not be freed. +static const void *last_p_enc = NULL; + +/// Conversion setup for converting from UTF-8 to last_p_enc +static vimconv_T p_enc_conv = { + .vc_type = CONV_NONE, +}; + /// Convert JSON string into VimL object /// /// @param[in] buf String to convert. UTF-8 encoding is assumed. @@ -626,9 +637,12 @@ int json_decode_string(const char *const buf, const size_t buf_len, EMSG(_("E474: Attempt to decode a blank string")); return FAIL; } - vimconv_T conv = { .vc_type = CONV_NONE }; - convert_setup(&conv, (char_u *) "utf-8", p_enc); - conv.vc_fail = true; + if (last_p_enc != (const void *)p_enc) { + p_enc_conv.vc_type = CONV_NONE; + convert_setup(&p_enc_conv, (char_u *)"utf-8", p_enc); + p_enc_conv.vc_fail = true; + last_p_enc = p_enc; + } int ret = OK; ValuesStack stack = KV_INITIAL_VALUE; ContainerStack container_stack = KV_INITIAL_VALUE; @@ -774,9 +788,9 @@ json_decode_string_cycle_start: break; } case '"': { - if (parse_json_string(&conv, buf, buf_len, &p, &stack, &container_stack, - &next_map_special, &didcomma, &didcolon) - == FAIL) { + if (parse_json_string( + &p_enc_conv, buf, buf_len, &p, &stack, &container_stack, + &next_map_special, &didcomma, &didcolon) == FAIL) { // Error message was already given goto json_decode_string_fail; } @@ -892,7 +906,6 @@ json_decode_string_fail: tv_clear(&(kv_pop(stack).val)); } json_decode_string_ret: - convert_setup(&conv, NULL, NULL); kv_destroy(stack); kv_destroy(container_stack); return ret; -- cgit From e81469522371837615d2e2ffbd578ef44f883d2a Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 8 Apr 2017 18:03:56 +0300 Subject: eval/*code,shada: Drop support for converting UTF-8 from/to p_enc Not needed any longer since p_enc is always utf-8. --- src/nvim/eval/decode.c | 39 +-------- src/nvim/eval/encode.c | 56 +++--------- src/nvim/shada.c | 234 +++++++------------------------------------------ 3 files changed, 45 insertions(+), 284 deletions(-) (limited to 'src') diff --git a/src/nvim/eval/decode.c b/src/nvim/eval/decode.c index e8c06b2927..c7ca3a8ce5 100644 --- a/src/nvim/eval/decode.c +++ b/src/nvim/eval/decode.c @@ -222,8 +222,6 @@ static inline int json_decoder_pop(ValuesStackItem obj, /// Parse JSON double-quoted string /// -/// @param[in] conv Defines conversion necessary to convert UTF-8 string to -/// &encoding. /// @param[in] buf Buffer being converted. /// @param[in] buf_len Length of the buffer. /// @param[in,out] pp Pointer to the start of the string. Must point to '"'. @@ -240,8 +238,7 @@ static inline int json_decoder_pop(ValuesStackItem obj, /// value when decoder is restarted, otherwise unused. /// /// @return OK in case of success, FAIL in case of error. -static inline int parse_json_string(vimconv_T *const conv, - const char *const buf, const size_t buf_len, +static inline int parse_json_string(const char *const buf, const size_t buf_len, const char **const pp, ValuesStack *const stack, ContainerStack *const container_stack, @@ -416,20 +413,6 @@ static inline int parse_json_string(vimconv_T *const conv, } PUT_FST_IN_PAIR(fst_in_pair, str_end); #undef PUT_FST_IN_PAIR - if (conv->vc_type != CONV_NONE) { - size_t str_len = (size_t) (str_end - str); - char *const new_str = (char *) string_convert(conv, (char_u *) str, - &str_len); - if (new_str == NULL) { - emsgf(_("E474: Failed to convert string \"%.*s\" from UTF-8"), - (int) str_len, str); - xfree(str); - goto parse_json_string_fail; - } - xfree(str); - str = new_str; - str_end = new_str + str_len; - } if (hasnul) { typval_T obj; list_T *const list = tv_list_alloc(); @@ -606,17 +589,6 @@ parse_json_number_ret: } \ } while (0) -/// Last used p_enc value -/// -/// Generic pointer: it is not used as a string, only pointer comparisons are -/// performed. Must not be freed. -static const void *last_p_enc = NULL; - -/// Conversion setup for converting from UTF-8 to last_p_enc -static vimconv_T p_enc_conv = { - .vc_type = CONV_NONE, -}; - /// Convert JSON string into VimL object /// /// @param[in] buf String to convert. UTF-8 encoding is assumed. @@ -637,12 +609,7 @@ int json_decode_string(const char *const buf, const size_t buf_len, EMSG(_("E474: Attempt to decode a blank string")); return FAIL; } - if (last_p_enc != (const void *)p_enc) { - p_enc_conv.vc_type = CONV_NONE; - convert_setup(&p_enc_conv, (char_u *)"utf-8", p_enc); - p_enc_conv.vc_fail = true; - last_p_enc = p_enc; - } + assert(STRCMP(p_enc, "utf-8") == 0); int ret = OK; ValuesStack stack = KV_INITIAL_VALUE; ContainerStack container_stack = KV_INITIAL_VALUE; @@ -789,7 +756,7 @@ json_decode_string_cycle_start: } case '"': { if (parse_json_string( - &p_enc_conv, buf, buf_len, &p, &stack, &container_stack, + buf, buf_len, &p, &stack, &container_stack, &next_map_special, &didcomma, &didcolon) == FAIL) { // Error message was already given goto json_decode_string_fail; diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c index 26f9aaa27d..b64217f969 100644 --- a/src/nvim/eval/encode.c +++ b/src/nvim/eval/encode.c @@ -11,7 +11,7 @@ #include #include "nvim/eval/encode.h" -#include "nvim/buffer_defs.h" // vimconv_T +#include "nvim/buffer_defs.h" #include "nvim/eval.h" #include "nvim/eval/typval.h" #include "nvim/garray.h" @@ -29,10 +29,6 @@ #define utf_ptr2char(b) utf_ptr2char((char_u *)b) #define utf_ptr2len(b) ((size_t)utf_ptr2len((char_u *)b)) #define utf_char2len(b) ((size_t)utf_char2len(b)) -#define string_convert(a, b, c) \ - ((char *)string_convert((vimconv_T *)a, (char_u *)b, c)) -#define convert_setup(vcp, from, to) \ - (convert_setup(vcp, (char_u *)from, (char_u *)to)) const char *const encode_special_var_names[] = { [kSpecialVarNull] = "null", @@ -537,17 +533,6 @@ int encode_read_from_list(ListReaderState *const state, char *const buf, } \ } while (0) -/// Last used p_enc value -/// -/// Generic pointer: it is not used as a string, only pointer comparisons are -/// performed. Must not be freed. -static const void *last_p_enc = NULL; - -/// Conversion setup for converting from last_p_enc to UTF-8 -static vimconv_T p_enc_conv = { - .vc_type = CONV_NONE, -}; - /// Escape sequences used in JSON static const char escapes[][3] = { [BS] = "\\b", @@ -579,33 +564,16 @@ static inline int convert_to_json_string(garray_T *const gap, } else { size_t utf_len = len; char *tofree = NULL; - if (last_p_enc != (const void *) p_enc) { - p_enc_conv.vc_type = CONV_NONE; - convert_setup(&p_enc_conv, p_enc, "utf-8"); - p_enc_conv.vc_fail = true; - last_p_enc = p_enc; - } - if (p_enc_conv.vc_type != CONV_NONE) { - tofree = string_convert(&p_enc_conv, buf, &utf_len); - if (tofree == NULL) { - emsgf(_("E474: Failed to convert string \"%.*s\" to UTF-8"), - utf_len, utf_buf); - return FAIL; - } - utf_buf = tofree; - } + assert(STRCMP(p_enc, "utf-8") == 0); size_t str_len = 0; - // Encode character as \u0000 if - // 1. It is an ASCII control character (0x0 .. 0x1F, 0x7F). - // 2. &encoding is not UTF-8 and code point is above 0x7F. - // 3. &encoding is UTF-8 and code point is not printable according to - // utf_printable(). - // This is done to make it possible to :echo values when &encoding is not - // UTF-8. -#define ENCODE_RAW(p_enc_conv, ch) \ - (ch >= 0x20 && (p_enc_conv.vc_type == CONV_NONE \ - ? utf_printable(ch) \ - : ch < 0x7F)) + // Encode character as \uNNNN if + // 1. It is an ASCII control character (0x0 .. 0x1F; 0x7F not + // utf_printable and thus not checked specially). + // 2. Code point is not printable according to utf_printable(). + // This is done to make resulting values displayable on screen also not from + // Neovim. +#define ENCODE_RAW(ch) \ + (ch >= 0x20 && utf_printable(ch)) for (size_t i = 0; i < utf_len;) { const int ch = utf_ptr2char(utf_buf + i); const size_t shift = (ch == 0? 1: utf_ptr2len(utf_buf + i)); @@ -636,7 +604,7 @@ static inline int convert_to_json_string(garray_T *const gap, utf_len - (i - shift), utf_buf + i - shift); xfree(tofree); return FAIL; - } else if (ENCODE_RAW(p_enc_conv, ch)) { + } else if (ENCODE_RAW(ch)) { str_len += shift; } else { str_len += ((sizeof("\\u1234") - 1) @@ -666,7 +634,7 @@ static inline int convert_to_json_string(garray_T *const gap, break; } default: { - if (ENCODE_RAW(p_enc_conv, ch)) { + if (ENCODE_RAW(ch)) { ga_concat_len(gap, utf_buf + i, shift); } else if (ch < SURROGATE_FIRST_CHAR) { ga_concat_len(gap, ((const char[]) { diff --git a/src/nvim/shada.c b/src/nvim/shada.c index 3c4fd8b992..cfe0bd8774 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -73,15 +73,10 @@ KHASH_SET_INIT_STR(strset) (vim_rename((char_u *)a, (char_u *)b)) #define mb_strnicmp(a, b, c) \ (mb_strnicmp((char_u *)a, (char_u *)b, c)) -#define has_non_ascii(a) (has_non_ascii((char_u *)a)) -#define string_convert(a, b, c) \ - ((char *)string_convert((vimconv_T *)a, (char_u *)b, c)) #define path_shorten_fname_if_possible(b) \ ((char *)path_shorten_fname_if_possible((char_u *)b)) #define buflist_new(ffname, sfname, ...) \ (buflist_new((char_u *)ffname, (char_u *)sfname, __VA_ARGS__)) -#define convert_setup(vcp, from, to) \ - (convert_setup(vcp, (char_u *)from, (char_u *)to)) #define os_isdir(f) (os_isdir((char_u *) f)) #define regtilde(s, m) ((char *) regtilde((char_u *) s, m)) #define path_tail_with_sep(f) ((char *) path_tail_with_sep((char_u *)f)) @@ -413,8 +408,6 @@ typedef struct sd_read_def { const char *error; ///< Error message in case of error. uintmax_t fpos; ///< Current position (amount of bytes read since ///< reader structure initialization). May overflow. - vimconv_T sd_conv; ///< Structure used for converting encodings of some - ///< items. } ShaDaReadDef; struct sd_write_def; @@ -435,8 +428,6 @@ typedef struct sd_write_def { ShaDaWriteCloser close; ///< Close function. void *cookie; ///< Data describing object written to. const char *error; ///< Error message in case of error. - vimconv_T sd_conv; ///< Structure used for converting encodings of some - ///< items. } ShaDaWriteDef; #ifdef INCLUDE_GENERATED_DECLARATIONS @@ -709,7 +700,6 @@ static ptrdiff_t write_file(ShaDaWriteDef *const sd_writer, static void close_sd_reader(ShaDaReadDef *const sd_reader) FUNC_ATTR_NONNULL_ALL { - convert_setup(&sd_reader->sd_conv, NULL, NULL); close_file(sd_reader->cookie); } @@ -717,7 +707,6 @@ static void close_sd_reader(ShaDaReadDef *const sd_reader) static void close_sd_writer(ShaDaWriteDef *const sd_writer) FUNC_ATTR_NONNULL_ALL { - convert_setup(&sd_writer->sd_conv, NULL, NULL); close_file(sd_writer->cookie); } @@ -800,13 +789,12 @@ static int open_shada_file_for_reading(const char *const fname, .eof = false, .fpos = 0, .cookie = file_open_new(&error, fname, kFileReadOnly, 0), - .sd_conv.vc_type = CONV_NONE, }; if (sd_reader->cookie == NULL) { return error; } - convert_setup(&sd_reader->sd_conv, "utf-8", p_enc); + assert(STRCMP(p_enc, "utf-8") == 0); return 0; } @@ -1902,127 +1890,24 @@ shada_pack_entry_error: } #undef PACK_STRING -/// Write single ShaDa entry, converting it if needed +/// Write single ShaDa entry and free it afterwards /// -/// @warning Frees entry after packing. +/// Will not free if entry could not be freed. /// /// @param[in] packer Packer used to write entry. -/// @param[in] sd_conv Conversion definitions. -/// @param[in] entry Entry written. If entry.can_free_entry is false then -/// it assumes that entry was not converted, otherwise it -/// is assumed that entry was already converted. +/// @param[in] entry Entry written. /// @param[in] max_kbyte Maximum size of an item in KiB. Zero means no /// restrictions. -static ShaDaWriteResult shada_pack_encoded_entry(msgpack_packer *const packer, - const vimconv_T *const sd_conv, - PossiblyFreedShadaEntry entry, - const size_t max_kbyte) - FUNC_ATTR_NONNULL_ALL +static inline ShaDaWriteResult shada_pack_pfreed_entry( + msgpack_packer *const packer, PossiblyFreedShadaEntry entry, + const size_t max_kbyte) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_ALWAYS_INLINE { ShaDaWriteResult ret = kSDWriteSuccessfull; + ret = shada_pack_entry(packer, entry.data, max_kbyte); if (entry.can_free_entry) { - ret = shada_pack_entry(packer, entry.data, max_kbyte); shada_free_shada_entry(&entry.data); - return ret; } -#define RUN_WITH_CONVERTED_STRING(cstr, code) \ - do { \ - bool did_convert = false; \ - if (sd_conv->vc_type != CONV_NONE && has_non_ascii((cstr))) { \ - char *const converted_string = string_convert(sd_conv, (cstr), NULL); \ - if (converted_string != NULL) { \ - (cstr) = converted_string; \ - did_convert = true; \ - } \ - } \ - code \ - if (did_convert) { \ - xfree((cstr)); \ - } \ - } while (0) - switch (entry.data.type) { - case kSDItemUnknown: - case kSDItemMissing: { - assert(false); - } - case kSDItemSearchPattern: { - RUN_WITH_CONVERTED_STRING(entry.data.data.search_pattern.pat, { - ret = shada_pack_entry(packer, entry.data, max_kbyte); - }); - break; - } - case kSDItemHistoryEntry: { - RUN_WITH_CONVERTED_STRING(entry.data.data.history_item.string, { - ret = shada_pack_entry(packer, entry.data, max_kbyte); - }); - break; - } - case kSDItemSubString: { - RUN_WITH_CONVERTED_STRING(entry.data.data.sub_string.sub, { - ret = shada_pack_entry(packer, entry.data, max_kbyte); - }); - break; - } - case kSDItemVariable: { - if (sd_conv->vc_type != CONV_NONE) { - typval_T tgttv; - var_item_copy(sd_conv, &entry.data.data.global_var.value, &tgttv, - true, 0); - tv_clear(&entry.data.data.global_var.value); - entry.data.data.global_var.value = tgttv; - } - ret = shada_pack_entry(packer, entry.data, max_kbyte); - break; - } - case kSDItemRegister: { - bool did_convert = false; - if (sd_conv->vc_type != CONV_NONE) { - size_t first_non_ascii = 0; - for (size_t i = 0; i < entry.data.data.reg.contents_size; i++) { - if (has_non_ascii(entry.data.data.reg.contents[i])) { - first_non_ascii = i; - did_convert = true; - break; - } - } - if (did_convert) { - entry.data.data.reg.contents = - xmemdup(entry.data.data.reg.contents, - (entry.data.data.reg.contents_size - * sizeof(entry.data.data.reg.contents[0]))); - for (size_t i = 0; i < entry.data.data.reg.contents_size; i++) { - if (i >= first_non_ascii) { - entry.data.data.reg.contents[i] = get_converted_string( - sd_conv, - entry.data.data.reg.contents[i], - strlen(entry.data.data.reg.contents[i])); - } else { - entry.data.data.reg.contents[i] = - xstrdup(entry.data.data.reg.contents[i]); - } - } - } - } - ret = shada_pack_entry(packer, entry.data, max_kbyte); - if (did_convert) { - for (size_t i = 0; i < entry.data.data.reg.contents_size; i++) { - xfree(entry.data.data.reg.contents[i]); - } - xfree(entry.data.data.reg.contents); - } - break; - } - case kSDItemHeader: - case kSDItemGlobalMark: - case kSDItemJump: - case kSDItemBufferList: - case kSDItemLocalMark: - case kSDItemChange: { - ret = shada_pack_entry(packer, entry.data, max_kbyte); - break; - } - } -#undef RUN_WITH_CONVERTED_STRING return ret; } @@ -2559,11 +2444,7 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, break; } typval_T tgttv; - if (sd_writer->sd_conv.vc_type != CONV_NONE) { - var_item_copy(&sd_writer->sd_conv, &vartv, &tgttv, true, 0); - } else { - tv_copy(&vartv, &tgttv); - } + tv_copy(&vartv, &tgttv); ShaDaWriteResult spe_ret; if ((spe_ret = shada_pack_entry(packer, (ShadaEntry) { .type = kSDItemVariable, @@ -2814,9 +2695,8 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, do { \ for (size_t i_ = 0; i_ < ARRAY_SIZE(wms_array); i_++) { \ if (wms_array[i_].data.type != kSDItemMissing) { \ - if (shada_pack_encoded_entry(packer, &sd_writer->sd_conv, \ - wms_array[i_], \ - max_kbyte) == kSDWriteFailed) { \ + if (shada_pack_pfreed_entry(packer, wms_array[i_], max_kbyte) \ + == kSDWriteFailed) { \ ret = kSDWriteFailed; \ goto shada_write_exit; \ } \ @@ -2826,8 +2706,8 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, PACK_WMS_ARRAY(wms->global_marks); PACK_WMS_ARRAY(wms->registers); for (size_t i = 0; i < wms->jumps_size; i++) { - if (shada_pack_encoded_entry(packer, &sd_writer->sd_conv, wms->jumps[i], - max_kbyte) == kSDWriteFailed) { + if (shada_pack_pfreed_entry(packer, wms->jumps[i], max_kbyte) + == kSDWriteFailed) { ret = kSDWriteFailed; goto shada_write_exit; } @@ -2835,8 +2715,8 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, #define PACK_WMS_ENTRY(wms_entry) \ do { \ if (wms_entry.data.type != kSDItemMissing) { \ - if (shada_pack_encoded_entry(packer, &sd_writer->sd_conv, wms_entry, \ - max_kbyte) == kSDWriteFailed) { \ + if (shada_pack_pfreed_entry(packer, wms_entry, max_kbyte) \ + == kSDWriteFailed) { \ ret = kSDWriteFailed; \ goto shada_write_exit; \ } \ @@ -2863,9 +2743,8 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, for (size_t i = 0; i < file_markss_to_dump; i++) { PACK_WMS_ARRAY(all_file_markss[i]->marks); for (size_t j = 0; j < all_file_markss[i]->changes_size; j++) { - if (shada_pack_encoded_entry(packer, &sd_writer->sd_conv, - all_file_markss[i]->changes[j], - max_kbyte) == kSDWriteFailed) { + if (shada_pack_pfreed_entry(packer, all_file_markss[i]->changes[j], + max_kbyte) == kSDWriteFailed) { ret = kSDWriteFailed; goto shada_write_exit; } @@ -2889,8 +2768,8 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, if (dump_one_history[i]) { hms_insert_whole_neovim_history(&wms->hms[i]); HMS_ITER(&wms->hms[i], cur_entry, { - if (shada_pack_encoded_entry( - packer, &sd_writer->sd_conv, (PossiblyFreedShadaEntry) { + if (shada_pack_pfreed_entry( + packer, (PossiblyFreedShadaEntry) { .data = cur_entry->data, .can_free_entry = cur_entry->can_free_entry, }, max_kbyte) == kSDWriteFailed) { @@ -2940,7 +2819,6 @@ int shada_write_file(const char *const file, bool nomerge) .write = &write_file, .close = &close_sd_writer, .error = NULL, - .sd_conv.vc_type = CONV_NONE, }; ShaDaReadDef sd_reader = { .close = NULL }; @@ -3042,7 +2920,7 @@ shada_write_file_nomerge: {} verbose_leave(); } - convert_setup(&sd_writer.sd_conv, p_enc, "utf-8"); + assert(STRCMP(p_enc, "utf-8") == 0); const ShaDaWriteResult sw_ret = shada_write(&sd_writer, (nomerge ? NULL @@ -3331,29 +3209,6 @@ static ShaDaReadResult msgpack_read_uint64(ShaDaReadDef *const sd_reader, return kSDReadStatusSuccess; } -/// Convert or copy and return a string -/// -/// @param[in] sd_conv Conversion definition. -/// @param[in] str String to convert. -/// @param[in] len String length. -/// -/// @return [allocated] converted string or copy of the original string. -static inline char *get_converted_string(const vimconv_T *const sd_conv, - const char *const str, - const size_t len) - FUNC_ATTR_NONNULL_ALL FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT -{ - if (!has_non_ascii_len(str, len)) { - return xmemdupz(str, len); - } - size_t new_len = len; - char *const new_str = string_convert(sd_conv, str, &new_len); - if (new_str == NULL) { - return xmemdupz(str, len); - } - return new_str; -} - #define READERR(entry_name, error_desc) \ RERR "Error while reading ShaDa file: " \ entry_name " entry at position %" PRIu64 " " \ @@ -3431,10 +3286,7 @@ static inline char *get_converted_string(const vimconv_T *const sd_conv, sizeof(*unpacked.data.via.map.ptr)); \ ad_ga.ga_len++; \ } -#define CONVERTED(str, len) ( \ - sd_reader->sd_conv.vc_type != CONV_NONE \ - ? get_converted_string(&sd_reader->sd_conv, (str), (len)) \ - : xmemdupz((str), (len))) +#define CONVERTED(str, len) (xmemdupz((str), (len))) #define BIN_CONVERTED(b) CONVERTED(b.ptr, b.size) #define SET_ADDITIONAL_DATA(tgt, name) \ do { \ @@ -3807,30 +3659,14 @@ shada_read_next_item_start: (char) unpacked.data.via.array.ptr[2].via.u64; } size_t strsize; - if (sd_reader->sd_conv.vc_type == CONV_NONE - || !has_non_ascii_len(unpacked.data.via.array.ptr[1].via.bin.ptr, - unpacked.data.via.array.ptr[1].via.bin.size)) { -shada_read_next_item_hist_no_conv: - strsize = ( - unpacked.data.via.array.ptr[1].via.bin.size - + 1 // Zero byte - + 1); // Separator character - entry->data.history_item.string = xmalloc(strsize); - memcpy(entry->data.history_item.string, - unpacked.data.via.array.ptr[1].via.bin.ptr, - unpacked.data.via.array.ptr[1].via.bin.size); - } else { - size_t len = unpacked.data.via.array.ptr[1].via.bin.size; - char *const converted = string_convert( - &sd_reader->sd_conv, unpacked.data.via.array.ptr[1].via.bin.ptr, - &len); - if (converted != NULL) { - strsize = len + 2; - entry->data.history_item.string = xrealloc(converted, strsize); - } else { - goto shada_read_next_item_hist_no_conv; - } - } + strsize = ( + unpacked.data.via.array.ptr[1].via.bin.size + + 1 // Zero byte + + 1); // Separator character + entry->data.history_item.string = xmalloc(strsize); + memcpy(entry->data.history_item.string, + unpacked.data.via.array.ptr[1].via.bin.ptr, + unpacked.data.via.array.ptr[1].via.bin.size); entry->data.history_item.string[strsize - 2] = 0; entry->data.history_item.string[strsize - 1] = entry->data.history_item.sep; @@ -3863,16 +3699,6 @@ shada_read_next_item_hist_no_conv: "be converted to the VimL value")), initial_fpos); goto shada_read_next_item_error; } - if (sd_reader->sd_conv.vc_type != CONV_NONE) { - typval_T tgttv; - var_item_copy(&sd_reader->sd_conv, - &entry->data.global_var.value, - &tgttv, - true, - 0); - tv_clear(&entry->data.global_var.value); - entry->data.global_var.value = tgttv; - } SET_ADDITIONAL_ELEMENTS(unpacked.data.via.array, 2, entry->data.global_var.additional_elements, "variable"); -- cgit From ab19fa155203a4071cb8e780db7d3480b562aee0 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 8 Apr 2017 19:11:42 +0300 Subject: *: Fix linter errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drops comments `// for …` that do not pass linter for them being unmaintainable and fast to becoming incomplete or even incorrect. Mention @dedmass --- src/nvim/digraph.h | 4 ++-- src/nvim/eval/decode.c | 6 +++--- src/nvim/ex_cmds.h | 4 ++-- src/nvim/ex_getln.h | 6 +++--- src/nvim/fold.h | 8 ++++---- src/nvim/memfile_defs.h | 4 ++-- src/nvim/move.h | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/nvim/digraph.h b/src/nvim/digraph.h index d0f10eaf78..1b73ccaf3f 100644 --- a/src/nvim/digraph.h +++ b/src/nvim/digraph.h @@ -1,8 +1,8 @@ #ifndef NVIM_DIGRAPH_H #define NVIM_DIGRAPH_H -#include "nvim/types.h" // for char_u -#include "nvim/ex_cmds_defs.h" // for exarg_T +#include "nvim/types.h" +#include "nvim/ex_cmds_defs.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "digraph.h.generated.h" diff --git a/src/nvim/eval/decode.c b/src/nvim/eval/decode.c index c7ca3a8ce5..f9889ca547 100644 --- a/src/nvim/eval/decode.c +++ b/src/nvim/eval/decode.c @@ -755,9 +755,9 @@ json_decode_string_cycle_start: break; } case '"': { - if (parse_json_string( - buf, buf_len, &p, &stack, &container_stack, - &next_map_special, &didcomma, &didcolon) == FAIL) { + if (parse_json_string(buf, buf_len, &p, &stack, &container_stack, + &next_map_special, &didcomma, &didcolon) + == FAIL) { // Error message was already given goto json_decode_string_fail; } diff --git a/src/nvim/ex_cmds.h b/src/nvim/ex_cmds.h index 792e2f772f..b564cde56c 100644 --- a/src/nvim/ex_cmds.h +++ b/src/nvim/ex_cmds.h @@ -6,8 +6,8 @@ #include "nvim/os/time.h" #include "nvim/pos.h" #include "nvim/eval/typval.h" -#include "nvim/buffer_defs.h" // for buf_T and win_T -#include "nvim/ex_cmds_defs.h" // for exarg_T +#include "nvim/buffer_defs.h" +#include "nvim/ex_cmds_defs.h" // flags for do_ecmd() #define ECMD_HIDE 0x01 // don't free the current buffer diff --git a/src/nvim/ex_getln.h b/src/nvim/ex_getln.h index a29c8297d5..051564fbe1 100644 --- a/src/nvim/ex_getln.h +++ b/src/nvim/ex_getln.h @@ -3,9 +3,9 @@ #include "nvim/eval/typval.h" #include "nvim/ex_cmds.h" -#include "nvim/ex_cmds_defs.h" // for exarg_T -#include "nvim/os/time.h" // for Timestamp -#include "nvim/regexp_defs.h" // for regmatch_T +#include "nvim/ex_cmds_defs.h" +#include "nvim/os/time.h" +#include "nvim/regexp_defs.h" /* Values for nextwild() and ExpandOne(). See ExpandOne() for meaning. */ #define WILD_FREE 1 diff --git a/src/nvim/fold.h b/src/nvim/fold.h index 2393f4ef47..f35b328fb1 100644 --- a/src/nvim/fold.h +++ b/src/nvim/fold.h @@ -1,12 +1,12 @@ #ifndef NVIM_FOLD_H #define NVIM_FOLD_H -#include // for FILE +#include #include "nvim/pos.h" -#include "nvim/garray.h" // for garray_T -#include "nvim/types.h" // for char_u -#include "nvim/buffer_defs.h" // for win_T +#include "nvim/garray.h" +#include "nvim/types.h" +#include "nvim/buffer_defs.h" /* * Info used to pass info about a fold from the fold-detection code to the diff --git a/src/nvim/memfile_defs.h b/src/nvim/memfile_defs.h index 57d8abbe30..b3c2f3564c 100644 --- a/src/nvim/memfile_defs.h +++ b/src/nvim/memfile_defs.h @@ -3,10 +3,10 @@ #include #include -#include // for size_t +#include #include "nvim/types.h" -#include "nvim/pos.h" // for linenr_T +#include "nvim/pos.h" /// A block number. /// diff --git a/src/nvim/move.h b/src/nvim/move.h index 1cdf1f6f52..00fbcc580f 100644 --- a/src/nvim/move.h +++ b/src/nvim/move.h @@ -2,8 +2,8 @@ #define NVIM_MOVE_H #include -#include "nvim/buffer_defs.h" // for win_T -#include "nvim/pos.h" // for linenr_T +#include "nvim/buffer_defs.h" +#include "nvim/pos.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "move.h.generated.h" -- cgit From cd0a436622d0eeafcbc79e0a6e53088b881ab5b1 Mon Sep 17 00:00:00 2001 From: dedmass Date: Thu, 6 Apr 2017 17:06:35 -0400 Subject: refactor/single-include Closes #6463 refactor/single-include: file_search.h Closes #6455 refactor/single-include: hardcopy.h Closes #6457 refactor/single-include: if_cscope.h Closes #6458 refactor/single-include: mark.h Closes #6461 refactor/single-include: mbyte.h Closes #6462 refactor/single-include: memline.h Closes #6464 refactor/single-include: menu.h Closes #6468 refactor/single-include: ops.h Closes #6470 --- src/nvim/CMakeLists.txt | 9 --------- src/nvim/file_search.h | 5 +++++ src/nvim/hardcopy.h | 4 ++++ src/nvim/if_cscope.h | 3 +++ src/nvim/mark.h | 1 + src/nvim/mbyte.h | 1 + src/nvim/memline.h | 2 ++ src/nvim/menu.h | 5 +++++ src/nvim/ops.h | 2 ++ 9 files changed, 23 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 24a6ec8b5e..e0f4944762 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -424,19 +424,10 @@ function(get_test_target prefix sfile relative_path_var target_var) endfunction() set(NO_SINGLE_CHECK_HEADERS - file_search.h getchar.h - hardcopy.h - if_cscope.h if_cscope_defs.h - mark.h - mbyte.h - memfile_defs.h - memline.h - menu.h misc2.h msgpack_rpc/server.h - ops.h option.h os/shell.h os_unix.h diff --git a/src/nvim/file_search.h b/src/nvim/file_search.h index 833a1a05ff..b128029123 100644 --- a/src/nvim/file_search.h +++ b/src/nvim/file_search.h @@ -1,6 +1,11 @@ #ifndef NVIM_FILE_SEARCH_H #define NVIM_FILE_SEARCH_H +#include // for size_t + +#include "nvim/types.h" // for char_u +#include "nvim/globals.h" // for CdScope + /* Flags for find_file_*() functions. */ #define FINDFILE_FILE 0 /* only files */ #define FINDFILE_DIR 1 /* only directories */ diff --git a/src/nvim/hardcopy.h b/src/nvim/hardcopy.h index 4ead8dd5d4..a70b20e6f5 100644 --- a/src/nvim/hardcopy.h +++ b/src/nvim/hardcopy.h @@ -2,6 +2,10 @@ #define NVIM_HARDCOPY_H #include +#include // for size_t + +#include "nvim/types.h" // for char_u +#include "nvim/ex_cmds_defs.h" // for exarg_T /* * Structure to hold printing color and font attributes. diff --git a/src/nvim/if_cscope.h b/src/nvim/if_cscope.h index 351d9caef6..e20462576a 100644 --- a/src/nvim/if_cscope.h +++ b/src/nvim/if_cscope.h @@ -1,6 +1,9 @@ #ifndef NVIM_IF_CSCOPE_H #define NVIM_IF_CSCOPE_H +#include "nvim/types.h" // for char_u and expand_T +#include "nvim/ex_cmds_defs.h" // for exarg_T + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "if_cscope.h.generated.h" #endif diff --git a/src/nvim/mark.h b/src/nvim/mark.h index efba9708db..c22a102926 100644 --- a/src/nvim/mark.h +++ b/src/nvim/mark.h @@ -8,6 +8,7 @@ #include "nvim/memory.h" #include "nvim/pos.h" #include "nvim/os/time.h" +#include "nvim/ex_cmds_defs.h" // for exarg_T /// Set fmark using given value #define SET_FMARK(fmarkp_, mark_, fnum_) \ diff --git a/src/nvim/mbyte.h b/src/nvim/mbyte.h index 3565202466..ad9e38004c 100644 --- a/src/nvim/mbyte.h +++ b/src/nvim/mbyte.h @@ -7,6 +7,7 @@ #include "nvim/iconv.h" #include "nvim/func_attr.h" #include "nvim/os/os_defs.h" // For WCHAR, indirect +#include "nvim/types.h" // for char_u /* * Return byte length of character that starts with byte "b". diff --git a/src/nvim/memline.h b/src/nvim/memline.h index f84e86fea0..a239c6a031 100644 --- a/src/nvim/memline.h +++ b/src/nvim/memline.h @@ -2,6 +2,8 @@ #define NVIM_MEMLINE_H #include "nvim/types.h" +#include "nvim/pos.h" // for pos_T, linenr_T, colnr_T +#include "nvim/buffer_defs.h" // for buf_T #ifdef INCLUDE_GENERATED_DECLARATIONS # include "memline.h.generated.h" diff --git a/src/nvim/menu.h b/src/nvim/menu.h index 3266c511b4..a84b7d812e 100644 --- a/src/nvim/menu.h +++ b/src/nvim/menu.h @@ -1,6 +1,11 @@ #ifndef NVIM_MENU_H #define NVIM_MENU_H +#include // for bool + +#include "nvim/types.h" // for char_u and expand_T +#include "nvim/ex_cmds_defs.h" // for exarg_T + /* Indices into vimmenu_T->strings[] and vimmenu_T->noremap[] for each mode */ #define MENU_INDEX_INVALID -1 #define MENU_INDEX_NORMAL 0 diff --git a/src/nvim/ops.h b/src/nvim/ops.h index 13d0142343..a8867e02ea 100644 --- a/src/nvim/ops.h +++ b/src/nvim/ops.h @@ -8,6 +8,8 @@ #include "nvim/types.h" #include "nvim/eval/typval.h" #include "nvim/os/time.h" +#include "nvim/normal.h" // for MotionType and oparg_T +#include "nvim/ex_cmds_defs.h" // for exarg_T typedef int (*Indenter)(void); -- cgit From 7701014b659d3505c6d4f0de95c06042155c98d1 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 8 Apr 2017 20:22:46 +0300 Subject: *: Remove useless asserts --- src/nvim/eval/decode.c | 1 - src/nvim/eval/encode.c | 1 - src/nvim/shada.c | 2 -- 3 files changed, 4 deletions(-) (limited to 'src') diff --git a/src/nvim/eval/decode.c b/src/nvim/eval/decode.c index f9889ca547..a7dc6b205d 100644 --- a/src/nvim/eval/decode.c +++ b/src/nvim/eval/decode.c @@ -609,7 +609,6 @@ int json_decode_string(const char *const buf, const size_t buf_len, EMSG(_("E474: Attempt to decode a blank string")); return FAIL; } - assert(STRCMP(p_enc, "utf-8") == 0); int ret = OK; ValuesStack stack = KV_INITIAL_VALUE; ContainerStack container_stack = KV_INITIAL_VALUE; diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c index b64217f969..d74913a481 100644 --- a/src/nvim/eval/encode.c +++ b/src/nvim/eval/encode.c @@ -564,7 +564,6 @@ static inline int convert_to_json_string(garray_T *const gap, } else { size_t utf_len = len; char *tofree = NULL; - assert(STRCMP(p_enc, "utf-8") == 0); size_t str_len = 0; // Encode character as \uNNNN if // 1. It is an ASCII control character (0x0 .. 0x1F; 0x7F not diff --git a/src/nvim/shada.c b/src/nvim/shada.c index cfe0bd8774..8c5d6dff65 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -2920,8 +2920,6 @@ shada_write_file_nomerge: {} verbose_leave(); } - assert(STRCMP(p_enc, "utf-8") == 0); - const ShaDaWriteResult sw_ret = shada_write(&sd_writer, (nomerge ? NULL : &sd_reader)); -- cgit From 0f4b4c7529d6699bcae5c943a4bc27827c9aa8d6 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 8 Apr 2017 18:23:02 +0300 Subject: headers: Remove useless HAVE_CONFIG_H macros We do not have non-cmake build options, cmake always does configure_file. --- src/nvim/iconv.h | 4 +--- src/nvim/vim.h | 10 ++++------ 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/nvim/iconv.h b/src/nvim/iconv.h index bf29b15247..d7234090c4 100644 --- a/src/nvim/iconv.h +++ b/src/nvim/iconv.h @@ -10,9 +10,7 @@ // USE_ICONV, or to put the USE_ICONV definition in config.h.in directly. As // it stands, globals.h needs to be included alongside iconv.h. -#ifdef HAVE_CONFIG_H -# include "auto/config.h" -#endif +#include "auto/config.h" // Use iconv() when it's available, either by linking to the library at // compile time or by loading it at runtime. diff --git a/src/nvim/vim.h b/src/nvim/vim.h index cc0587fb88..d92115ecdf 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -13,18 +13,16 @@ /* ============ the header file puzzle (ca. 50-100 pieces) ========= */ -#ifdef HAVE_CONFIG_H /* GNU autoconf (or something else) was here */ -# include "auto/config.h" -# define HAVE_PATHDEF +#include "auto/config.h" +#define HAVE_PATHDEF /* * Check if configure correctly managed to find sizeof(int). If this failed, * it becomes zero. This is likely a problem of not being able to run the * test program. Other items from configure may also be wrong then! */ -# if (SIZEOF_INT == 0) -Error: configure did not run properly.Check auto/config.log. -# endif +#if (SIZEOF_INT == 0) +# error Configure did not run properly. #endif #include "nvim/os/os_defs.h" /* bring lots of system header files */ -- cgit From 8e519a22ddcad6a38d966a7c340c9fd77d72f392 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 8 Apr 2017 18:51:29 +0300 Subject: vim.h: Remove strange comments --- src/nvim/vim.h | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src') diff --git a/src/nvim/vim.h b/src/nvim/vim.h index d92115ecdf..172e62b039 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -11,8 +11,6 @@ #define RUNTIME_DIRNAME "runtime" /* end */ -/* ============ the header file puzzle (ca. 50-100 pieces) ========= */ - #include "auto/config.h" #define HAVE_PATHDEF @@ -44,11 +42,6 @@ enum { NUMBUFLEN = 65 }; #include "nvim/keymap.h" #include "nvim/macros.h" - - - -/* ================ end of the header file puzzle =============== */ - #include "nvim/gettext.h" /* special attribute addition: Put message in history */ -- cgit From 3a6b8c28c813f8e65851c8e89c7cf56b4d6cf03f Mon Sep 17 00:00:00 2001 From: Nikolai Aleksandrovich Pavlov Date: Sun, 9 Apr 2017 04:28:48 +0300 Subject: cmake: Use archive instead of downloading *.json files (#6482) --- src/nvim/CMakeLists.txt | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index e0f4944762..1daa5dc3c4 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -41,7 +41,7 @@ set(LINT_SUPPRESS_URL "${LINT_SUPPRESS_URL_BASE}/errors.json") set(LINT_PRG ${PROJECT_SOURCE_DIR}/src/clint.py) set(DOWNLOAD_SCRIPT ${PROJECT_SOURCE_DIR}/cmake/Download.cmake) set(LINT_SUPPRESSES_ROOT ${PROJECT_BINARY_DIR}/errors) -set(LINT_SUPPRESSES_URL "https://raw.githubusercontent.com/neovim/doc/gh-pages/reports/clint/errors.tar.gz") +set(LINT_SUPPRESSES_URL "${LINT_SUPPRESS_URL_BASE}/errors.tar.gz") include_directories(${GENERATED_DIR}) include_directories(${CACHED_GENERATED_DIR}) @@ -486,6 +486,20 @@ function(add_download output url allow_failure) ) endfunction() +include(ExternalProject) +ExternalProject_Add( + clint-error-files + PREFIX "${LINT_SUPPRESSES_ROOT}" + URL "${LINT_SUPPRESSES_URL}" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + BUILD_IN_SOURCE 1 + INSTALL_COMMAND + "${CMAKE_COMMAND}" + -DTARGET=${LINT_SUPPRESSES_ROOT} + -P "${PROJECT_SOURCE_DIR}/cmake/InstallClintErrors.cmake" +) + add_download(${LINT_SUPPRESS_FILE} ${LINT_SUPPRESS_URL} off) set(LINT_NVIM_REL_SOURCES) @@ -494,14 +508,13 @@ foreach(sfile ${LINT_NVIM_SOURCES}) set(suppress_file ${LINT_SUPPRESSES_ROOT}/${suffix}.json) set(suppress_url "${LINT_SUPPRESS_URL_BASE}/${suffix}.json") set(rsfile src/nvim/${r}) - add_download(${suppress_file} ${suppress_url} on) set(touch_file "${TOUCHES_DIR}/ran-clint-${suffix}") add_custom_command( OUTPUT ${touch_file} COMMAND ${LINT_PRG} --suppress-errors=${suppress_file} ${rsfile} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${CMAKE_COMMAND} -E touch ${touch_file} - DEPENDS ${LINT_PRG} ${sfile} ${suppress_file} + DEPENDS ${LINT_PRG} ${sfile} clint-error-files ) list(APPEND LINT_TARGETS ${touch_file}) list(APPEND LINT_NVIM_REL_SOURCES ${rsfile}) -- cgit From c8243ad071f6cfcb9650ee00c53feadaaf7d90d5 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 9 Apr 2017 05:18:09 +0300 Subject: cmake: Do not build clint-error-files by default --- src/nvim/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 1daa5dc3c4..6a4fa7eadb 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -491,6 +491,7 @@ ExternalProject_Add( clint-error-files PREFIX "${LINT_SUPPRESSES_ROOT}" URL "${LINT_SUPPRESSES_URL}" + EXCLUDE_FROM_ALL 1 CONFIGURE_COMMAND "" BUILD_COMMAND "" BUILD_IN_SOURCE 1 -- cgit From b99cac277812d337e8a5f1bc6a182e62f1e8c448 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 9 Apr 2017 06:17:02 +0300 Subject: cmake: Do not use ExternalProject Necessary argument (EXCLUDE_FROM_ALL) only appears in 3.1.0. --- src/nvim/CMakeLists.txt | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 6a4fa7eadb..cb003c2026 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -42,6 +42,9 @@ set(LINT_PRG ${PROJECT_SOURCE_DIR}/src/clint.py) set(DOWNLOAD_SCRIPT ${PROJECT_SOURCE_DIR}/cmake/Download.cmake) set(LINT_SUPPRESSES_ROOT ${PROJECT_BINARY_DIR}/errors) set(LINT_SUPPRESSES_URL "${LINT_SUPPRESS_URL_BASE}/errors.tar.gz") +set(LINT_SUPPRESSES_ARCHIVE ${LINT_SUPPRESSES_ROOT}/errors.tar.gz) +set(LINT_SUPPRESSES_TOUCH_FILE "${TOUCHES_DIR}/unpacked-clint-errors-archive") +set(LINT_SUPPRESSES_INSTALL_SCRIPT "${PROJECT_SOURCE_DIR}/cmake/InstallClintErrors.cmake") include_directories(${GENERATED_DIR}) include_directories(${CACHED_GENERATED_DIR}) @@ -50,6 +53,8 @@ include_directories(${GENERATED_INCLUDES_DIR}) file(MAKE_DIRECTORY ${TOUCHES_DIR}) file(MAKE_DIRECTORY ${GENERATED_DIR}) file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}) +file(MAKE_DIRECTORY ${LINT_SUPPRESSES_ROOT}) +file(MAKE_DIRECTORY ${LINT_SUPPRESSES_ROOT}/src) file(GLOB NVIM_SOURCES *.c) file(GLOB NVIM_HEADERS *.h) @@ -486,19 +491,18 @@ function(add_download output url allow_failure) ) endfunction() -include(ExternalProject) -ExternalProject_Add( - clint-error-files - PREFIX "${LINT_SUPPRESSES_ROOT}" - URL "${LINT_SUPPRESSES_URL}" - EXCLUDE_FROM_ALL 1 - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - BUILD_IN_SOURCE 1 - INSTALL_COMMAND - "${CMAKE_COMMAND}" +add_download(${LINT_SUPPRESSES_ARCHIVE} ${LINT_SUPPRESSES_URL} off) + +add_custom_command( + OUTPUT ${LINT_SUPPRESSES_TOUCH_FILE} + WORKING_DIRECTORY ${LINT_SUPPRESSES_ROOT}/src + COMMAND ${CMAKE_COMMAND} -E tar xfz ${LINT_SUPPRESSES_ARCHIVE} + COMMAND + ${CMAKE_COMMAND} -DTARGET=${LINT_SUPPRESSES_ROOT} - -P "${PROJECT_SOURCE_DIR}/cmake/InstallClintErrors.cmake" + -P ${LINT_SUPPRESSES_INSTALL_SCRIPT} + DEPENDS + ${LINT_SUPPRESSES_ARCHIVE} ${LINT_SUPPRESSES_INSTALL_SCRIPT} ) add_download(${LINT_SUPPRESS_FILE} ${LINT_SUPPRESS_URL} off) @@ -515,7 +519,7 @@ foreach(sfile ${LINT_NVIM_SOURCES}) COMMAND ${LINT_PRG} --suppress-errors=${suppress_file} ${rsfile} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${CMAKE_COMMAND} -E touch ${touch_file} - DEPENDS ${LINT_PRG} ${sfile} clint-error-files + DEPENDS ${LINT_PRG} ${sfile} ${LINT_SUPPRESSES_TOUCH_FILE} ) list(APPEND LINT_TARGETS ${touch_file}) list(APPEND LINT_NVIM_REL_SOURCES ${rsfile}) -- cgit From fb66a7c69ef061fd2da12df8bca47592df25438f Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sat, 8 Apr 2017 21:22:11 -0400 Subject: vim-patch:8.0.0377 Problem: Possible overflow when reading corrupted undo file. Solution: Check if allocated size is not too big. (King) https://github.com/vim/vim/commit/3eb1637b1bba19519885dd6d377bd5596e91d22c CVE-2017-6349 --- src/nvim/undo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 4d4e8d9bb9..83c171d66a 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -76,6 +76,7 @@ #include #include #include +#include #include #include @@ -1400,7 +1401,9 @@ void u_read_undo(char *name, char_u *hash, char_u *orig_name) // sequence numbers of the headers. // When there are no headers uhp_table is NULL. if (num_head > 0) { - uhp_table = xmalloc((size_t)num_head * sizeof(u_header_T *)); + if ((size_t)num_head < SIZE_MAX / sizeof(*uhp_table)) { + uhp_table = xmalloc((size_t)num_head * sizeof(*uhp_table)); + } } long num_read_uhps = 0; -- cgit From ad66826abee14009abddfbef3e6088afc773ab9d Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sat, 8 Apr 2017 21:56:02 -0400 Subject: vim-patch:8.0.0378 Problem: Another possible overflow when reading corrupted undo file. Solution: Check if allocated size is not too big. (King) https://github.com/vim/vim/commit/0c8485f0e4931463c0f7986e1ea84a7d79f10c75 CVE-2017-6350 --- src/nvim/undo.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 83c171d66a..571ad7204f 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -967,12 +967,12 @@ static u_entry_T *unserialize_uep(bufinfo_T * bi, bool *error, uep->ue_lcount = undo_read_4c(bi); uep->ue_size = undo_read_4c(bi); - char_u **array; + char_u **array = NULL; if (uep->ue_size > 0) { - array = xmalloc(sizeof(char_u *) * (size_t)uep->ue_size); - memset(array, 0, sizeof(char_u *) * (size_t)uep->ue_size); - } else { - array = NULL; + if ((size_t)uep->ue_size < SIZE_MAX / sizeof(char_u *)) { + array = xmalloc(sizeof(char_u *) * (size_t)uep->ue_size); + memset(array, 0, sizeof(char_u *) * (size_t)uep->ue_size); + } } uep->ue_array = array; -- cgit From b338bb9d6c331fa4a45fbbeb7da3210f30f31702 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sun, 9 Apr 2017 00:45:19 -0400 Subject: vim-patch:8.0.0322 Problem: Possible overflow with spell file where the tree length is corrupted. Solution: Check for an invalid length (suggested by shqking) https://github.com/vim/vim/commit/399c297aa93afe2c0a39e2a1b3f972aebba44c9d CVE-2017-5953 --- src/nvim/spellfile.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index 4d7ff558ad..81000b95f5 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -1572,6 +1572,10 @@ spell_read_tree ( int len = get4c(fd); if (len < 0) return SP_TRUNCERROR; + if (len >= 0x3ffffff) { + // Invalid length, multiply with sizeof(int) would overflow. + return SP_FORMERROR; + } if (len > 0) { // Allocate the byte array. bp = xmalloc(len); -- cgit From 4af6c60826b4cb939fd9b7fe67a0b03e86d72bfc Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sun, 9 Apr 2017 00:46:52 -0400 Subject: vim-patch:8.0.0376 Problem: Size computations in spell file reading are not exactly right. Solution: Make "len" a "long" and check with LONG_MAX. https://github.com/vim/vim/commit/6d3c8586fc81b022e9f06c611b9926108fb878c7 --- src/nvim/spellfile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index 81000b95f5..a6cee59795 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -223,6 +223,7 @@ // few bytes as possible, see offset2bytes()) #include +#include #include #include "nvim/vim.h" @@ -1569,10 +1570,10 @@ spell_read_tree ( // The tree size was computed when writing the file, so that we can // allocate it as one long block. - int len = get4c(fd); + long len = get4c(fd); if (len < 0) return SP_TRUNCERROR; - if (len >= 0x3ffffff) { + if ((size_t)len >= SIZE_MAX / sizeof(int)) { // Invalid length, multiply with sizeof(int) would overflow. return SP_FORMERROR; } -- cgit From 06a96df510e1fa8d77d21a8120e97342d04be15f Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sun, 9 Apr 2017 01:17:15 -0400 Subject: lint --- src/nvim/spellfile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index a6cee59795..bbef1f5032 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -1571,8 +1571,9 @@ spell_read_tree ( // The tree size was computed when writing the file, so that we can // allocate it as one long block. long len = get4c(fd); - if (len < 0) + if (len < 0) { return SP_TRUNCERROR; + } if ((size_t)len >= SIZE_MAX / sizeof(int)) { // Invalid length, multiply with sizeof(int) would overflow. return SP_FORMERROR; -- cgit From 8d982ab52269e8adccbc21cc0d6f8ab3b817bf6e Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 9 Apr 2017 20:55:48 +0300 Subject: coverity/13686: Do not allow NUL byte in precondition regex Before this commit it emitted e_spell_trunc in the first case and treated file as completely valid on the second. While first is fine (both errors are actually valid, though old error is probably better), second results in incorrect regex used. --- src/nvim/spellfile.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index bbef1f5032..2c0db0694a 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -267,7 +267,7 @@ #define SAL_REM_ACCENTS 4 #define VIMSPELLMAGIC "VIMspell" // string at start of Vim spell file -#define VIMSPELLMAGICL 8 +#define VIMSPELLMAGICL (sizeof(VIMSPELLMAGIC) - 1) #define VIMSPELLVERSION 50 // Section IDs. Only renumber them when VIMSPELLVERSION changes! @@ -516,7 +516,6 @@ spell_load_file ( FILE *fd; char_u buf[VIMSPELLMAGICL]; char_u *p; - int i; int n; int len; char_u *save_sourcing_name = sourcing_name; @@ -558,8 +557,9 @@ spell_load_file ( sourcing_lnum = 0; //
: - for (i = 0; i < VIMSPELLMAGICL; ++i) + for (size_t i = 0; i < VIMSPELLMAGICL; i++) { buf[i] = getc(fd); // + } if (STRNCMP(buf, VIMSPELLMAGIC, VIMSPELLMAGICL) != 0) { EMSG(_("E757: This does not look like a spell file")); goto endFAIL; @@ -983,35 +983,36 @@ static int read_charflags_section(FILE *fd) // Return SP_*ERROR flags. static int read_prefcond_section(FILE *fd, slang_T *lp) { - int cnt; - int i; - int n; - char_u *p; - char_u buf[MAXWLEN + 1]; - // ... - cnt = get2c(fd); // - if (cnt <= 0) + const int cnt = get2c(fd); // + if (cnt <= 0) { return SP_FORMERROR; + } lp->sl_prefprog = xcalloc(cnt, sizeof(regprog_T *)); lp->sl_prefixcnt = cnt; - for (i = 0; i < cnt; ++i) { + for (int i = 0; i < cnt; ++i) { // : - n = getc(fd); // - if (n < 0 || n >= MAXWLEN) + const int n = getc(fd); // + if (n < 0 || n >= MAXWLEN) { return SP_FORMERROR; + } // When is zero we have an empty condition. Otherwise // compile the regexp program used to check for the condition. if (n > 0) { - buf[0] = '^'; // always match at one position only - p = buf + 1; - while (n-- > 0) - *p++ = getc(fd); // - *p = NUL; - lp->sl_prefprog[i] = vim_regcomp(buf, RE_MAGIC + RE_STRING); + char buf[MAXWLEN + 1]; + buf[0] = '^'; // always match at one position only + const size_t read_byte = fread(buf + 1, 1, (size_t)n, fd); + if (read_byte != (size_t)n) { + return feof(fd) ? SP_FORMERROR : SP_OTHERERROR; + } + if (memchr(buf + 1, NUL, (size_t)n)) { + return SP_FORMERROR; + } + buf[n + 1] = NUL; + lp->sl_prefprog[i] = vim_regcomp((char_u *)buf, RE_MAGIC | RE_STRING); } } return 0; -- cgit From 5b4f07ee86194a7c6032991102c96387581029c9 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 9 Apr 2017 21:47:45 +0300 Subject: spellfile: Use old error This makes first test not actually show any change in behaviour. --- src/nvim/spellfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index 2c0db0694a..4909b7b14e 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -1006,7 +1006,7 @@ static int read_prefcond_section(FILE *fd, slang_T *lp) buf[0] = '^'; // always match at one position only const size_t read_byte = fread(buf + 1, 1, (size_t)n, fd); if (read_byte != (size_t)n) { - return feof(fd) ? SP_FORMERROR : SP_OTHERERROR; + return feof(fd) ? SP_TRUNCERROR : SP_OTHERERROR; } if (memchr(buf + 1, NUL, (size_t)n)) { return SP_FORMERROR; -- cgit From ecce981dba367d61be170b535083691dd9c40cd2 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 9 Apr 2017 22:02:26 +0300 Subject: coverity/13687: Do not allow NUL byte in region names --- src/nvim/spellfile.c | 51 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index 4909b7b14e..97a82582c0 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -494,6 +494,41 @@ typedef struct spellinfo_S { # include "spellfile.c.generated.h" #endif +/// Read n bytes from fd to buf, returning on errors +/// +/// @param[out] buf Buffer to read to, must be at least n bytes long. +/// @param[in] n Amount of bytes to read. +/// @param fd FILE* to read from. +/// +/// @return Allows to proceed if everything is OK, returns SP_TRUNCERROR if +/// there are not enough bytes, returns SP_OTHERERROR if reading failed. +#define SPELL_READ_BYTES(buf, n, fd) \ + do { \ + const size_t n__SPRB = (n); \ + FILE *const fd__SPRB = (fd); \ + char *const buf__SPRB = (buf); \ + const size_t read_bytes__SPRB = fread(buf__SPRB, 1, n__SPRB, fd__SPRB); \ + if (read_bytes__SPRB != n__SPRB) { \ + return feof(fd__SPRB) ? SP_TRUNCERROR : SP_OTHERERROR; \ + } \ + } while (0) + +/// Like #SPELL_READ_BYTES, but also error out if NUL byte was read +/// +/// @return Allows to proceed if everything is OK, returns SP_TRUNCERROR if +/// there are not enough bytes, returns SP_OTHERERROR if reading failed, +/// returns SP_FORMERROR if read out a NUL byte. +#define SPELL_READ_NONNUL_BYTES(buf, n, fd) \ + do { \ + const size_t n__SPRNB = (n); \ + FILE *const fd__SPRNB = (fd); \ + char *const buf__SPRNB = (buf); \ + SPELL_READ_BYTES(buf__SPRNB, n__SPRNB, fd__SPRNB); \ + if (memchr(buf__SPRNB, NUL, (size_t)n__SPRNB)) { \ + return SP_FORMERROR; \ + } \ + } while (0) + // Load one spell file and store the info into a slang_T. // // This is invoked in three ways: @@ -935,12 +970,10 @@ static char_u *read_cnt_string(FILE *fd, int cnt_bytes, int *cntp) // Return SP_*ERROR flags. static int read_region_section(FILE *fd, slang_T *lp, int len) { - int i; - - if (len > 16) + if (len > 16) { return SP_FORMERROR; - for (i = 0; i < len; ++i) - lp->sl_regions[i] = getc(fd); // + } + SPELL_READ_NONNUL_BYTES((char *)lp->sl_regions, (size_t)len, fd); lp->sl_regions[len] = NUL; return 0; } @@ -1004,13 +1037,7 @@ static int read_prefcond_section(FILE *fd, slang_T *lp) if (n > 0) { char buf[MAXWLEN + 1]; buf[0] = '^'; // always match at one position only - const size_t read_byte = fread(buf + 1, 1, (size_t)n, fd); - if (read_byte != (size_t)n) { - return feof(fd) ? SP_TRUNCERROR : SP_OTHERERROR; - } - if (memchr(buf + 1, NUL, (size_t)n)) { - return SP_FORMERROR; - } + SPELL_READ_NONNUL_BYTES(buf + 1, (size_t)n, fd); buf[n + 1] = NUL; lp->sl_prefprog[i] = vim_regcomp((char_u *)buf, RE_MAGIC | RE_STRING); } -- cgit From 8f75b67c0733f09b8bc1d99235eb3231abc6500c Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 9 Apr 2017 22:16:26 +0300 Subject: coverity/13688: Check for NUL bytes in salfrom --- src/nvim/spellfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index 97a82582c0..8756bee21c 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -1157,8 +1157,8 @@ static int read_sal_section(FILE *fd, slang_T *slang) if (i < ccnt) // store the char we got while checking for end of sm_lead *p++ = c; - for (++i; i < ccnt; ++i) - *p++ = getc(fd); // + SPELL_READ_NONNUL_BYTES((char *)p, (size_t)ccnt, fd); // + p += ccnt; *p++ = NUL; // -- cgit From 35584594f5cfd46e9a56d9bc3473244c437a944a Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 9 Apr 2017 22:30:48 +0300 Subject: coverity/13689: Check file header with memcmp Not that it is actually useful (would fail in any case), but should fix coverity report. --- src/nvim/spellfile.c | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index 8756bee21c..9943a71a7c 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -225,6 +225,7 @@ #include #include #include +#include #include "nvim/vim.h" #include "nvim/spell_defs.h" @@ -529,6 +530,26 @@ typedef struct spellinfo_S { } \ } while (0) +/// Check that spell file starts with a magic string +/// +/// Does not check for version of the file. +/// +/// @param fd File to check. +/// +/// @return 0 in case of success, SP_TRUNCERROR if file contains not enough +/// bytes, SP_FORMERROR if it does not match magic string and +/// SP_OTHERERROR if reading file failed. +static inline int spell_check_magic_string(FILE *const fd) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_ALWAYS_INLINE +{ + char buf[VIMSPELLMAGICL]; + SPELL_READ_BYTES(buf, VIMSPELLMAGICL, fd); + if (memcmp(buf, VIMSPELLMAGIC, VIMSPELLMAGICL) != 0) { + return SP_FORMERROR; + } + return 0; +} + // Load one spell file and store the info into a slang_T. // // This is invoked in three ways: @@ -549,7 +570,6 @@ spell_load_file ( ) { FILE *fd; - char_u buf[VIMSPELLMAGICL]; char_u *p; int n; int len; @@ -592,12 +612,20 @@ spell_load_file ( sourcing_lnum = 0; //
: - for (size_t i = 0; i < VIMSPELLMAGICL; i++) { - buf[i] = getc(fd); // - } - if (STRNCMP(buf, VIMSPELLMAGIC, VIMSPELLMAGICL) != 0) { - EMSG(_("E757: This does not look like a spell file")); - goto endFAIL; + const int scms_ret = spell_check_magic_string(fd); + switch (scms_ret) { + case SP_FORMERROR: + case SP_TRUNCERROR: { + emsgf(_("E757: This does not look like a spell file")); + goto endFAIL; + } + case SP_OTHERERROR: { + emsgf(_("E5042: Failed to read spell file %s: %s"), + fname, strerror(ferror(fd))); + } + case 0: { + break; + } } c = getc(fd); // if (c < VIMSPELLVERSION) { -- cgit From aa857f9e481770059642b9286b66c75b1d9bd758 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 9 Apr 2017 22:33:45 +0300 Subject: spellfile: Fix memory leak --- src/nvim/spellfile.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index 9943a71a7c..d34c3a8ba1 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -500,16 +500,18 @@ typedef struct spellinfo_S { /// @param[out] buf Buffer to read to, must be at least n bytes long. /// @param[in] n Amount of bytes to read. /// @param fd FILE* to read from. +/// @param exit_code Code to run before returning. /// /// @return Allows to proceed if everything is OK, returns SP_TRUNCERROR if /// there are not enough bytes, returns SP_OTHERERROR if reading failed. -#define SPELL_READ_BYTES(buf, n, fd) \ +#define SPELL_READ_BYTES(buf, n, fd, exit_code) \ do { \ const size_t n__SPRB = (n); \ FILE *const fd__SPRB = (fd); \ char *const buf__SPRB = (buf); \ const size_t read_bytes__SPRB = fread(buf__SPRB, 1, n__SPRB, fd__SPRB); \ if (read_bytes__SPRB != n__SPRB) { \ + exit_code; \ return feof(fd__SPRB) ? SP_TRUNCERROR : SP_OTHERERROR; \ } \ } while (0) @@ -519,13 +521,14 @@ typedef struct spellinfo_S { /// @return Allows to proceed if everything is OK, returns SP_TRUNCERROR if /// there are not enough bytes, returns SP_OTHERERROR if reading failed, /// returns SP_FORMERROR if read out a NUL byte. -#define SPELL_READ_NONNUL_BYTES(buf, n, fd) \ +#define SPELL_READ_NONNUL_BYTES(buf, n, fd, exit_code) \ do { \ const size_t n__SPRNB = (n); \ FILE *const fd__SPRNB = (fd); \ char *const buf__SPRNB = (buf); \ - SPELL_READ_BYTES(buf__SPRNB, n__SPRNB, fd__SPRNB); \ + SPELL_READ_BYTES(buf__SPRNB, n__SPRNB, fd__SPRNB, exit_code); \ if (memchr(buf__SPRNB, NUL, (size_t)n__SPRNB)) { \ + exit_code; \ return SP_FORMERROR; \ } \ } while (0) @@ -543,7 +546,7 @@ static inline int spell_check_magic_string(FILE *const fd) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_ALWAYS_INLINE { char buf[VIMSPELLMAGICL]; - SPELL_READ_BYTES(buf, VIMSPELLMAGICL, fd); + SPELL_READ_BYTES(buf, VIMSPELLMAGICL, fd, ); if (memcmp(buf, VIMSPELLMAGIC, VIMSPELLMAGICL) != 0) { return SP_FORMERROR; } @@ -1001,7 +1004,7 @@ static int read_region_section(FILE *fd, slang_T *lp, int len) if (len > 16) { return SP_FORMERROR; } - SPELL_READ_NONNUL_BYTES((char *)lp->sl_regions, (size_t)len, fd); + SPELL_READ_NONNUL_BYTES((char *)lp->sl_regions, (size_t)len, fd, ); lp->sl_regions[len] = NUL; return 0; } @@ -1065,7 +1068,7 @@ static int read_prefcond_section(FILE *fd, slang_T *lp) if (n > 0) { char buf[MAXWLEN + 1]; buf[0] = '^'; // always match at one position only - SPELL_READ_NONNUL_BYTES(buf + 1, (size_t)n, fd); + SPELL_READ_NONNUL_BYTES(buf + 1, (size_t)n, fd, ); buf[n + 1] = NUL; lp->sl_prefprog[i] = vim_regcomp((char_u *)buf, RE_MAGIC | RE_STRING); } @@ -1185,7 +1188,8 @@ static int read_sal_section(FILE *fd, slang_T *slang) if (i < ccnt) // store the char we got while checking for end of sm_lead *p++ = c; - SPELL_READ_NONNUL_BYTES((char *)p, (size_t)ccnt, fd); // + SPELL_READ_NONNUL_BYTES( // + (char *)p, (size_t)ccnt, fd, xfree(smp->sm_lead)); p += ccnt; *p++ = NUL; -- cgit From eb3663eb1000bdf9b5c754614921001b21a2cf03 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 9 Apr 2017 22:39:23 +0300 Subject: spellfile: Fix clint errors --- src/nvim/spellfile.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index d34c3a8ba1..f4acb37a7a 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -546,7 +546,7 @@ static inline int spell_check_magic_string(FILE *const fd) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_ALWAYS_INLINE { char buf[VIMSPELLMAGICL]; - SPELL_READ_BYTES(buf, VIMSPELLMAGICL, fd, ); + SPELL_READ_BYTES(buf, VIMSPELLMAGICL, fd, ;); if (memcmp(buf, VIMSPELLMAGIC, VIMSPELLMAGICL) != 0) { return SP_FORMERROR; } @@ -1004,7 +1004,7 @@ static int read_region_section(FILE *fd, slang_T *lp, int len) if (len > 16) { return SP_FORMERROR; } - SPELL_READ_NONNUL_BYTES((char *)lp->sl_regions, (size_t)len, fd, ); + SPELL_READ_NONNUL_BYTES((char *)lp->sl_regions, (size_t)len, fd, ;); lp->sl_regions[len] = NUL; return 0; } @@ -1056,7 +1056,7 @@ static int read_prefcond_section(FILE *fd, slang_T *lp) lp->sl_prefprog = xcalloc(cnt, sizeof(regprog_T *)); lp->sl_prefixcnt = cnt; - for (int i = 0; i < cnt; ++i) { + for (int i = 0; i < cnt; i++) { // : const int n = getc(fd); // if (n < 0 || n >= MAXWLEN) { @@ -1068,7 +1068,7 @@ static int read_prefcond_section(FILE *fd, slang_T *lp) if (n > 0) { char buf[MAXWLEN + 1]; buf[0] = '^'; // always match at one position only - SPELL_READ_NONNUL_BYTES(buf + 1, (size_t)n, fd, ); + SPELL_READ_NONNUL_BYTES(buf + 1, (size_t)n, fd, ;); buf[n + 1] = NUL; lp->sl_prefprog[i] = vim_regcomp((char_u *)buf, RE_MAGIC | RE_STRING); } -- cgit From fa7ace446e724f888c815fe177c7b6e7b8057b7d Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 9 Apr 2017 23:38:05 +0300 Subject: coverity/56795: Fix NULL dereference in :syn keyword non-printable Bug was introduced 3 years earlier, in 13848aa: NULL keyword_copy was incorrectly treated as an indicator of OOM. --- src/nvim/syntax.c | 124 +++++++++++++++++++++++++++--------------------------- 1 file changed, 61 insertions(+), 63 deletions(-) (limited to 'src') diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index e36b00d770..1ed65ec52a 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -4246,83 +4246,81 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing) if (rest != NULL) { syn_id = syn_check_group(arg, (int)(group_name_end - arg)); - if (syn_id != 0) - /* allocate a buffer, for removing backslashes in the keyword */ + if (syn_id != 0) { + // Allocate a buffer, for removing backslashes in the keyword. keyword_copy = xmalloc(STRLEN(rest) + 1); - syn_opt_arg.flags = 0; - syn_opt_arg.keyword = TRUE; - syn_opt_arg.sync_idx = NULL; - syn_opt_arg.has_cont_list = FALSE; - syn_opt_arg.cont_in_list = NULL; - syn_opt_arg.next_list = NULL; - - /* - * The options given apply to ALL keywords, so all options must be - * found before keywords can be created. - * 1: collect the options and copy the keywords to keyword_copy. - */ - cnt = 0; - p = keyword_copy; - for (; rest != NULL && !ends_excmd(*rest); rest = skipwhite(rest)) { - rest = get_syn_options(rest, &syn_opt_arg, &conceal_char); - if (rest == NULL || ends_excmd(*rest)) - break; - /* Copy the keyword, removing backslashes, and add a NUL. */ - while (*rest != NUL && !ascii_iswhite(*rest)) { - if (*rest == '\\' && rest[1] != NUL) - ++rest; - *p++ = *rest++; - } - *p++ = NUL; - ++cnt; } + if (keyword_copy != NULL) { + syn_opt_arg.flags = 0; + syn_opt_arg.keyword = true; + syn_opt_arg.sync_idx = NULL; + syn_opt_arg.has_cont_list = false; + syn_opt_arg.cont_in_list = NULL; + syn_opt_arg.next_list = NULL; + + // The options given apply to ALL keywords, so all options must be + // found before keywords can be created. + // 1: collect the options and copy the keywords to keyword_copy. + cnt = 0; + p = keyword_copy; + for (; rest != NULL && !ends_excmd(*rest); rest = skipwhite(rest)) { + rest = get_syn_options(rest, &syn_opt_arg, &conceal_char); + if (rest == NULL || ends_excmd(*rest)) { + break; + } + // Copy the keyword, removing backslashes, and add a NUL. + while (*rest != NUL && !ascii_iswhite(*rest)) { + if (*rest == '\\' && rest[1] != NUL) { + rest++; + } + *p++ = *rest++; + } + *p++ = NUL; + cnt++; + } - if (!eap->skip) { - /* Adjust flags for use of ":syn include". */ - syn_incl_toplevel(syn_id, &syn_opt_arg.flags); + if (!eap->skip) { + // Adjust flags for use of ":syn include". + syn_incl_toplevel(syn_id, &syn_opt_arg.flags); - /* - * 2: Add an entry for each keyword. - */ - for (kw = keyword_copy; --cnt >= 0; kw += STRLEN(kw) + 1) { - for (p = vim_strchr(kw, '[');; ) { - if (p != NULL) - *p = NUL; - add_keyword(kw, syn_id, syn_opt_arg.flags, - syn_opt_arg.cont_in_list, - syn_opt_arg.next_list, conceal_char); - if (p == NULL) - break; - if (p[1] == NUL) { - EMSG2(_("E789: Missing ']': %s"), kw); - goto error; - } - if (p[1] == ']') { - if (p[2] != NUL) { - EMSG3(_("E890: trailing char after ']': %s]%s"), - kw, &p[2]); + // 2: Add an entry for each keyword. + for (kw = keyword_copy; --cnt >= 0; kw += STRLEN(kw) + 1) { + for (p = vim_strchr(kw, '[');; ) { + if (p != NULL) { + *p = NUL; + } + add_keyword(kw, syn_id, syn_opt_arg.flags, + syn_opt_arg.cont_in_list, + syn_opt_arg.next_list, conceal_char); + if (p == NULL) { + break; + } + if (p[1] == NUL) { + emsgf(_("E789: Missing ']': %s"), kw); goto error; } - kw = p + 1; - break; // skip over the "]" - } - if (has_mbyte) { - int l = (*mb_ptr2len)(p + 1); + if (p[1] == ']') { + if (p[2] != NUL) { + emsgf(_("E890: trailing char after ']': %s]%s"), + kw, &p[2]); + goto error; + } + kw = p + 1; + break; // skip over the "]" + } + const int l = (*mb_ptr2len)(p + 1); memmove(p, p + 1, l); p += l; - } else { - p[0] = p[1]; - ++p; } } } - } error: - xfree(keyword_copy); - xfree(syn_opt_arg.cont_in_list); - xfree(syn_opt_arg.next_list); + xfree(keyword_copy); + xfree(syn_opt_arg.cont_in_list); + xfree(syn_opt_arg.next_list); + } } if (rest != NULL) -- cgit From ebe50519775081565b66e18a471473e46f713442 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 9 Apr 2017 23:46:38 +0300 Subject: spellfile: Fix SAL sections reading --- src/nvim/spellfile.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index f4acb37a7a..1da71dc4f9 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -1123,7 +1123,6 @@ static int read_rep_section(FILE *fd, garray_T *gap, int16_t *first) // Return SP_*ERROR flags. static int read_sal_section(FILE *fd, slang_T *slang) { - int i; int cnt; garray_T *gap; salitem_T *smp; @@ -1133,13 +1132,16 @@ static int read_sal_section(FILE *fd, slang_T *slang) slang->sl_sofo = false; - i = getc(fd); // - if (i & SAL_F0LLOWUP) + const int flags = getc(fd); // + if (flags & SAL_F0LLOWUP) { slang->sl_followup = true; - if (i & SAL_COLLAPSE) + } + if (flags & SAL_COLLAPSE) { slang->sl_collapse = true; - if (i & SAL_REM_ACCENTS) + } + if (flags & SAL_REM_ACCENTS) { slang->sl_rem_accents = true; + } cnt = get2c(fd); // if (cnt < 0) @@ -1159,7 +1161,8 @@ static int read_sal_section(FILE *fd, slang_T *slang) smp->sm_lead = p; // Read up to the first special char into sm_lead. - for (i = 0; i < ccnt; ++i) { + int i = 0; + for (; i < ccnt; ++i) { c = getc(fd); // if (vim_strchr((char_u *)"0123456789(-<^$", c) != NULL) break; @@ -1185,12 +1188,17 @@ static int read_sal_section(FILE *fd, slang_T *slang) // Any following chars go in sm_rules. smp->sm_rules = p; - if (i < ccnt) + if (i < ccnt) { // store the char we got while checking for end of sm_lead *p++ = c; - SPELL_READ_NONNUL_BYTES( // - (char *)p, (size_t)ccnt, fd, xfree(smp->sm_lead)); - p += ccnt; + } + i++; + if (i < ccnt) { + SPELL_READ_NONNUL_BYTES( // + (char *)p, (size_t)(ccnt - i), fd, xfree(smp->sm_lead)); + p += (ccnt - i); + i = ccnt; + } *p++ = NUL; // -- cgit From 1b66ed890b6e1444b6be113bc5572f1baf82db6c Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 10 Apr 2017 02:53:00 +0300 Subject: cmake: Do not forget to actually create a touch file for errors.tar.gz --- src/nvim/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index cb003c2026..a91657f1bd 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -501,6 +501,7 @@ add_custom_command( ${CMAKE_COMMAND} -DTARGET=${LINT_SUPPRESSES_ROOT} -P ${LINT_SUPPRESSES_INSTALL_SCRIPT} + COMMAND ${CMAKE_COMMAND} -E touch ${LINT_SUPPRESSES_TOUCH_FILE} DEPENDS ${LINT_SUPPRESSES_ARCHIVE} ${LINT_SUPPRESSES_INSTALL_SCRIPT} ) -- cgit From db9ef6263ec5b7885782ccf0a93e06b0c71f6944 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sat, 8 Apr 2017 16:45:38 +0200 Subject: mbyte: replace vim_tolower with mb_tolower handling locale correctly --- src/nvim/charset.c | 69 +++----------------------------------------------- src/nvim/edit.c | 22 ++++++++-------- src/nvim/eval.c | 2 +- src/nvim/ex_getln.c | 4 +-- src/nvim/file_search.c | 2 +- src/nvim/macros.h | 2 +- src/nvim/mbyte.c | 17 ++++++++----- src/nvim/message.c | 4 +-- src/nvim/ops.c | 10 ++++---- src/nvim/path.c | 4 +-- src/nvim/regexp.c | 34 ++++++++++++------------- src/nvim/regexp_nfa.c | 20 +++++++-------- src/nvim/search.c | 4 +-- src/nvim/spell.c | 14 +++++----- src/nvim/spell_defs.h | 4 +-- src/nvim/strings.c | 2 +- 16 files changed, 79 insertions(+), 135 deletions(-) (limited to 'src') diff --git a/src/nvim/charset.c b/src/nvim/charset.c index 99d3e2dd88..645139f696 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -212,8 +212,8 @@ int buf_init_chartab(buf_T *buf, int global) // work properly when 'encoding' is "latin1" and the locale is // "C". if (!do_isalpha - || vim_islower(c) - || vim_isupper(c) + || mb_islower(c) + || mb_isupper(c) || (p_altkeymap && (F_isalpha(c) || F_isdigit(c)))) { if (i == 0) { // (re)set ID flag @@ -417,11 +417,11 @@ char_u* str_foldcase(char_u *str, int orglen, char_u *buf, int buflen) while (STR_CHAR(i) != NUL) { int c = utf_ptr2char(STR_PTR(i)); int olen = utf_ptr2len(STR_PTR(i)); - int lc = utf_tolower(c); + int lc = mb_tolower(c); // Only replace the character when it is not an invalid // sequence (ASCII character or more than one byte) and - // utf_tolower() doesn't return the original character. + // mb_tolower() doesn't return the original character. if (((c < 0x80) || (olen > 1)) && (c != lc)) { int nlen = utf_char2len(lc); @@ -1506,67 +1506,6 @@ char_u* skiptohex(char_u *q) return p; } -// Vim's own character class functions. These exist because many library -// islower()/toupper() etc. do not work properly: they crash when used with -// invalid values or can't handle latin1 when the locale is C. -// Speed is most important here. - -/// Check that the character is lower-case -/// -/// @param c character to check -bool vim_islower(int c) - FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT -{ - if (c <= '@') { - return false; - } - - if (c >= 0x80) { - return utf_islower(c); - } - return islower(c); -} - -/// Check that the character is upper-case -/// -/// @param c character to check -bool vim_isupper(int c) - FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT -{ - if (c <= '@') { - return false; - } - - if (c >= 0x80) { - return utf_isupper(c); - } - return isupper(c); -} - -int vim_toupper(int c) -{ - if (c <= '@') { - return c; - } - - if (c >= 0x80) { - return utf_toupper(c); - } - return TOUPPER_LOC(c); -} - -int vim_tolower(int c) -{ - if (c <= '@') { - return c; - } - - if (c >= 0x80) { - return utf_tolower(c); - } - return TOLOWER_LOC(c); -} - /// Skip over text until ' ' or '\t' or NUL /// /// @param[in] p Text to skip over. diff --git a/src/nvim/edit.c b/src/nvim/edit.c index b35504908e..aa254b0577 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -2037,12 +2037,12 @@ int ins_compl_add_infercase(char_u *str, int len, int icase, char_u *fname, int } else { c = *(p++); } - if (vim_islower(c)) { + if (mb_islower(c)) { has_lower = true; - if (vim_isupper(wca[i])) { + if (mb_isupper(wca[i])) { // Rule 1 is satisfied. for (i = actual_compl_length; i < actual_len; i++) { - wca[i] = vim_tolower(wca[i]); + wca[i] = mb_tolower(wca[i]); } break; } @@ -2062,14 +2062,14 @@ int ins_compl_add_infercase(char_u *str, int len, int icase, char_u *fname, int } else { c = *(p++); } - if (was_letter && vim_isupper(c) && vim_islower(wca[i])) { + if (was_letter && mb_isupper(c) && mb_islower(wca[i])) { // Rule 2 is satisfied. for (i = actual_compl_length; i < actual_len; i++) { - wca[i] = vim_toupper(wca[i]); + wca[i] = mb_toupper(wca[i]); } break; } - was_letter = vim_islower(c) || vim_isupper(c); + was_letter = mb_islower(c) || mb_isupper(c); } } @@ -2082,10 +2082,10 @@ int ins_compl_add_infercase(char_u *str, int len, int icase, char_u *fname, int } else { c = *(p++); } - if (vim_islower(c)) { - wca[i] = vim_tolower(wca[i]); - } else if (vim_isupper(c)) { - wca[i] = vim_toupper(wca[i]); + if (mb_islower(c)) { + wca[i] = mb_tolower(wca[i]); + } else if (mb_isupper(c)) { + wca[i] = mb_toupper(wca[i]); } } } @@ -2302,7 +2302,7 @@ static void ins_compl_longest_match(compl_T *match) c1 = *p; c2 = *s; } - if (match->cp_icase ? (vim_tolower(c1) != vim_tolower(c2)) + if (match->cp_icase ? (mb_tolower(c1) != mb_tolower(c2)) : (c1 != c2)) break; if (has_mbyte) { diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 124d6acfe9..c1ee33b06a 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -16802,7 +16802,7 @@ static void f_tolower(typval_T *argvars, typval_T *rettv, FunPtr fptr) int c, lc; c = utf_ptr2char(p); - lc = utf_tolower(c); + lc = mb_tolower(c); l = utf_ptr2len(p); /* TODO: reallocate string when byte count changes. */ if (utf_char2len(lc) == l) diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 8810204c03..9d74f554ba 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -1231,7 +1231,7 @@ static int command_line_handle_key(CommandLineState *s) // command line has no uppercase characters, convert // the character to lowercase if (p_ic && p_scs && !pat_has_uppercase(ccline.cmdbuff)) { - s->c = vim_tolower(s->c); + s->c = mb_tolower(s->c); } if (s->c != NUL) { @@ -3018,7 +3018,7 @@ ExpandOne ( || xp->xp_context == EXPAND_FILES || xp->xp_context == EXPAND_SHELLCMD || xp->xp_context == EXPAND_BUFFERS)) { - if (vim_tolower(c0) != vim_tolower(ci)) { + if (mb_tolower(c0) != mb_tolower(ci)) { break; } } else if (c0 != ci) { diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c index 9592235905..db745bdd15 100644 --- a/src/nvim/file_search.c +++ b/src/nvim/file_search.c @@ -1057,7 +1057,7 @@ static bool ff_wc_equal(char_u *s1, char_u *s2) c1 = PTR2CHAR(s1 + i); c2 = PTR2CHAR(s2 + j); - if ((p_fic ? vim_tolower(c1) != vim_tolower(c2) : c1 != c2) + if ((p_fic ? mb_tolower(c1) != mb_tolower(c2) : c1 != c2) && (prev1 != '*' || prev2 != '*')) { return false; } diff --git a/src/nvim/macros.h b/src/nvim/macros.h index a8df6322cf..22fd48de9d 100644 --- a/src/nvim/macros.h +++ b/src/nvim/macros.h @@ -62,7 +62,7 @@ * toupper() and tolower() that use the current locale. * Careful: Only call TOUPPER_LOC() and TOLOWER_LOC() with a character in the * range 0 - 255. toupper()/tolower() on some systems can't handle others. - * Note: It is often better to use vim_tolower() and vim_toupper(), because many + * Note: It is often better to use mb_tolower() and mb_toupper(), because many * toupper() and tolower() implementations only work for ASCII. */ #define TOUPPER_LOC toupper diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index 460528b85f..5f5abbeac5 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -1174,11 +1174,16 @@ int utf_fold(int a) return utf_convert(a, foldCase, ARRAY_SIZE(foldCase)); } +// Vim's own character class functions. These exist because many library +// islower()/toupper() etc. do not work properly: they crash when used with +// invalid values or can't handle latin1 when the locale is C. +// Speed is most important here. + /* * Return the upper-case equivalent of "a", which is a UCS-4 character. Use * simple case folding. */ -int utf_toupper(int a) +int mb_toupper(int a) { /* If 'casemap' contains "keepascii" use ASCII style toupper(). */ if (a < 128 && (cmp_flags & CMP_KEEPASCII)) @@ -1198,17 +1203,17 @@ int utf_toupper(int a) return utf_convert(a, toUpper, ARRAY_SIZE(toUpper)); } -bool utf_islower(int a) +bool mb_islower(int a) { /* German sharp s is lower case but has no upper case equivalent. */ - return (utf_toupper(a) != a) || a == 0xdf; + return (mb_toupper(a) != a) || a == 0xdf; } /* * Return the lower-case equivalent of "a", which is a UCS-4 character. Use * simple case folding. */ -int utf_tolower(int a) +int mb_tolower(int a) { /* If 'casemap' contains "keepascii" use ASCII style tolower(). */ if (a < 128 && (cmp_flags & CMP_KEEPASCII)) @@ -1228,9 +1233,9 @@ int utf_tolower(int a) return utf_convert(a, toLower, ARRAY_SIZE(toLower)); } -bool utf_isupper(int a) +bool mb_isupper(int a) { - return utf_tolower(a) != a; + return mb_tolower(a) != a; } static int utf_strnicmp(const char_u *s1, const char_u *s2, size_t n1, diff --git a/src/nvim/message.c b/src/nvim/message.c index 1d3609291a..2cc426cf42 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -2731,7 +2731,7 @@ do_dialog ( } /* Make the character lowercase, as chars in "hotkeys" are. */ - c = vim_tolower(c); + c = mb_tolower(c); retval = 1; for (i = 0; hotkeys[i]; ++i) { if (has_mbyte) { @@ -2777,7 +2777,7 @@ copy_char ( if (has_mbyte) { if (lowercase) { - c = vim_tolower((*mb_ptr2char)(from)); + c = mb_tolower((*mb_ptr2char)(from)); return (*mb_char2bytes)(c, to); } else { len = (*mb_ptr2len)(from); diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 68ef27222c..c5b7e65983 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -1956,16 +1956,16 @@ int swapchar(int op_type, pos_T *pos) if (enc_dbcs != 0 && c >= 0x100) /* No lower/uppercase letter */ return FALSE; nc = c; - if (vim_islower(c)) { + if (mb_islower(c)) { if (op_type == OP_ROT13) nc = ROT13(c, 'a'); else if (op_type != OP_LOWER) - nc = vim_toupper(c); - } else if (vim_isupper(c)) { + nc = mb_toupper(c); + } else if (mb_isupper(c)) { if (op_type == OP_ROT13) nc = ROT13(c, 'A'); else if (op_type != OP_UPPER) - nc = vim_tolower(c); + nc = mb_tolower(c); } if (nc != c) { if (enc_utf8 && (c >= 0x80 || nc >= 0x80)) { @@ -3327,7 +3327,7 @@ void ex_display(exarg_T *eap) get_clipboard(name, &yb, true); - if (name == vim_tolower(redir_reg) + if (name == mb_tolower(redir_reg) || (redir_reg == '"' && yb == y_previous)) continue; /* do not list register being written to, the * pointer can be freed */ diff --git a/src/nvim/path.c b/src/nvim/path.c index 6bf42ed2fa..781522f63f 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -1853,7 +1853,7 @@ int pathcmp(const char *p, const char *q, int maxlen) break; } - if ((p_fic ? vim_toupper(c1) != vim_toupper(c2) : c1 != c2) + if ((p_fic ? mb_toupper(c1) != mb_toupper(c2) : c1 != c2) #ifdef BACKSLASH_IN_FILENAME /* consider '/' and '\\' to be equal */ && !((c1 == '/' && c2 == '\\') @@ -1864,7 +1864,7 @@ int pathcmp(const char *p, const char *q, int maxlen) return -1; if (vim_ispathsep(c2)) return 1; - return p_fic ? vim_toupper(c1) - vim_toupper(c2) + return p_fic ? mb_toupper(c1) - mb_toupper(c2) : c1 - c2; /* no match */ } diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 9baa53d2a2..7e2fc261f2 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -2350,7 +2350,7 @@ collection: break; case CLASS_LOWER: for (cu = 1; cu <= 255; cu++) { - if (vim_islower(cu) && cu != 170 && cu != 186) { + if (mb_islower(cu) && cu != 170 && cu != 186) { regmbc(cu); } } @@ -2376,7 +2376,7 @@ collection: break; case CLASS_UPPER: for (cu = 1; cu <= 255; cu++) { - if (vim_isupper(cu)) { + if (mb_isupper(cu)) { regmbc(cu); } } @@ -3474,7 +3474,7 @@ static long bt_regexec_both(char_u *line, || (ireg_ic && (((enc_utf8 && utf_fold(prog->regstart) == utf_fold(c))) || (c < 255 && prog->regstart < 255 - && vim_tolower(prog->regstart) == vim_tolower(c))))) { + && mb_tolower(prog->regstart) == mb_tolower(c))))) { retval = regtry(prog, col); } else { retval = 0; @@ -4155,7 +4155,7 @@ regmatch ( if (*opnd != *reginput && (!ireg_ic || (!enc_utf8 - && vim_tolower(*opnd) != vim_tolower(*reginput)))) { + && mb_tolower(*opnd) != mb_tolower(*reginput)))) { status = RA_NOMATCH; } else if (*opnd == NUL) { // match empty string always works; happens when "~" is @@ -4573,10 +4573,10 @@ regmatch ( if (OP(next) == EXACTLY) { rst.nextb = *OPERAND(next); if (ireg_ic) { - if (vim_isupper(rst.nextb)) - rst.nextb_ic = vim_tolower(rst.nextb); + if (mb_isupper(rst.nextb)) + rst.nextb_ic = mb_tolower(rst.nextb); else - rst.nextb_ic = vim_toupper(rst.nextb); + rst.nextb_ic = mb_toupper(rst.nextb); } else rst.nextb_ic = rst.nextb; } else { @@ -5339,8 +5339,8 @@ do_class: * would have been used for it. It does handle single-byte * characters, such as latin1. */ if (ireg_ic) { - cu = vim_toupper(*opnd); - cl = vim_tolower(*opnd); + cu = mb_toupper(*opnd); + cl = mb_tolower(*opnd); while (count < maxcount && (*scan == cu || *scan == cl)) { count++; scan++; @@ -6314,10 +6314,10 @@ static char_u *cstrchr(char_u *s, int c) * For UTF-8 need to use folded case. */ if (enc_utf8 && c > 0x80) cc = utf_fold(c); - else if (vim_isupper(c)) - cc = vim_tolower(c); - else if (vim_islower(c)) - cc = vim_toupper(c); + else if (mb_isupper(c)) + cc = mb_tolower(c); + else if (mb_islower(c)) + cc = mb_toupper(c); else return vim_strchr(s, c); @@ -6348,28 +6348,28 @@ static char_u *cstrchr(char_u *s, int c) static fptr_T do_upper(int *d, int c) { - *d = vim_toupper(c); + *d = mb_toupper(c); return (fptr_T)NULL; } static fptr_T do_Upper(int *d, int c) { - *d = vim_toupper(c); + *d = mb_toupper(c); return (fptr_T)do_Upper; } static fptr_T do_lower(int *d, int c) { - *d = vim_tolower(c); + *d = mb_tolower(c); return (fptr_T)NULL; } static fptr_T do_Lower(int *d, int c) { - *d = vim_tolower(c); + *d = mb_tolower(c); return (fptr_T)do_Lower; } diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index 5b49ab38f0..1d57595cbe 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -4373,7 +4373,7 @@ static int check_char_class(int class, int c) return OK; break; case NFA_CLASS_LOWER: - if (vim_islower(c) && c != 170 && c != 186) { + if (mb_islower(c) && c != 170 && c != 186) { return OK; } break; @@ -4391,7 +4391,7 @@ static int check_char_class(int class, int c) return OK; break; case NFA_CLASS_UPPER: - if (vim_isupper(c)) + if (mb_isupper(c)) return OK; break; case NFA_CLASS_XDIGIT: @@ -4892,7 +4892,7 @@ static long find_match_text(colnr_T startcol, int regstart, char_u *match_text) int c2_len = PTR2LEN(s2); int c2 = PTR2CHAR(s2); - if ((c1 != c2 && (!ireg_ic || vim_tolower(c1) != vim_tolower(c2))) + if ((c1 != c2 && (!ireg_ic || mb_tolower(c1) != mb_tolower(c2))) || c1_len != c2_len) { match = false; break; @@ -5585,11 +5585,11 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, break; } if (ireg_ic) { - int curc_low = vim_tolower(curc); + int curc_low = mb_tolower(curc); int done = FALSE; for (; c1 <= c2; ++c1) - if (vim_tolower(c1) == curc_low) { + if (mb_tolower(c1) == curc_low) { result = result_if_matched; done = TRUE; break; @@ -5599,8 +5599,8 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, } } else if (state->c < 0 ? check_char_class(state->c, curc) : (curc == state->c - || (ireg_ic && vim_tolower(curc) - == vim_tolower(state->c)))) { + || (ireg_ic && mb_tolower(curc) + == mb_tolower(state->c)))) { result = result_if_matched; break; } @@ -6004,7 +6004,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, result = (c == curc); if (!result && ireg_ic) - result = vim_tolower(c) == vim_tolower(curc); + result = mb_tolower(c) == mb_tolower(curc); // If ireg_icombine is not set only skip over the character // itself. When it is set skip over composing characters. @@ -6152,8 +6152,8 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, // Checking if the required start character matches is // cheaper than adding a state that won't match. c = PTR2CHAR(reginput + clen); - if (c != prog->regstart && (!ireg_ic || vim_tolower(c) - != vim_tolower(prog->regstart))) { + if (c != prog->regstart && (!ireg_ic || mb_tolower(c) + != mb_tolower(prog->regstart))) { #ifdef REGEXP_DEBUG fprintf(log_fd, " Skipping start state, regstart does not match\n"); diff --git a/src/nvim/search.c b/src/nvim/search.c index c5c92b41c5..4f060b2b8b 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -336,7 +336,7 @@ int pat_has_uppercase(char_u *pat) int l; if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) { - if (enc_utf8 && utf_isupper(utf_ptr2char(p))) + if (enc_utf8 && mb_isupper(utf_ptr2char(p))) return TRUE; p += l; } else if (*p == '\\') { @@ -348,7 +348,7 @@ int pat_has_uppercase(char_u *pat) p += 2; else p += 1; - } else if (vim_isupper(*p)) + } else if (mb_isupper(*p)) return TRUE; else ++p; diff --git a/src/nvim/spell.c b/src/nvim/spell.c index d4f49bffb2..99661d0ef5 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -2545,10 +2545,10 @@ void init_spell_chartab(void) } else if (enc_utf8) { for (i = 128; i < 256; ++i) { int f = utf_fold(i); - int u = utf_toupper(i); + int u = mb_toupper(i); - spelltab.st_isu[i] = utf_isupper(i); - spelltab.st_isw[i] = spelltab.st_isu[i] || utf_islower(i); + spelltab.st_isu[i] = mb_isupper(i); + spelltab.st_isw[i] = spelltab.st_isu[i] || mb_islower(i); // The folded/upper-cased value is different between latin1 and // utf8 for 0xb5, causing E763 for no good reason. Use the latin1 // value for utf-8 to avoid this. @@ -2558,13 +2558,13 @@ void init_spell_chartab(void) } else { // Rough guess: use locale-dependent library functions. for (i = 128; i < 256; ++i) { - if (vim_isupper(i)) { + if (mb_isupper(i)) { spelltab.st_isw[i] = true; spelltab.st_isu[i] = true; - spelltab.st_fold[i] = vim_tolower(i); - } else if (vim_islower(i)) { + spelltab.st_fold[i] = mb_tolower(i); + } else if (mb_islower(i)) { spelltab.st_isw[i] = true; - spelltab.st_upper[i] = vim_toupper(i); + spelltab.st_upper[i] = mb_toupper(i); } } } diff --git a/src/nvim/spell_defs.h b/src/nvim/spell_defs.h index c54a7f5390..ddd54c724e 100644 --- a/src/nvim/spell_defs.h +++ b/src/nvim/spell_defs.h @@ -265,11 +265,11 @@ typedef struct trystate_S { : (c) < \ 256 ? (int)spelltab.st_fold[c] : (int)towlower(c)) -#define SPELL_TOUPPER(c) (enc_utf8 && (c) >= 128 ? utf_toupper(c) \ +#define SPELL_TOUPPER(c) (enc_utf8 && (c) >= 128 ? mb_toupper(c) \ : (c) < \ 256 ? (int)spelltab.st_upper[c] : (int)towupper(c)) -#define SPELL_ISUPPER(c) (enc_utf8 && (c) >= 128 ? utf_isupper(c) \ +#define SPELL_ISUPPER(c) (enc_utf8 && (c) >= 128 ? mb_isupper(c) \ : (c) < 256 ? spelltab.st_isu[c] : iswupper(c)) // First language that is loaded, start of the linked list of loaded diff --git a/src/nvim/strings.c b/src/nvim/strings.c index 5dcffe00e0..e7c0fb8a7d 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -309,7 +309,7 @@ char *strup_save(const char *const orig) if (enc_utf8) { int c = utf_ptr2char((const char_u *)p); - int uc = utf_toupper(c); + int uc = mb_toupper(c); // Reallocate string when byte count changes. This is rare, // thus it's OK to do another malloc()/free(). -- cgit From 4c857dae1169f3b8c7b6a9740f50acfd3c16858d Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sun, 9 Apr 2017 09:29:00 +0200 Subject: vim-patch:8.0.0243 Problem: When making a character lower case with tolower() changes the byte cound, it is not made lower case. Solution: Add strlow_save(). (Dominique Pelle, closes vim/vim#1406) https://github.com/vim/vim/commit/cc5b22b3bfdc0e9e835cf7871166badda31447bd Join almost identical strup_save and strlow_save functions to one Function. --- src/nvim/eval.c | 26 +------ src/nvim/strings.c | 51 ++++++------- src/nvim/testdir/test_functions.vim | 144 ++++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+), 53 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index c1ee33b06a..ed07de51c8 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -16791,30 +16791,8 @@ void timer_teardown(void) */ static void f_tolower(typval_T *argvars, typval_T *rettv, FunPtr fptr) { - char_u *p = (char_u *)xstrdup(tv_get_string(&argvars[0])); rettv->v_type = VAR_STRING; - rettv->vval.v_string = p; - - while (*p != NUL) { - int l; - - if (enc_utf8) { - int c, lc; - - c = utf_ptr2char(p); - lc = mb_tolower(c); - l = utf_ptr2len(p); - /* TODO: reallocate string when byte count changes. */ - if (utf_char2len(lc) == l) - utf_char2bytes(lc, p); - p += l; - } else if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) - p += l; /* skip multi-byte character */ - else { - *p = TOLOWER_LOC(*p); /* note that tolower() can be a macro */ - ++p; - } - } + rettv->vval.v_string = (char_u *)strcase_save(tv_get_string(&argvars[0]), false); } /* @@ -16823,7 +16801,7 @@ static void f_tolower(typval_T *argvars, typval_T *rettv, FunPtr fptr) static void f_toupper(typval_T *argvars, typval_T *rettv, FunPtr fptr) { rettv->v_type = VAR_STRING; - rettv->vval.v_string = (char_u *)strup_save(tv_get_string(&argvars[0])); + rettv->vval.v_string = (char_u *)strcase_save(tv_get_string(&argvars[0]), true); } /* diff --git a/src/nvim/strings.c b/src/nvim/strings.c index e7c0fb8a7d..87e066d80a 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -291,14 +291,15 @@ void vim_strup(char_u *p) } } -/// Make given string all upper-case +/// Make given string all upper-case or all lower-case /// -/// Handels multi-byte characters as good as possible. +/// Handles multi-byte characters as good as possible. /// /// @param[in] orig Input string. +/// @param[in] upper If true make uppercase, otherwise lowercase /// /// @return [allocated] upper-cased string. -char *strup_save(const char *const orig) +char *strcase_save(const char *const orig, bool upper) FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_ALL { char *res = xstrdup(orig); @@ -307,33 +308,25 @@ char *strup_save(const char *const orig) while (*p != NUL) { int l; - if (enc_utf8) { - int c = utf_ptr2char((const char_u *)p); - int uc = mb_toupper(c); - - // Reallocate string when byte count changes. This is rare, - // thus it's OK to do another malloc()/free(). - l = utf_ptr2len((const char_u *)p); - int newl = utf_char2len(uc); - if (newl != l) { - // TODO(philix): use xrealloc() in strup_save() - char *s = xmalloc(STRLEN(res) + (size_t)(1 + newl - l)); - memcpy(s, res, (size_t)(p - res)); - STRCPY(s + (p - res) + newl, p + l); - p = s + (p - res); - xfree(res); - res = s; - } - - utf_char2bytes(uc, (char_u *)p); - p += newl; - } else if (has_mbyte && (l = (*mb_ptr2len)((const char_u *)p)) > 1) { - p += l; // Skip multi-byte character. - } else { - // note that toupper() can be a macro - *p = (char)(uint8_t)TOUPPER_LOC(*p); - p++; + int c = utf_ptr2char((const char_u *)p); + int uc = upper ? mb_toupper(c) : mb_tolower(c); + + // Reallocate string when byte count changes. This is rare, + // thus it's OK to do another malloc()/free(). + l = utf_ptr2len((const char_u *)p); + int newl = utf_char2len(uc); + if (newl != l) { + // TODO(philix): use xrealloc() in strup_save() + char *s = xmalloc(STRLEN(res) + (size_t)(1 + newl - l)); + memcpy(s, res, (size_t)(p - res)); + STRCPY(s + (p - res) + newl, p + l); + p = s + (p - res); + xfree(res); + res = s; } + + utf_char2bytes(uc, (char_u *)p); + p += newl; } return res; diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index 81cb6314ce..3c258299c1 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -29,3 +29,147 @@ func Test_setbufvar_options() bwipe! endfunc +func Test_tolower() + call assert_equal("", tolower("")) + + " Test with all printable ASCII characters. + call assert_equal(' !"#$%&''()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\]^_`abcdefghijklmnopqrstuvwxyz{|}~', + \ tolower(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~')) + + if !has('multi_byte') + return + endif + + " Test with a few uppercase diacritics. + call assert_equal("aàáâãäåāăąǎǟǡả", tolower("AÀÁÂÃÄÅĀĂĄǍǞǠẢ")) + call assert_equal("bḃḇ", tolower("BḂḆ")) + call assert_equal("cçćĉċč", tolower("CÇĆĈĊČ")) + call assert_equal("dďđḋḏḑ", tolower("DĎĐḊḎḐ")) + call assert_equal("eèéêëēĕėęěẻẽ", tolower("EÈÉÊËĒĔĖĘĚẺẼ")) + call assert_equal("fḟ ", tolower("FḞ ")) + call assert_equal("gĝğġģǥǧǵḡ", tolower("GĜĞĠĢǤǦǴḠ")) + call assert_equal("hĥħḣḧḩ", tolower("HĤĦḢḦḨ")) + call assert_equal("iìíîïĩīĭįiǐỉ", tolower("IÌÍÎÏĨĪĬĮİǏỈ")) + call assert_equal("jĵ", tolower("JĴ")) + call assert_equal("kķǩḱḵ", tolower("KĶǨḰḴ")) + call assert_equal("lĺļľŀłḻ", tolower("LĹĻĽĿŁḺ")) + call assert_equal("mḿṁ", tolower("MḾṀ")) + call assert_equal("nñńņňṅṉ", tolower("NÑŃŅŇṄṈ")) + call assert_equal("oòóôõöøōŏőơǒǫǭỏ", tolower("OÒÓÔÕÖØŌŎŐƠǑǪǬỎ")) + call assert_equal("pṕṗ", tolower("PṔṖ")) + call assert_equal("q", tolower("Q")) + call assert_equal("rŕŗřṙṟ", tolower("RŔŖŘṘṞ")) + call assert_equal("sśŝşšṡ", tolower("SŚŜŞŠṠ")) + call assert_equal("tţťŧṫṯ", tolower("TŢŤŦṪṮ")) + call assert_equal("uùúûüũūŭůűųưǔủ", tolower("UÙÚÛÜŨŪŬŮŰŲƯǓỦ")) + call assert_equal("vṽ", tolower("VṼ")) + call assert_equal("wŵẁẃẅẇ", tolower("WŴẀẂẄẆ")) + call assert_equal("xẋẍ", tolower("XẊẌ")) + call assert_equal("yýŷÿẏỳỷỹ", tolower("YÝŶŸẎỲỶỸ")) + call assert_equal("zźżžƶẑẕ", tolower("ZŹŻŽƵẐẔ")) + + " Test with a few lowercase diacritics, which should remain unchanged. + call assert_equal("aàáâãäåāăąǎǟǡả", tolower("aàáâãäåāăąǎǟǡả")) + call assert_equal("bḃḇ", tolower("bḃḇ")) + call assert_equal("cçćĉċč", tolower("cçćĉċč")) + call assert_equal("dďđḋḏḑ", tolower("dďđḋḏḑ")) + call assert_equal("eèéêëēĕėęěẻẽ", tolower("eèéêëēĕėęěẻẽ")) + call assert_equal("fḟ", tolower("fḟ")) + call assert_equal("gĝğġģǥǧǵḡ", tolower("gĝğġģǥǧǵḡ")) + call assert_equal("hĥħḣḧḩẖ", tolower("hĥħḣḧḩẖ")) + call assert_equal("iìíîïĩīĭįǐỉ", tolower("iìíîïĩīĭįǐỉ")) + call assert_equal("jĵǰ", tolower("jĵǰ")) + call assert_equal("kķǩḱḵ", tolower("kķǩḱḵ")) + call assert_equal("lĺļľŀłḻ", tolower("lĺļľŀłḻ")) + call assert_equal("mḿṁ ", tolower("mḿṁ ")) + call assert_equal("nñńņňʼnṅṉ", tolower("nñńņňʼnṅṉ")) + call assert_equal("oòóôõöøōŏőơǒǫǭỏ", tolower("oòóôõöøōŏőơǒǫǭỏ")) + call assert_equal("pṕṗ", tolower("pṕṗ")) + call assert_equal("q", tolower("q")) + call assert_equal("rŕŗřṙṟ", tolower("rŕŗřṙṟ")) + call assert_equal("sśŝşšṡ", tolower("sśŝşšṡ")) + call assert_equal("tţťŧṫṯẗ", tolower("tţťŧṫṯẗ")) + call assert_equal("uùúûüũūŭůűųưǔủ", tolower("uùúûüũūŭůűųưǔủ")) + call assert_equal("vṽ", tolower("vṽ")) + call assert_equal("wŵẁẃẅẇẘ", tolower("wŵẁẃẅẇẘ")) + call assert_equal("ẋẍ", tolower("ẋẍ")) + call assert_equal("yýÿŷẏẙỳỷỹ", tolower("yýÿŷẏẙỳỷỹ")) + call assert_equal("zźżžƶẑẕ", tolower("zźżžƶẑẕ")) + + " According to https://twitter.com/jifa/status/625776454479970304 + " Ⱥ (U+023A) and Ⱦ (U+023E) are the *only* code points to increase + " in length (2 to 3 bytes) when lowercased. So let's test them. + call assert_equal("ⱥ ⱦ", tolower("Ⱥ Ⱦ")) +endfunc + +func Test_toupper() + call assert_equal("", toupper("")) + + " Test with all printable ASCII characters. + call assert_equal(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~', + \ toupper(' !"#$%&''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~')) + + if !has('multi_byte') + return + endif + + " Test with a few lowercase diacritics. + call assert_equal("AÀÁÂÃÄÅĀĂĄǍǞǠẢ", toupper("aàáâãäåāăąǎǟǡả")) + call assert_equal("BḂḆ", toupper("bḃḇ")) + call assert_equal("CÇĆĈĊČ", toupper("cçćĉċč")) + call assert_equal("DĎĐḊḎḐ", toupper("dďđḋḏḑ")) + call assert_equal("EÈÉÊËĒĔĖĘĚẺẼ", toupper("eèéêëēĕėęěẻẽ")) + call assert_equal("FḞ", toupper("fḟ")) + call assert_equal("GĜĞĠĢǤǦǴḠ", toupper("gĝğġģǥǧǵḡ")) + call assert_equal("HĤĦḢḦḨẖ", toupper("hĥħḣḧḩẖ")) + call assert_equal("IÌÍÎÏĨĪĬĮǏỈ", toupper("iìíîïĩīĭįǐỉ")) + call assert_equal("JĴǰ", toupper("jĵǰ")) + call assert_equal("KĶǨḰḴ", toupper("kķǩḱḵ")) + call assert_equal("LĹĻĽĿŁḺ", toupper("lĺļľŀłḻ")) + call assert_equal("MḾṀ ", toupper("mḿṁ ")) + call assert_equal("NÑŃŅŇʼnṄṈ", toupper("nñńņňʼnṅṉ")) + call assert_equal("OÒÓÔÕÖØŌŎŐƠǑǪǬỎ", toupper("oòóôõöøōŏőơǒǫǭỏ")) + call assert_equal("PṔṖ", toupper("pṕṗ")) + call assert_equal("Q", toupper("q")) + call assert_equal("RŔŖŘṘṞ", toupper("rŕŗřṙṟ")) + call assert_equal("SŚŜŞŠṠ", toupper("sśŝşšṡ")) + call assert_equal("TŢŤŦṪṮẗ", toupper("tţťŧṫṯẗ")) + call assert_equal("UÙÚÛÜŨŪŬŮŰŲƯǓỦ", toupper("uùúûüũūŭůűųưǔủ")) + call assert_equal("VṼ", toupper("vṽ")) + call assert_equal("WŴẀẂẄẆẘ", toupper("wŵẁẃẅẇẘ")) + call assert_equal("ẊẌ", toupper("ẋẍ")) + call assert_equal("YÝŸŶẎẙỲỶỸ", toupper("yýÿŷẏẙỳỷỹ")) + call assert_equal("ZŹŻŽƵẐẔ", toupper("zźżžƶẑẕ")) + + " Test that uppercase diacritics, which should remain unchanged. + call assert_equal("AÀÁÂÃÄÅĀĂĄǍǞǠẢ", toupper("AÀÁÂÃÄÅĀĂĄǍǞǠẢ")) + call assert_equal("BḂḆ", toupper("BḂḆ")) + call assert_equal("CÇĆĈĊČ", toupper("CÇĆĈĊČ")) + call assert_equal("DĎĐḊḎḐ", toupper("DĎĐḊḎḐ")) + call assert_equal("EÈÉÊËĒĔĖĘĚẺẼ", toupper("EÈÉÊËĒĔĖĘĚẺẼ")) + call assert_equal("FḞ ", toupper("FḞ ")) + call assert_equal("GĜĞĠĢǤǦǴḠ", toupper("GĜĞĠĢǤǦǴḠ")) + call assert_equal("HĤĦḢḦḨ", toupper("HĤĦḢḦḨ")) + call assert_equal("IÌÍÎÏĨĪĬĮİǏỈ", toupper("IÌÍÎÏĨĪĬĮİǏỈ")) + call assert_equal("JĴ", toupper("JĴ")) + call assert_equal("KĶǨḰḴ", toupper("KĶǨḰḴ")) + call assert_equal("LĹĻĽĿŁḺ", toupper("LĹĻĽĿŁḺ")) + call assert_equal("MḾṀ", toupper("MḾṀ")) + call assert_equal("NÑŃŅŇṄṈ", toupper("NÑŃŅŇṄṈ")) + call assert_equal("OÒÓÔÕÖØŌŎŐƠǑǪǬỎ", toupper("OÒÓÔÕÖØŌŎŐƠǑǪǬỎ")) + call assert_equal("PṔṖ", toupper("PṔṖ")) + call assert_equal("Q", toupper("Q")) + call assert_equal("RŔŖŘṘṞ", toupper("RŔŖŘṘṞ")) + call assert_equal("SŚŜŞŠṠ", toupper("SŚŜŞŠṠ")) + call assert_equal("TŢŤŦṪṮ", toupper("TŢŤŦṪṮ")) + call assert_equal("UÙÚÛÜŨŪŬŮŰŲƯǓỦ", toupper("UÙÚÛÜŨŪŬŮŰŲƯǓỦ")) + call assert_equal("VṼ", toupper("VṼ")) + call assert_equal("WŴẀẂẄẆ", toupper("WŴẀẂẄẆ")) + call assert_equal("XẊẌ", toupper("XẊẌ")) + call assert_equal("YÝŶŸẎỲỶỸ", toupper("YÝŶŸẎỲỶỸ")) + call assert_equal("ZŹŻŽƵẐẔ", toupper("ZŹŻŽƵẐẔ")) + + call assert_equal("ⱥ ⱦ", tolower("Ⱥ Ⱦ")) +endfunc + + -- cgit From acc06b0b7b99925d7567d2e79c2f5e88434edae8 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sun, 9 Apr 2017 09:40:12 +0200 Subject: vim-patch:8.0.0552 Problem: Toupper and tolower don't work properly for Turkish when 'casemap' is empty. (Bjorn Linse) Solution: Check the 'casemap' options when deciding how to upper/lower case. https://github.com/vim/vim/commit/3317d5ebbe8304da82b8088446060afcae0012af vim-patch:8.0.0553 Problem: Toupper/tolower test with Turkish locale fails on Mac. Solution: Skip the test on Mac. https://github.com/vim/vim/commit/9f4de1f5435b900e43e19766da1a5bed4686cf44 vim-patch:8.0.0554 Problem: Toupper and tolower don't work properly for Turkish when 'casemap' contains "keepascii". (Bjorn Linse) Solution: When 'casemap' contains "keepascii" use ASCII toupper/tolower. https://github.com/vim/vim/commit/1cc482069a3407132aeb43a55d6dc284153e79c7 vim-patch:8.0.0555 Problem: Toupper/tolower test fails on OSX without Darwin. Solution: Skip that part of the test also for OSX. (Kazunobu Kuriyama) https://github.com/vim/vim/commit/d2381a2cadb9ef359ad5efb916734c635b29bd13 --- src/nvim/testdir/test_normal.vim | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src') diff --git a/src/nvim/testdir/test_normal.vim b/src/nvim/testdir/test_normal.vim index a22dca35cc..c529971528 100644 --- a/src/nvim/testdir/test_normal.vim +++ b/src/nvim/testdir/test_normal.vim @@ -1606,6 +1606,40 @@ fun! Test_normal30_changecase() norm! V~ call assert_equal('THIS IS A simple test: äüöss', getline('.')) + " Turkish ASCII turns to multi-byte. On Mac the Turkish locale is available + " but toupper()/tolower() don't do the right thing. + if !has('mac') && !has('osx') + try + lang tr_TR.UTF-8 + set casemap= + call setline(1, 'iI') + 1normal gUU + call assert_equal("\u0130I", getline(1)) + call assert_equal("\u0130I", toupper("iI")) + + call setline(1, 'iI') + 1normal guu + call assert_equal("i\u0131", getline(1)) + call assert_equal("i\u0131", tolower("iI")) + + set casemap& + call setline(1, 'iI') + 1normal gUU + call assert_equal("II", getline(1)) + call assert_equal("II", toupper("iI")) + + call setline(1, 'iI') + 1normal guu + call assert_equal("ii", getline(1)) + call assert_equal("ii", tolower("iI")) + + lang en_US.UTF-8 + catch /E197:/ + " can't use Turkish locale + throw 'Skipped: Turkish locale not available' + endtry + endif + " clean up bw! endfunc -- cgit From c1cf03398143f4dc0ac9155988edad349d24deca Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sun, 9 Apr 2017 10:08:26 +0200 Subject: lint: fix clint errors around mb_tolower calls --- src/nvim/edit.c | 3 ++- src/nvim/eval.c | 6 ++++-- src/nvim/mbyte.c | 14 +++++--------- src/nvim/message.c | 2 +- src/nvim/ops.c | 17 ++++++++++------- src/nvim/path.c | 2 +- src/nvim/regexp.c | 17 ++++++++++------- src/nvim/regexp_nfa.c | 14 +++++++++----- src/nvim/search.c | 25 ++++++++++++++----------- src/nvim/spell.c | 44 ++++++++++++-------------------------------- 10 files changed, 68 insertions(+), 76 deletions(-) (limited to 'src') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index aa254b0577..fe00027dec 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -2303,8 +2303,9 @@ static void ins_compl_longest_match(compl_T *match) c2 = *s; } if (match->cp_icase ? (mb_tolower(c1) != mb_tolower(c2)) - : (c1 != c2)) + : (c1 != c2)) { break; + } if (has_mbyte) { mb_ptr_adv(p); mb_ptr_adv(s); diff --git a/src/nvim/eval.c b/src/nvim/eval.c index ed07de51c8..0663e19b9a 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -16792,7 +16792,8 @@ void timer_teardown(void) static void f_tolower(typval_T *argvars, typval_T *rettv, FunPtr fptr) { rettv->v_type = VAR_STRING; - rettv->vval.v_string = (char_u *)strcase_save(tv_get_string(&argvars[0]), false); + rettv->vval.v_string = (char_u *)strcase_save(tv_get_string(&argvars[0]), + false); } /* @@ -16801,7 +16802,8 @@ static void f_tolower(typval_T *argvars, typval_T *rettv, FunPtr fptr) static void f_toupper(typval_T *argvars, typval_T *rettv, FunPtr fptr) { rettv->v_type = VAR_STRING; - rettv->vval.v_string = (char_u *)strcase_save(tv_get_string(&argvars[0]), true); + rettv->vval.v_string = (char_u *)strcase_save(tv_get_string(&argvars[0]), + true); } /* diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index 5f5abbeac5..b18459a2b5 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -1179,10 +1179,8 @@ int utf_fold(int a) // invalid values or can't handle latin1 when the locale is C. // Speed is most important here. -/* - * Return the upper-case equivalent of "a", which is a UCS-4 character. Use - * simple case folding. - */ +/// Return the upper-case equivalent of "a", which is a UCS-4 character. Use +/// simple case folding. int mb_toupper(int a) { /* If 'casemap' contains "keepascii" use ASCII style toupper(). */ @@ -1205,14 +1203,12 @@ int mb_toupper(int a) bool mb_islower(int a) { - /* German sharp s is lower case but has no upper case equivalent. */ + // German sharp s is lower case but has no upper case equivalent. return (mb_toupper(a) != a) || a == 0xdf; } -/* - * Return the lower-case equivalent of "a", which is a UCS-4 character. Use - * simple case folding. - */ +/// Return the lower-case equivalent of "a", which is a UCS-4 character. Use +/// simple case folding. int mb_tolower(int a) { /* If 'casemap' contains "keepascii" use ASCII style tolower(). */ diff --git a/src/nvim/message.c b/src/nvim/message.c index 2cc426cf42..3e4a1e10b6 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -2730,7 +2730,7 @@ do_dialog ( break; } - /* Make the character lowercase, as chars in "hotkeys" are. */ + // Make the character lowercase, as chars in "hotkeys" are. c = mb_tolower(c); retval = 1; for (i = 0; hotkeys[i]; ++i) { diff --git a/src/nvim/ops.c b/src/nvim/ops.c index c5b7e65983..f11d6b69b2 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -1957,15 +1957,17 @@ int swapchar(int op_type, pos_T *pos) return FALSE; nc = c; if (mb_islower(c)) { - if (op_type == OP_ROT13) + if (op_type == OP_ROT13) { nc = ROT13(c, 'a'); - else if (op_type != OP_LOWER) + } else if (op_type != OP_LOWER) { nc = mb_toupper(c); + } } else if (mb_isupper(c)) { - if (op_type == OP_ROT13) + if (op_type == OP_ROT13) { nc = ROT13(c, 'A'); - else if (op_type != OP_UPPER) + } else if (op_type != OP_UPPER) { nc = mb_tolower(c); + } } if (nc != c) { if (enc_utf8 && (c >= 0x80 || nc >= 0x80)) { @@ -3328,9 +3330,10 @@ void ex_display(exarg_T *eap) get_clipboard(name, &yb, true); if (name == mb_tolower(redir_reg) - || (redir_reg == '"' && yb == y_previous)) - continue; /* do not list register being written to, the - * pointer can be freed */ + || (redir_reg == '"' && yb == y_previous)) { + continue; // do not list register being written to, the + // pointer can be freed + } if (yb->y_array != NULL) { msg_putchar('\n'); diff --git a/src/nvim/path.c b/src/nvim/path.c index 781522f63f..205fc2ed62 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -1865,7 +1865,7 @@ int pathcmp(const char *p, const char *q, int maxlen) if (vim_ispathsep(c2)) return 1; return p_fic ? mb_toupper(c1) - mb_toupper(c2) - : c1 - c2; /* no match */ + : c1 - c2; // no match } i += MB_PTR2LEN((char_u *)p + i); diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 7e2fc261f2..4b5e17b00b 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -4573,12 +4573,14 @@ regmatch ( if (OP(next) == EXACTLY) { rst.nextb = *OPERAND(next); if (ireg_ic) { - if (mb_isupper(rst.nextb)) + if (mb_isupper(rst.nextb)) { rst.nextb_ic = mb_tolower(rst.nextb); - else + } else { rst.nextb_ic = mb_toupper(rst.nextb); - } else + } + } else { rst.nextb_ic = rst.nextb; + } } else { rst.nextb = NUL; rst.nextb_ic = NUL; @@ -6312,14 +6314,15 @@ static char_u *cstrchr(char_u *s, int c) /* tolower() and toupper() can be slow, comparing twice should be a lot * faster (esp. when using MS Visual C++!). * For UTF-8 need to use folded case. */ - if (enc_utf8 && c > 0x80) + if (c > 0x80) { cc = utf_fold(c); - else if (mb_isupper(c)) + } else if (mb_isupper(c)) { cc = mb_tolower(c); - else if (mb_islower(c)) + } else if (mb_islower(c)) { cc = mb_toupper(c); - else + } else { return vim_strchr(s, c); + } if (has_mbyte) { for (p = s; *p != NUL; p += (*mb_ptr2len)(p)) { diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index 1d57595cbe..caf26fdd35 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -4391,8 +4391,9 @@ static int check_char_class(int class, int c) return OK; break; case NFA_CLASS_UPPER: - if (mb_isupper(c)) + if (mb_isupper(c)) { return OK; + } break; case NFA_CLASS_XDIGIT: if (ascii_isxdigit(c)) @@ -5586,16 +5587,18 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, } if (ireg_ic) { int curc_low = mb_tolower(curc); - int done = FALSE; + int done = false; - for (; c1 <= c2; ++c1) + for (; c1 <= c2; c1++) { if (mb_tolower(c1) == curc_low) { result = result_if_matched; done = TRUE; break; } - if (done) + } + if (done) { break; + } } } else if (state->c < 0 ? check_char_class(state->c, curc) : (curc == state->c @@ -6003,8 +6006,9 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, #endif result = (c == curc); - if (!result && ireg_ic) + if (!result && ireg_ic) { result = mb_tolower(c) == mb_tolower(curc); + } // If ireg_icombine is not set only skip over the character // itself. When it is set skip over composing characters. diff --git a/src/nvim/search.c b/src/nvim/search.c index 4f060b2b8b..91a558045f 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -335,23 +335,26 @@ int pat_has_uppercase(char_u *pat) while (*p != NUL) { int l; - if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) { - if (enc_utf8 && mb_isupper(utf_ptr2char(p))) - return TRUE; + if ((l = mb_ptr2len(p)) > 1) { + if (mb_isupper(utf_ptr2char(p))) { + return true; + } p += l; } else if (*p == '\\') { - if (p[1] == '_' && p[2] != NUL) /* skip "\_X" */ + if (p[1] == '_' && p[2] != NUL) { // skip "\_X" p += 3; - else if (p[1] == '%' && p[2] != NUL) /* skip "\%X" */ + } else if (p[1] == '%' && p[2] != NUL) { // skip "\%X" p += 3; - else if (p[1] != NUL) /* skip "\X" */ + } else if (p[1] != NUL) { // skip "\X" p += 2; - else + } else { p += 1; - } else if (mb_isupper(*p)) - return TRUE; - else - ++p; + } + } else if (mb_isupper(*p)) { + return true; + } else { + p++; + } } return FALSE; } diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 99661d0ef5..18febda1d8 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -2526,8 +2526,7 @@ void clear_spell_chartab(spelltab_T *sp) } } -// Init the chartab used for spelling. Only depends on 'encoding'. -// Called once while starting up and when 'encoding' changes. +// Init the chartab used for spelling. Called once while starting up. // The default is to use isalpha(), but the spell file should define the word // characters to make it possible that 'encoding' differs from the current // locale. For utf-8 we don't use isalpha() but our own functions. @@ -2537,36 +2536,17 @@ void init_spell_chartab(void) did_set_spelltab = false; clear_spell_chartab(&spelltab); - if (enc_dbcs) { - // DBCS: assume double-wide characters are word characters. - for (i = 128; i <= 255; ++i) - if (MB_BYTE2LEN(i) == 2) - spelltab.st_isw[i] = true; - } else if (enc_utf8) { - for (i = 128; i < 256; ++i) { - int f = utf_fold(i); - int u = mb_toupper(i); - - spelltab.st_isu[i] = mb_isupper(i); - spelltab.st_isw[i] = spelltab.st_isu[i] || mb_islower(i); - // The folded/upper-cased value is different between latin1 and - // utf8 for 0xb5, causing E763 for no good reason. Use the latin1 - // value for utf-8 to avoid this. - spelltab.st_fold[i] = (f < 256) ? f : i; - spelltab.st_upper[i] = (u < 256) ? u : i; - } - } else { - // Rough guess: use locale-dependent library functions. - for (i = 128; i < 256; ++i) { - if (mb_isupper(i)) { - spelltab.st_isw[i] = true; - spelltab.st_isu[i] = true; - spelltab.st_fold[i] = mb_tolower(i); - } else if (mb_islower(i)) { - spelltab.st_isw[i] = true; - spelltab.st_upper[i] = mb_toupper(i); - } - } + for (i = 128; i < 256; i++) { + int f = utf_fold(i); + int u = mb_toupper(i); + + spelltab.st_isu[i] = mb_isupper(i); + spelltab.st_isw[i] = spelltab.st_isu[i] || mb_islower(i); + // The folded/upper-cased value is different between latin1 and + // utf8 for 0xb5, causing E763 for no good reason. Use the latin1 + // value for utf-8 to avoid this. + spelltab.st_fold[i] = (f < 256) ? f : i; + spelltab.st_upper[i] = (u < 256) ? u : i; } } -- cgit From 4a63d9e5f88feb16ec513b8dba1f8d02bd2ff4d6 Mon Sep 17 00:00:00 2001 From: erw7 Date: Sun, 9 Apr 2017 12:31:54 +0900 Subject: win: mch_open_rw: specify S_IWRITE #6487 On Windows, `mch_open_rw` is not actually doing what it claims. This manifests as "E301: Oops, lost the swap file !!!" when filename is changed with :file {name}. Steps to reproduce (covered by test/functional/ex_cmds/file_spec.lua): nvim -u NONE :edit test :file test2 E301 Oops, lost the swap file!!! From libuv/src/win/fs.c: void fs__open(uv_fs_t* req) { ... attributes |= FILE_ATTRIBUTE_NORMAL; if (flags & _O_CREAT) { if (!((req->fs.info.mode & ~current_umask) & _S_IWRITE)) { attributes |= FILE_ATTRIBUTE_READONLY; } } --- src/nvim/macros.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/macros.h b/src/nvim/macros.h index 22fd48de9d..9131f8be84 100644 --- a/src/nvim/macros.h +++ b/src/nvim/macros.h @@ -120,8 +120,10 @@ /* mch_open_rw(): invoke os_open() with third argument for user R/W. */ #if defined(UNIX) /* open in rw------- mode */ # define mch_open_rw(n, f) os_open((n), (f), (mode_t)0600) +#elif defined(WIN32) +# define mch_open_rw(n, f) os_open((n), (f), S_IREAD | S_IWRITE) #else -# define mch_open_rw(n, f) os_open((n), (f), 0) +# define mch_open_rw(n, f) os_open((n), (f), 0) #endif # define REPLACE_NORMAL(s) (((s) & REPLACE_FLAG) && !((s) & VREPLACE_FLAG)) -- cgit From 2d72d85b23761383ac7838faed2f7b53bdce8817 Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Carvalho Date: Tue, 11 Apr 2017 22:44:48 +0200 Subject: refactor: pos_T macros to functions (#6496) --- src/nvim/charset.c | 3 ++- src/nvim/ex_getln.c | 1 + src/nvim/indent.c | 3 ++- src/nvim/indent_c.c | 1 + src/nvim/macros.h | 19 ------------------- src/nvim/mark.h | 40 ++++++++++++++++++++++++++++++++++++++++ src/nvim/screen.c | 1 + src/nvim/spell.c | 1 + 8 files changed, 48 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/nvim/charset.c b/src/nvim/charset.c index 645139f696..3037cfe669 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -15,6 +15,7 @@ #include "nvim/func_attr.h" #include "nvim/indent.h" #include "nvim/main.h" +#include "nvim/mark.h" #include "nvim/mbyte.h" #include "nvim/memline.h" #include "nvim/memory.h" @@ -1366,7 +1367,7 @@ void getvcols(win_T *wp, pos_T *pos1, pos_T *pos2, colnr_T *left, colnr_T to1; colnr_T to2; - if (ltp(pos1, pos2)) { + if (lt(*pos1, *pos2)) { getvvcol(wp, pos1, &from1, NULL, &to1); getvvcol(wp, pos2, &from2, NULL, &to2); } else { diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 9d74f554ba..0b6036ace9 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -30,6 +30,7 @@ #include "nvim/if_cscope.h" #include "nvim/indent.h" #include "nvim/main.h" +#include "nvim/mark.h" #include "nvim/mbyte.h" #include "nvim/memline.h" #include "nvim/menu.h" diff --git a/src/nvim/indent.c b/src/nvim/indent.c index 7f31bb8c5c..8fbad38495 100644 --- a/src/nvim/indent.c +++ b/src/nvim/indent.c @@ -7,6 +7,7 @@ #include "nvim/eval.h" #include "nvim/charset.h" #include "nvim/cursor.h" +#include "nvim/mark.h" #include "nvim/memline.h" #include "nvim/memory.h" #include "nvim/misc1.h" @@ -598,7 +599,7 @@ int get_lisp_indent(void) paren = *pos; pos = findmatch(NULL, '['); - if ((pos == NULL) || ltp(pos, &paren)) { + if ((pos == NULL) || lt(*pos, paren)) { pos = &paren; } } diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c index 4a73fbaf61..8f5547544d 100644 --- a/src/nvim/indent_c.c +++ b/src/nvim/indent_c.c @@ -10,6 +10,7 @@ #include "nvim/edit.h" #include "nvim/indent.h" #include "nvim/indent_c.h" +#include "nvim/mark.h" #include "nvim/memline.h" #include "nvim/memory.h" #include "nvim/option.h" diff --git a/src/nvim/macros.h b/src/nvim/macros.h index 9131f8be84..b816b34b39 100644 --- a/src/nvim/macros.h +++ b/src/nvim/macros.h @@ -28,25 +28,6 @@ /// @return `s, sizeof(s) - 1` #define S_LEN(s) (s), (sizeof(s) - 1) -/* - * Position comparisons - */ -# define lt(a, b) (((a).lnum != (b).lnum) \ - ? (a).lnum < (b).lnum \ - : (a).col != (b).col \ - ? (a).col < (b).col \ - : (a).coladd < (b).coladd) -# define ltp(a, b) (((a)->lnum != (b)->lnum) \ - ? (a)->lnum < (b)->lnum \ - : (a)->col != (b)->col \ - ? (a)->col < (b)->col \ - : (a)->coladd < (b)->coladd) -# define equalpos(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col) && \ - ((a).coladd == (b).coladd)) -# define clearpos(a) {(a)->lnum = 0; (a)->col = 0; (a)->coladd = 0; } - -#define ltoreq(a, b) (lt(a, b) || equalpos(a, b)) - /* * lineempty() - return TRUE if the line is empty */ diff --git a/src/nvim/mark.h b/src/nvim/mark.h index c22a102926..a356c1f398 100644 --- a/src/nvim/mark.h +++ b/src/nvim/mark.h @@ -4,6 +4,7 @@ #include "nvim/macros.h" #include "nvim/ascii.h" #include "nvim/buffer_defs.h" +#include "nvim/func_attr.h" #include "nvim/mark_defs.h" #include "nvim/memory.h" #include "nvim/pos.h" @@ -75,6 +76,45 @@ static inline int mark_local_index(const char name) : -1)))); } +static inline bool lt(pos_T, pos_T) REAL_FATTR_CONST REAL_FATTR_ALWAYS_INLINE; +static inline bool equalpos(pos_T, pos_T) + REAL_FATTR_CONST REAL_FATTR_ALWAYS_INLINE; +static inline bool ltoreq(pos_T, pos_T) + REAL_FATTR_CONST REAL_FATTR_ALWAYS_INLINE; +static inline void clearpos(pos_T *) REAL_FATTR_ALWAYS_INLINE; + +/// Return true if position a is before (less than) position b. +static inline bool lt(pos_T a, pos_T b) +{ + if (a.lnum != b.lnum) { + return a.lnum < b.lnum; + } else if (a.col != b.col) { + return a.col < b.col; + } else { + return a.coladd < b.coladd; + } +} + +/// Return true if position a and b are equal. +static inline bool equalpos(pos_T a, pos_T b) +{ + return (a.lnum == b.lnum) && (a.col == b.col) && (a.coladd == b.coladd); +} + +/// Return true if position a is less than or equal to b. +static inline bool ltoreq(pos_T a, pos_T b) +{ + return lt(a, b) || equalpos(a, b); +} + +/// Clear the pos_T structure pointed to by a. +static inline void clearpos(pos_T *a) +{ + a->lnum = 0; + a->col = 0; + a->coladd = 0; +} + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "mark.h.generated.h" #endif diff --git a/src/nvim/screen.c b/src/nvim/screen.c index d9a21aa81f..febca105e9 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -102,6 +102,7 @@ #include "nvim/indent.h" #include "nvim/getchar.h" #include "nvim/main.h" +#include "nvim/mark.h" #include "nvim/mbyte.h" #include "nvim/memline.h" #include "nvim/memory.h" diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 18febda1d8..17016be35f 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -92,6 +92,7 @@ #include "nvim/func_attr.h" #include "nvim/getchar.h" #include "nvim/hashtab.h" +#include "nvim/mark.h" #include "nvim/mbyte.h" #include "nvim/memline.h" #include "nvim/memory.h" -- cgit From d6e5f94ae945308d96be414c9c1fb3f0ae71355e Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 24 Mar 2017 02:54:50 +0100 Subject: win: defaults: 'shellredir', 'shellxquote', 'shellxescape' --- src/nvim/misc1.c | 6 +++--- src/nvim/options.lua | 18 +++++++++++++++--- src/nvim/os/shell.c | 2 -- 3 files changed, 18 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 0b74b4437e..8d93505be3 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -2678,7 +2678,8 @@ void fast_breakcheck(void) } } -// Call shell. Calls os_call_shell, with 'shellxquote' added. +// os_call_shell wrapper. Handles 'verbose', :profile, and v:shell_error. +// Invalidates cached tags. int call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg) { int retval; @@ -2686,8 +2687,7 @@ int call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg) if (p_verbose > 3) { verbose_enter(); - smsg(_("Calling shell to execute: \"%s\""), - cmd == NULL ? p_sh : cmd); + smsg(_("Calling shell to execute: \"%s\""), cmd == NULL ? p_sh : cmd); ui_putc('\n'); verbose_leave(); } diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 4ca63f2efe..774c39808f 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -2051,7 +2051,11 @@ return { secure=true, vi_def=true, varname='p_srr', - defaults={if_true={vi=">"}} + defaults={ + condition='WIN32', + if_true={vi=">%s 2>&1"}, + if_false={vi=">"} + } }, { full_name='shellslash', abbreviation='ssl', @@ -2073,7 +2077,11 @@ return { secure=true, vi_def=true, varname='p_sxq', - defaults={if_true={vi=""}} + defaults={ + condition='WIN32', + if_true={vi="("}, + if_false={vi=""} + } }, { full_name='shellxescape', abbreviation='sxe', @@ -2081,7 +2089,11 @@ return { secure=true, vi_def=true, varname='p_sxe', - defaults={if_true={vi=""}} + defaults={ + condition='WIN32', + if_true={vi='"&|<>()@^'}, + if_false={vi=""} + } }, { full_name='shiftround', abbreviation='sr', diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index b449cc3d5a..5cc9d4b79b 100644 --- a/src/nvim/os/shell.c +++ b/src/nvim/os/shell.c @@ -124,11 +124,9 @@ int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_args) } size_t nread; - int exitcode = do_os_system(shell_build_argv((char *)cmd, (char *)extra_args), input.data, input.len, output_ptr, &nread, emsg_silent, forward_output); - xfree(input.data); if (output) { -- cgit From f7611d74e73329a4192666ff59911ff214f462ab Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 24 Mar 2017 14:42:42 +0100 Subject: win: vim_strsave_shellescape: Handle 'shellslash'. From Vim, misc2.c:vim_strsave_shellescape --- src/nvim/strings.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/strings.c b/src/nvim/strings.c index 87e066d80a..8a1a3beddd 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -198,8 +198,16 @@ char_u *vim_strsave_shellescape(const char_u *string, /* First count the number of extra bytes required. */ size_t length = STRLEN(string) + 3; // two quotes and a trailing NUL for (const char_u *p = string; *p != NUL; mb_ptr_adv(p)) { - if (*p == '\'') - length += 3; /* ' => '\'' */ +#ifdef WIN32 + if (!p_ssl) { + if (*p == '"') { + length++; // " -> "" + } + } else +#endif + if (*p == '\'') { + length += 3; // ' => '\'' + } if ((*p == '\n' && (csh_like || do_newline)) || (*p == '!' && (csh_like || do_special))) { ++length; /* insert backslash */ @@ -216,10 +224,25 @@ char_u *vim_strsave_shellescape(const char_u *string, escaped_string = xmalloc(length); d = escaped_string; - /* add opening quote */ + // add opening quote +#ifdef WIN32 + if (!p_ssl) { + *d++ = '"'; + } else +#endif *d++ = '\''; for (const char_u *p = string; *p != NUL; ) { +#ifdef WIN32 + if (!p_ssl) { + if (*p == '"') { + *d++ = '"'; + *d++ = '"'; + p++; + continue; + } + } else +#endif if (*p == '\'') { *d++ = '\''; *d++ = '\\'; @@ -246,7 +269,12 @@ char_u *vim_strsave_shellescape(const char_u *string, MB_COPY_CHAR(p, d); } - /* add terminating quote and finish with a NUL */ + // add terminating quote and finish with a NUL +# ifdef WIN32 + if (!p_ssl) { + *d++ = '"'; + } else +# endif *d++ = '\''; *d = NUL; -- cgit From f3cc843755a6d638ada77dc31721aa53b3ff2364 Mon Sep 17 00:00:00 2001 From: Rui Abreu Ferreira Date: Tue, 28 Mar 2017 16:03:53 +0100 Subject: win: libuv_process_spawn(): special-case cmd.exe Disable CommandLineToArgvW-standard quoting for cmd.exe. libuv assumes spawned processes follow the convention expected by CommandLineToArgvW(). But cmd.exe is non-conformant, so for cmd.exe: - With system([]), the caller has full control (and responsibility) to quote arguments correctly. - With system(''), shell* options are used. libuv quoting is disabled if argv[0] is: - cmd.exe - cmd - $COMSPEC resolving to a path with filename cmd.exe Closes #6329 References #6387 --- src/nvim/event/libuv_process.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src') diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index 3da0c386b4..ab69bea04c 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -8,6 +8,8 @@ #include "nvim/event/process.h" #include "nvim/event/libuv_process.h" #include "nvim/log.h" +#include "nvim/path.h" +#include "nvim/os/os.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/libuv_process.c.generated.h" @@ -24,6 +26,26 @@ int libuv_process_spawn(LibuvProcess *uvproc) if (proc->detach) { uvproc->uvopts.flags |= UV_PROCESS_DETACHED; } +#ifdef WIN32 + // libuv assumes spawned processes follow the convention from + // CommandLineToArgvW(), cmd.exe does not. Disable quoting since it will + // result in unexpected behaviour, the caller is left with the responsibility + // to quote arguments accordingly. system('') has shell* options for this. + // + // Disable quoting for cmd, cmd.exe and $COMSPEC with a cmd.exe filename + bool is_cmd = STRICMP(proc->argv[0], "cmd.exe") == 0 + || STRICMP(proc->argv[0], "cmd") == 0; + if (!is_cmd) { + const char_u *comspec = (char_u *)os_getenv("COMSPEC"); + const char_u *comspecshell = path_tail((char_u *)proc->argv[0]); + is_cmd = comspec != NULL && STRICMP(proc->argv[0], comspec) == 0 + && STRICMP("cmd.exe", (char *)comspecshell) == 0; + } + + if (is_cmd) { + uvproc->uvopts.flags |= UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS; + } +#endif uvproc->uvopts.exit_cb = exit_cb; uvproc->uvopts.cwd = proc->cwd; uvproc->uvopts.env = NULL; -- cgit From d31d177a0c2c9997c2cdb04975bc3354b9a23fb8 Mon Sep 17 00:00:00 2001 From: Rui Abreu Ferreira Date: Thu, 30 Mar 2017 23:41:52 +0100 Subject: win: default shellxescape, shellxquote to empty Calling cmd.exe in Windows follows a very different pattern from Vim. The primary difference is that Vim does a nested call to cmd.exe, e.g. the following call in Vim system('echo a 2>&1') spawns the following processes "C:\Program Files (x86)\Vim\vim80\vimrun" -s C:\Windows\system32\cmd.exe /c (echo a 2^>^&1 ^>C:\Users\dummy\AppData\Local\Temp\VIoC169.tmp 2^>^&1) C:\Windows\system32\cmd.exe /c C:\Windows\system32\cmd.exe /c (echo a 2^>^&1 ^>C:\Users\dummy\AppData\Local\Temp\VIo3C6C.tmp 2^>^&1) C:\Windows\system32\cmd.exe /c (echo a 2>&1 >C:\Users\dummy\AppData\Local\Temp\VIo3C6C.tmp 2>&1) The escaping with ^ is needed because cmd.exe calls itself and needs to preserve the special metacharacters for the last call. However in nvim no nested call is made, system('') spawns a single cmd.exe process. Setting shellxescape to "" disables escaping with ^. The previous default for shellxquote=( wrapped any command in parenthesis, in Vim this is more meaningful due to the use of tempfiles to store the output and redirection (also see &shellquote). There is a slight benefit in having the default be empty because some expressions that run in console will not run within parens e.g. due to unbalanced double quotes system('echo "a b') --- src/nvim/options.lua | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 774c39808f..4e7be63b63 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -2077,11 +2077,7 @@ return { secure=true, vi_def=true, varname='p_sxq', - defaults={ - condition='WIN32', - if_true={vi="("}, - if_false={vi=""} - } + defaults={if_true={vi=""}} }, { full_name='shellxescape', abbreviation='sxe', @@ -2089,11 +2085,7 @@ return { secure=true, vi_def=true, varname='p_sxe', - defaults={ - condition='WIN32', - if_true={vi='"&|<>()@^'}, - if_false={vi=""} - } + defaults={if_true={vi=""}} }, { full_name='shiftround', abbreviation='sr', -- cgit From 7c4e5dfd2722b8c25641cbbc66c5b0133d0e2f03 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 12 Apr 2017 01:35:17 +0200 Subject: win: os_shell_is_cmdexe() + tests --- src/nvim/event/libuv_process.c | 20 +++----------------- src/nvim/memory.c | 7 +++++++ src/nvim/os/env.c | 22 ++++++++++++++++++---- 3 files changed, 28 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index ab69bea04c..f5a41d151b 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -8,7 +8,6 @@ #include "nvim/event/process.h" #include "nvim/event/libuv_process.h" #include "nvim/log.h" -#include "nvim/path.h" #include "nvim/os/os.h" #ifdef INCLUDE_GENERATED_DECLARATIONS @@ -27,22 +26,9 @@ int libuv_process_spawn(LibuvProcess *uvproc) uvproc->uvopts.flags |= UV_PROCESS_DETACHED; } #ifdef WIN32 - // libuv assumes spawned processes follow the convention from - // CommandLineToArgvW(), cmd.exe does not. Disable quoting since it will - // result in unexpected behaviour, the caller is left with the responsibility - // to quote arguments accordingly. system('') has shell* options for this. - // - // Disable quoting for cmd, cmd.exe and $COMSPEC with a cmd.exe filename - bool is_cmd = STRICMP(proc->argv[0], "cmd.exe") == 0 - || STRICMP(proc->argv[0], "cmd") == 0; - if (!is_cmd) { - const char_u *comspec = (char_u *)os_getenv("COMSPEC"); - const char_u *comspecshell = path_tail((char_u *)proc->argv[0]); - is_cmd = comspec != NULL && STRICMP(proc->argv[0], comspec) == 0 - && STRICMP("cmd.exe", (char *)comspecshell) == 0; - } - - if (is_cmd) { + // libuv collapses the argv to a CommandLineToArgvW()-style string. cmd.exe + // expects a different syntax (must be prepared by the caller before now). + if (os_shell_is_cmdexe(proc->argv[0])) { uvproc->uvopts.flags |= UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS; } #endif diff --git a/src/nvim/memory.c b/src/nvim/memory.c index b4fdd86a6d..85ec916ba0 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -495,6 +495,13 @@ bool strequal(const char *a, const char *b) return (a == NULL && b == NULL) || (a && b && strcmp(a, b) == 0); } +/// Case-insensitive `strequal`. +bool striequal(const char *a, const char *b) + FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT +{ + return (a == NULL && b == NULL) || (a && b && STRICMP(a, b) == 0); +} + /* * Avoid repeating the error message many times (they take 1 second each). * Did_outofmem_msg is reset when a character is read. diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index 12c2da6152..ad51e598c1 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -1,11 +1,8 @@ -// env.c -- environment variable access +// Environment inspection #include - #include -// vim.h must be included before charset.h (and possibly others) or things -// blow up #include "nvim/vim.h" #include "nvim/ascii.h" #include "nvim/charset.h" @@ -919,3 +916,20 @@ bool os_term_is_nice(void) || NULL != os_getenv("KONSOLE_DBUS_SESSION"); #endif } + +/// Returns true if `sh` looks like it resolves to "cmd.exe". +bool os_shell_is_cmdexe(const char *sh) + FUNC_ATTR_NONNULL_ALL +{ + if (*sh == NUL) { + return false; + } + if (striequal(sh, "$COMSPEC")) { + const char *comspec = os_getenv("COMSPEC"); + return striequal("cmd.exe", (char *)path_tail((char_u *)comspec)); + } + if (striequal(sh, "cmd.exe") || striequal(sh, "cmd")) { + return true; + } + return striequal("cmd.exe", (char *)path_tail((char_u *)sh)); +} -- cgit From 45b5ebea9ddf029b3453ab21d20ae41f32c8de97 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 14 Apr 2017 17:41:59 +0200 Subject: perf: tv_clear(): Cache gettext() result. (#6519) Closes #6437 --- src/nvim/eval/typval.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 779bb18175..eb6db9547b 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -1837,9 +1837,12 @@ static inline void _nothing_conv_dict_end(typval_T *const tv, /// @param[in,out] tv Value to free. void tv_clear(typval_T *const tv) { + static char *objname = NULL; // cached because gettext() is slow. #6437 + if (objname == NULL) { + objname = xstrdup(_("tv_clear() argument")); + } if (tv != NULL && tv->v_type != VAR_UNKNOWN) { - const int evn_ret = encode_vim_to_nothing(NULL, tv, - _("tv_clear() argument")); + const int evn_ret = encode_vim_to_nothing(NULL, tv, objname); (void)evn_ret; assert(evn_ret == OK); } -- cgit From b2942d1e729c4cfa8ec9d3bedcdc7ad838a689ef Mon Sep 17 00:00:00 2001 From: ZyX Date: Thu, 13 Apr 2017 19:16:32 +0300 Subject: eval: Change the point at which arg_errmsg and its length are changed Ref #6437 --- src/nvim/eval.c | 130 +++++++++++++++++++++++++++---------------------- src/nvim/eval/typval.c | 22 ++++++--- src/nvim/eval/typval.h | 11 +++++ 3 files changed, 98 insertions(+), 65 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 0663e19b9a..e81378bcaa 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -2378,9 +2378,9 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, &tv, &di, true, false) == OK) { if ((di == NULL || (!var_check_ro(di->di_flags, (const char *)lp->ll_name, - STRLEN(lp->ll_name)) + TV_CSTRING) && !tv_check_lock(di->di_tv.v_lock, (const char *)lp->ll_name, - STRLEN(lp->ll_name)))) + TV_CSTRING))) && eexe_mod_op(&tv, rettv, (const char *)op) == OK) { set_var(lp->ll_name, lp->ll_name_len, &tv, false); } @@ -2393,7 +2393,7 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, } else if (tv_check_lock(lp->ll_newkey == NULL ? lp->ll_tv->v_lock : lp->ll_tv->vval.v_dict->dv_lock, - (const char *)lp->ll_name, STRLEN(lp->ll_name))) { + (const char *)lp->ll_name, TV_CSTRING)) { } else if (lp->ll_range) { listitem_T *ll_li = lp->ll_li; int ll_n1 = lp->ll_n1; @@ -2402,7 +2402,7 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, for (listitem_T *ri = rettv->vval.v_list->lv_first; ri != NULL && ll_li != NULL; ) { if (tv_check_lock(ll_li->li_tv.v_lock, (const char *)lp->ll_name, - STRLEN(lp->ll_name))) { + TV_CSTRING)) { return; } ri = ri->li_next; @@ -2992,14 +2992,14 @@ int do_unlet(const char *const name, const size_t name_len, const int forceit) } if (hi != NULL && !HASHITEM_EMPTY(hi)) { dictitem_T *const di = TV_DICT_HI2DI(hi); - if (var_check_fixed(di->di_flags, (const char *)name, STRLEN(name)) - || var_check_ro(di->di_flags, (const char *)name, STRLEN(name)) - || tv_check_lock(d->dv_lock, (const char *)name, STRLEN(name))) { + if (var_check_fixed(di->di_flags, (const char *)name, TV_CSTRING) + || var_check_ro(di->di_flags, (const char *)name, TV_CSTRING) + || tv_check_lock(d->dv_lock, (const char *)name, TV_CSTRING)) { return FAIL; } if (d == NULL - || tv_check_lock(d->dv_lock, (const char *)name, STRLEN(name))) { + || tv_check_lock(d->dv_lock, (const char *)name, TV_CSTRING)) { return FAIL; } @@ -6553,10 +6553,8 @@ static void f_add(typval_T *argvars, typval_T *rettv, FunPtr fptr) rettv->vval.v_number = 1; /* Default: Failed */ if (argvars[0].v_type == VAR_LIST) { - const char *const arg_errmsg = _("add() argument"); - const size_t arg_errmsg_len = strlen(arg_errmsg); if ((l = argvars[0].vval.v_list) != NULL - && !tv_check_lock(l->lv_lock, arg_errmsg, arg_errmsg_len)) { + && !tv_check_lock(l->lv_lock, "add() argument", TV_TRANSLATE)) { tv_list_append_tv(l, &argvars[1]); tv_copy(&argvars[0], rettv); } @@ -8152,7 +8150,6 @@ static void f_expand(typval_T *argvars, typval_T *rettv, FunPtr fptr) static void f_extend(typval_T *argvars, typval_T *rettv, FunPtr fptr) { const char *const arg_errmsg = N_("extend() argument"); - const size_t arg_errmsg_len = strlen(arg_errmsg); if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_LIST) { long before; @@ -8161,13 +8158,13 @@ static void f_extend(typval_T *argvars, typval_T *rettv, FunPtr fptr) list_T *const l1 = argvars[0].vval.v_list; list_T *const l2 = argvars[1].vval.v_list; if (l1 == NULL) { - const bool locked = tv_check_lock(VAR_FIXED, arg_errmsg, arg_errmsg_len); + const bool locked = tv_check_lock(VAR_FIXED, arg_errmsg, TV_TRANSLATE); (void)locked; assert(locked == true); } else if (l2 == NULL) { // Do nothing tv_copy(&argvars[0], rettv); - } else if (!tv_check_lock(l1->lv_lock, arg_errmsg, arg_errmsg_len)) { + } else if (!tv_check_lock(l1->lv_lock, arg_errmsg, TV_TRANSLATE)) { listitem_T *item; if (argvars[2].v_type != VAR_UNKNOWN) { before = tv_get_number_chk(&argvars[2], &error); @@ -8195,13 +8192,13 @@ static void f_extend(typval_T *argvars, typval_T *rettv, FunPtr fptr) dict_T *const d1 = argvars[0].vval.v_dict; dict_T *const d2 = argvars[1].vval.v_dict; if (d1 == NULL) { - const bool locked = tv_check_lock(VAR_FIXED, arg_errmsg, arg_errmsg_len); + const bool locked = tv_check_lock(VAR_FIXED, arg_errmsg, TV_TRANSLATE); (void)locked; assert(locked == true); } else if (d2 == NULL) { // Do nothing tv_copy(&argvars[0], rettv); - } else if (!tv_check_lock(d1->dv_lock, arg_errmsg, arg_errmsg_len)) { + } else if (!tv_check_lock(d1->dv_lock, arg_errmsg, TV_TRANSLATE)) { const char *action = "force"; // Check the third argument. if (argvars[2].v_type != VAR_UNKNOWN) { @@ -8349,20 +8346,19 @@ static void filter_map(typval_T *argvars, typval_T *rettv, int map) int todo; char_u *ermsg = (char_u *)(map ? "map()" : "filter()"); const char *const arg_errmsg = (map - ? _("map() argument") - : _("filter() argument")); - const size_t arg_errmsg_len = strlen(arg_errmsg); + ? N_("map() argument") + : N_("filter() argument")); int save_did_emsg; int idx = 0; if (argvars[0].v_type == VAR_LIST) { if ((l = argvars[0].vval.v_list) == NULL - || (!map && tv_check_lock(l->lv_lock, arg_errmsg, arg_errmsg_len))) { + || (!map && tv_check_lock(l->lv_lock, arg_errmsg, TV_TRANSLATE))) { return; } } else if (argvars[0].v_type == VAR_DICT) { if ((d = argvars[0].vval.v_dict) == NULL - || (!map && tv_check_lock(d->dv_lock, arg_errmsg, arg_errmsg_len))) { + || (!map && tv_check_lock(d->dv_lock, arg_errmsg, TV_TRANSLATE))) { return; } } else { @@ -8395,8 +8391,8 @@ static void filter_map(typval_T *argvars, typval_T *rettv, int map) di = TV_DICT_HI2DI(hi); if (map - && (tv_check_lock(di->di_tv.v_lock, arg_errmsg, arg_errmsg_len) - || var_check_ro(di->di_flags, arg_errmsg, arg_errmsg_len))) { + && (tv_check_lock(di->di_tv.v_lock, arg_errmsg, TV_TRANSLATE) + || var_check_ro(di->di_flags, arg_errmsg, TV_TRANSLATE))) { break; } @@ -8407,8 +8403,8 @@ static void filter_map(typval_T *argvars, typval_T *rettv, int map) break; } if (!map && rem) { - if (var_check_fixed(di->di_flags, arg_errmsg, arg_errmsg_len) - || var_check_ro(di->di_flags, arg_errmsg, arg_errmsg_len)) { + if (var_check_fixed(di->di_flags, arg_errmsg, TV_TRANSLATE) + || var_check_ro(di->di_flags, arg_errmsg, TV_TRANSLATE)) { break; } tv_dict_item_remove(d, di); @@ -8421,7 +8417,7 @@ static void filter_map(typval_T *argvars, typval_T *rettv, int map) for (li = l->lv_first; li != NULL; li = nli) { if (map - && tv_check_lock(li->li_tv.v_lock, arg_errmsg, arg_errmsg_len)) { + && tv_check_lock(li->li_tv.v_lock, arg_errmsg, TV_TRANSLATE)) { break; } nli = li->li_next; @@ -11158,13 +11154,12 @@ static void f_insert(typval_T *argvars, typval_T *rettv, FunPtr fptr) { list_T *l; bool error = false; - const char *const arg_errmsg = _("insert() argument"); - const size_t arg_errmsg_len = strlen(arg_errmsg); if (argvars[0].v_type != VAR_LIST) { EMSG2(_(e_listarg), "insert()"); } else if ((l = argvars[0].vval.v_list) != NULL - && !tv_check_lock(l->lv_lock, arg_errmsg, arg_errmsg_len)) { + && !tv_check_lock(l->lv_lock, N_("insert() argument"), + TV_TRANSLATE)) { long before = 0; if (argvars[2].v_type != VAR_UNKNOWN) { before = tv_get_number_chk(&argvars[2], &error); @@ -13205,21 +13200,20 @@ static void f_remove(typval_T *argvars, typval_T *rettv, FunPtr fptr) long end; dict_T *d; dictitem_T *di; - const char *const arg_errmsg = _("remove() argument"); - const size_t arg_errmsg_len = strlen(arg_errmsg); + const char *const arg_errmsg = N_("remove() argument"); if (argvars[0].v_type == VAR_DICT) { if (argvars[2].v_type != VAR_UNKNOWN) { EMSG2(_(e_toomanyarg), "remove()"); } else if ((d = argvars[0].vval.v_dict) != NULL - && !tv_check_lock(d->dv_lock, arg_errmsg, arg_errmsg_len)) { + && !tv_check_lock(d->dv_lock, arg_errmsg, TV_TRANSLATE)) { const char *key = tv_get_string_chk(&argvars[1]); if (key != NULL) { di = tv_dict_find(d, key, -1); if (di == NULL) { EMSG2(_(e_dictkey), key); - } else if (!var_check_fixed(di->di_flags, arg_errmsg, arg_errmsg_len) - && !var_check_ro(di->di_flags, arg_errmsg, arg_errmsg_len)) { + } else if (!var_check_fixed(di->di_flags, arg_errmsg, TV_TRANSLATE) + && !var_check_ro(di->di_flags, arg_errmsg, TV_TRANSLATE)) { *rettv = di->di_tv; di->di_tv = TV_INITIAL_VALUE; tv_dict_item_remove(d, di); @@ -13232,7 +13226,7 @@ static void f_remove(typval_T *argvars, typval_T *rettv, FunPtr fptr) } else if (argvars[0].v_type != VAR_LIST) { EMSG2(_(e_listdictarg), "remove()"); } else if ((l = argvars[0].vval.v_list) != NULL - && !tv_check_lock(l->lv_lock, arg_errmsg, arg_errmsg_len)) { + && !tv_check_lock(l->lv_lock, arg_errmsg, TV_TRANSLATE)) { bool error = false; idx = tv_get_number_chk(&argvars[1], &error); @@ -13503,14 +13497,12 @@ static void f_resolve(typval_T *argvars, typval_T *rettv, FunPtr fptr) */ static void f_reverse(typval_T *argvars, typval_T *rettv, FunPtr fptr) { - const char *const arg_errmsg = _("reverse() argument"); - const size_t arg_errmsg_len = strlen(arg_errmsg); - list_T *l; if (argvars[0].v_type != VAR_LIST) { EMSG2(_(e_listarg), "reverse()"); } else if ((l = argvars[0].vval.v_list) != NULL - && !tv_check_lock(l->lv_lock, arg_errmsg, arg_errmsg_len)) { + && !tv_check_lock(l->lv_lock, N_("reverse() argument"), + TV_TRANSLATE)) { listitem_T *li = l->lv_last; l->lv_first = l->lv_last = NULL; l->lv_len = 0; @@ -15202,16 +15194,14 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort) sortinfo = &info; const char *const arg_errmsg = (sort - ? _("sort() argument") - : _("uniq() argument")); - const size_t arg_errmsg_len = strlen(arg_errmsg); + ? N_("sort() argument") + : N_("uniq() argument")); if (argvars[0].v_type != VAR_LIST) { EMSG2(_(e_listarg), sort ? "sort()" : "uniq()"); } else { l = argvars[0].vval.v_list; - if (l == NULL - || tv_check_lock(l->lv_lock, arg_errmsg, arg_errmsg_len)) { + if (l == NULL || tv_check_lock(l->lv_lock, arg_errmsg, TV_TRANSLATE)) { goto theend; } rettv->vval.v_list = l; @@ -18876,24 +18866,37 @@ static void set_var(const char *name, const size_t name_len, typval_T *const tv, /// /// @param[in] flags di_flags attribute value. /// @param[in] name Variable name, for use in error message. -/// @param[in] name_len Variable name length. +/// @param[in] name_len Variable name length. Use #TV_TRANSLATE to translate +/// variable name and compute the length. Use #TV_CSTRING +/// to compute the length with strlen() without +/// translating. /// /// @return True if variable is read-only: either always or in sandbox when /// sandbox is enabled, false otherwise. -bool var_check_ro(const int flags, const char *const name, - const size_t name_len) +bool var_check_ro(const int flags, const char *name, + size_t name_len) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL { + const char *error_message = NULL; if (flags & DI_FLAGS_RO) { - emsgf(_(e_readonlyvar), (int)name_len, name); - return true; + error_message = N_(e_readonlyvar); + } else if ((flags & DI_FLAGS_RO_SBX) && sandbox) { + error_message = N_("E794: Cannot set variable in the sandbox: \"%.*s\""); } - if ((flags & DI_FLAGS_RO_SBX) && sandbox) { - emsgf(_("E794: Cannot set variable in the sandbox: \"%.*s\""), - (int)name_len, name); - return true; + + if (error_message == NULL) { + return false; } - return false; + if (name_len == TV_TRANSLATE) { + name = _(name); + name_len = strlen(name); + } else if (name_len == TV_CSTRING) { + name_len = strlen(name); + } + + emsgf(_(error_message), (int)name_len, name); + + return true; } /// Check whether variable is fixed (DI_FLAGS_FIX) @@ -18902,14 +18905,23 @@ bool var_check_ro(const int flags, const char *const name, /// /// @param[in] flags di_flags attribute value. /// @param[in] name Variable name, for use in error message. -/// @param[in] name_len Variable name length. +/// @param[in] name_len Variable name length. Use #TV_TRANSLATE to translate +/// variable name and compute the length. Use #TV_CSTRING +/// to compute the length with strlen() without +/// translating. /// /// @return True if variable is fixed, false otherwise. -static bool var_check_fixed(const int flags, const char *const name, - const size_t name_len) +static bool var_check_fixed(const int flags, const char *name, + size_t name_len) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL { if (flags & DI_FLAGS_FIX) { + if (name_len == TV_TRANSLATE) { + name = _(name); + name_len = strlen(name); + } else if (name_len == TV_CSTRING) { + name_len = strlen(name); + } emsgf(_("E795: Cannot delete variable %.*s"), (int)name_len, name); return true; } @@ -19716,12 +19728,12 @@ void ex_function(exarg_T *eap) } if (fudi.fd_di == NULL) { if (tv_check_lock(fudi.fd_dict->dv_lock, (const char *)eap->arg, - STRLEN(eap->arg))) { + TV_CSTRING)) { // Can't add a function to a locked dictionary goto erret; } } else if (tv_check_lock(fudi.fd_di->di_tv.v_lock, (const char *)eap->arg, - STRLEN(eap->arg))) { + TV_CSTRING)) { // Can't change an existing function if it is locked goto erret; } diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index eb6db9547b..c29c67124f 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -2045,11 +2045,14 @@ bool tv_islocked(const typval_T *const tv) /// /// @param[in] lock Lock status. /// @param[in] name Variable name, used in the error message. -/// @param[in] name_len Variable name length. +/// @param[in] name_len Variable name length. Use #TV_TRANSLATE to translate +/// variable name and compute the length. Use #TV_CSTRING +/// to compute the length with strlen() without +/// translating. /// /// @return true if variable is locked, false otherwise. -bool tv_check_lock(const VarLockStatus lock, const char *const name, - const size_t name_len) +bool tv_check_lock(const VarLockStatus lock, const char *name, + size_t name_len) FUNC_ATTR_WARN_UNUSED_RESULT { const char *error_message = NULL; @@ -2068,10 +2071,17 @@ bool tv_check_lock(const VarLockStatus lock, const char *const name, } assert(error_message != NULL); - const char *const unknown_name = _("Unknown"); + if (name == NULL) { + name = _("Unknown"); + name_len = strlen(name); + } else if (name_len == TV_TRANSLATE) { + name = _(name); + name_len = strlen(name); + } else if (name_len == TV_CSTRING) { + name_len = strlen(name); + } - emsgf(_(error_message), (name != NULL ? name_len : strlen(unknown_name)), - (name != NULL ? name : unknown_name)); + emsgf(_(error_message), (int)name_len, name); return true; } diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h index 7eab22bc12..df46222067 100644 --- a/src/nvim/eval/typval.h +++ b/src/nvim/eval/typval.h @@ -423,6 +423,17 @@ static inline bool tv_is_func(const typval_T tv) return tv.v_type == VAR_FUNC || tv.v_type == VAR_PARTIAL; } +/// Specify that argument needs to be translated +/// +/// Used for size_t length arguments to avoid calling gettext() and strlen() +/// unless needed. +#define TV_TRANSLATE (SIZE_MAX) + +/// Specify that argument is a NUL-terminated C string +/// +/// Used for size_t length arguments to avoid calling strlen() unless needed. +#define TV_CSTRING (SIZE_MAX - 1) + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "eval/typval.h.generated.h" #endif -- cgit From 276ee1f7fb989b931a9ddfabfd4aaf1782bcbb77 Mon Sep 17 00:00:00 2001 From: ZyX Date: Thu, 13 Apr 2017 23:42:51 +0300 Subject: eval: Add comment regarding why special values are needed --- src/nvim/eval.c | 12 ++++++++++++ src/nvim/eval/typval.c | 6 ++++++ 2 files changed, 18 insertions(+) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index e81378bcaa..281b80a915 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -18871,6 +18871,12 @@ static void set_var(const char *name, const size_t name_len, typval_T *const tv, /// to compute the length with strlen() without /// translating. /// +/// Both #TV_… values are used for optimization purposes: +/// variable name with its length is needed only in case +/// of error, when no error occurs computing them is +/// a waste of CPU resources. This especially applies to +/// gettext. +/// /// @return True if variable is read-only: either always or in sandbox when /// sandbox is enabled, false otherwise. bool var_check_ro(const int flags, const char *name, @@ -18910,6 +18916,12 @@ bool var_check_ro(const int flags, const char *name, /// to compute the length with strlen() without /// translating. /// +/// Both #TV_… values are used for optimization purposes: +/// variable name with its length is needed only in case +/// of error, when no error occurs computing them is +/// a waste of CPU resources. This especially applies to +/// gettext. +/// /// @return True if variable is fixed, false otherwise. static bool var_check_fixed(const int flags, const char *name, size_t name_len) diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index c29c67124f..b70554c1ef 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -2050,6 +2050,12 @@ bool tv_islocked(const typval_T *const tv) /// to compute the length with strlen() without /// translating. /// +/// Both #TV_… values are used for optimization purposes: +/// variable name with its length is needed only in case +/// of error, when no error occurs computing them is +/// a waste of CPU resources. This especially applies to +/// gettext. +/// /// @return true if variable is locked, false otherwise. bool tv_check_lock(const VarLockStatus lock, const char *name, size_t name_len) -- cgit From b54e5c220f0b1bff31ce65c6988f70cbb9780b5e Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 14 Apr 2017 00:12:05 +0300 Subject: unittests: Add a test for TV_CSTRING MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Not using enum{} because SIZE_MAX exceeds integer and I do not really like how enum definition is described in C99: 1. Even though all values must fit into the chosen type (6.7.2.2, p 4) the type to choose is still implementation-defined. 2. 6.4.4.3 explicitly states that “an identifier declared as an enumeration constant has type `int`”. So it looks like “no matter what type was chosen for enumeration, constants will be integers”. Yet the following simple program: #include #include #include enum { X=SIZE_MAX }; int main(int argc, char **argv) { printf("x:%zu m:%zu t:%zu v:%zu", sizeof(X), sizeof(SIZE_MAX), sizeof(size_t), (size_t)X); } yields one of the following using different compilers: - clang/gcc/pathcc: `x:8 m:8 t:8 v:18446744073709551615` - pcc/tcc: `x:4 m:8 t:8 v:1844674407370955161` If I remove the cast of X to size_t then pcc/tcc both yield `x:4 m:8 t:8 v:4294967295`, other compilers’ output does not change. All compilers were called with `$compiler -std=c99 -xc -` (feeding program from echo), except for `tcc` which has missing `-std=c99`. `pcc` seems to ignore the argument though: it is perfectly fine with `-std=c1000`. --- src/nvim/eval/typval.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h index df46222067..0f659727ee 100644 --- a/src/nvim/eval/typval.h +++ b/src/nvim/eval/typval.h @@ -17,6 +17,7 @@ #include "nvim/pos.h" // for linenr_T #include "nvim/gettext.h" #include "nvim/message.h" +#include "nvim/macros.h" /// Type used for VimL VAR_NUMBER values typedef int varnumber_T; @@ -434,6 +435,12 @@ static inline bool tv_is_func(const typval_T tv) /// Used for size_t length arguments to avoid calling strlen() unless needed. #define TV_CSTRING (SIZE_MAX - 1) +#ifdef UNIT_TESTING +// Do not use enum constants, see commit message. +EXTERN const size_t kTVCstring INIT(= TV_CSTRING); +EXTERN const size_t kTVTranslate INIT(= TV_TRANSLATE); +#endif + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "eval/typval.h.generated.h" #endif -- cgit From 31fd6d4bbf80d0f50893ab6144aa5eb70c95c351 Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 14 Apr 2017 23:57:44 +0300 Subject: eval/typval: Do not translate tv_clear argument, this is useless --- src/nvim/eval/typval.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index b70554c1ef..d5177138b0 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -1799,11 +1799,13 @@ static inline void _nothing_conv_dict_end(typval_T *const tv, #define TYPVAL_ENCODE_NAME nothing #define TYPVAL_ENCODE_FIRST_ARG_TYPE const void *const #define TYPVAL_ENCODE_FIRST_ARG_NAME ignored +#define TYPVAL_ENCODE_TRANSLATE_OBJECT_NAME #include "nvim/eval/typval_encode.c.h" #undef TYPVAL_ENCODE_SCOPE #undef TYPVAL_ENCODE_NAME #undef TYPVAL_ENCODE_FIRST_ARG_TYPE #undef TYPVAL_ENCODE_FIRST_ARG_NAME +#undef TYPVAL_ENCODE_TRANSLATE_OBJECT_NAME #undef TYPVAL_ENCODE_ALLOW_SPECIALS #undef TYPVAL_ENCODE_CONV_NIL @@ -1837,12 +1839,14 @@ static inline void _nothing_conv_dict_end(typval_T *const tv, /// @param[in,out] tv Value to free. void tv_clear(typval_T *const tv) { - static char *objname = NULL; // cached because gettext() is slow. #6437 - if (objname == NULL) { - objname = xstrdup(_("tv_clear() argument")); - } if (tv != NULL && tv->v_type != VAR_UNKNOWN) { - const int evn_ret = encode_vim_to_nothing(NULL, tv, objname); + // WARNING: do not translate the string here, gettext is slow and function + // is used *very* often. At the current state encode_vim_to_nothing() does + // not error out and does not use the argument anywhere. + // + // If situation changes and this argument will be used, translate it in the + // place where it is used. + const int evn_ret = encode_vim_to_nothing(NULL, tv, "tv_clear() argument"); (void)evn_ret; assert(evn_ret == OK); } -- cgit From c289986c89dd0189ed8ab709bf2eb822c493542a Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 15 Apr 2017 00:08:50 +0300 Subject: eval/encode: Do translate “… argument” strings, but only in conv_error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nvim/eval/encode.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c index d74913a481..c058c3a9c0 100644 --- a/src/nvim/eval/encode.c +++ b/src/nvim/eval/encode.c @@ -179,9 +179,9 @@ static int conv_error(const char *const msg, const MPConvStack *const mpstack, } } } - EMSG3(msg, objname, (kv_size(*mpstack) == 0 - ? _("itself") - : (char *) msg_ga.ga_data)); + emsgf(msg, _(objname), (kv_size(*mpstack) == 0 + ? _("itself") + : (char *)msg_ga.ga_data)); ga_clear(&msg_ga); return FAIL; } @@ -790,7 +790,7 @@ char *encode_tv2string(typval_T *tv, size_t *len) garray_T ga; ga_init(&ga, (int)sizeof(char), 80); const int evs_ret = encode_vim_to_string(&ga, tv, - "encode_tv2string() argument"); + N_("encode_tv2string() argument")); (void)evs_ret; assert(evs_ret == OK); did_echo_string_emsg = false; @@ -818,7 +818,7 @@ char *encode_tv2echo(typval_T *tv, size_t *len) ga_concat(&ga, tv->vval.v_string); } } else { - const int eve_ret = encode_vim_to_echo(&ga, tv, ":echo argument"); + const int eve_ret = encode_vim_to_echo(&ga, tv, N_(":echo argument")); (void)eve_ret; assert(eve_ret == OK); } @@ -841,7 +841,8 @@ char *encode_tv2json(typval_T *tv, size_t *len) { garray_T ga; ga_init(&ga, (int)sizeof(char), 80); - const int evj_ret = encode_vim_to_json(&ga, tv, "encode_tv2json() argument"); + const int evj_ret = encode_vim_to_json(&ga, tv, + N_("encode_tv2json() argument")); if (!evj_ret) { ga_clear(&ga); } -- cgit From 12fc1defd6a1b13d1f801173e0b6a1cef28527ae Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sat, 15 Apr 2017 11:19:40 +0200 Subject: ops: fix i with multi-byte text (#6524) --- src/nvim/getchar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index b83681ad01..3b248c4bc6 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -302,13 +302,13 @@ static void add_num_buff(buffheader_T *buf, long n) */ static void add_char_buff(buffheader_T *buf, int c) { - char bytes[MB_MAXBYTES + 1]; + uint8_t bytes[MB_MAXBYTES + 1]; int len; if (IS_SPECIAL(c)) { len = 1; } else { - len = (*mb_char2bytes)(c, (char_u *)bytes); + len = mb_char2bytes(c, bytes); } for (int i = 0; i < len; i++) { -- cgit From a8f7872f445a9ec18be40b203a65d809adb05cd1 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sat, 15 Apr 2017 08:50:43 -0400 Subject: test_timers.vim: Adjust timing to handle difference in implementation --- src/nvim/testdir/test_timers.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index fd2b50b495..d377062780 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -20,7 +20,7 @@ func Test_oneshot() let slept = WaitFor('g:val == 1') call assert_equal(1, g:val) if has('reltime') - call assert_inrange(49, 100, slept) + call assert_inrange(40, 100, slept) else call assert_inrange(20, 100, slept) endif @@ -32,7 +32,7 @@ func Test_repeat_three() let slept = WaitFor('g:val == 3') call assert_equal(3, g:val) if has('reltime') - call assert_inrange(149, 250, slept) + call assert_inrange(120, 250, slept) else call assert_inrange(80, 200, slept) endif @@ -57,7 +57,7 @@ func Test_with_partial_callback() let slept = WaitFor('g:val == 1') call assert_equal(1, g:val) if has('reltime') - call assert_inrange(49, 130, slept) + call assert_inrange(40, 130, slept) else call assert_inrange(20, 100, slept) endif @@ -119,7 +119,7 @@ func Test_paused() let slept = WaitFor('g:val == 1') call assert_equal(1, g:val) if has('reltime') - call assert_inrange(0, 30, slept) + call assert_inrange(0, 60, slept) else call assert_inrange(0, 10, slept) endif -- cgit From c70ab1a2e2d78832e0246bd64c53c8b92912f0ef Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sat, 15 Apr 2017 15:06:50 +0200 Subject: test: make locale dependent oldtest more reliable (#6526) --- src/nvim/testdir/test_normal.vim | 42 ++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/test_normal.vim b/src/nvim/testdir/test_normal.vim index c529971528..6261625801 100644 --- a/src/nvim/testdir/test_normal.vim +++ b/src/nvim/testdir/test_normal.vim @@ -1606,12 +1606,13 @@ fun! Test_normal30_changecase() norm! V~ call assert_equal('THIS IS A simple test: äüöss', getline('.')) - " Turkish ASCII turns to multi-byte. On Mac the Turkish locale is available - " but toupper()/tolower() don't do the right thing. - if !has('mac') && !has('osx') - try - lang tr_TR.UTF-8 - set casemap= + " Turkish ASCII turns to multi-byte. On some systems Turkish locale + " is available but toupper()/tolower() don't do the right thing. + try + lang tr_TR.UTF-8 + set casemap= + let iupper = toupper('i') + if iupper == "\u0130" call setline(1, 'iI') 1normal gUU call assert_equal("\u0130I", getline(1)) @@ -1621,8 +1622,7 @@ fun! Test_normal30_changecase() 1normal guu call assert_equal("i\u0131", getline(1)) call assert_equal("i\u0131", tolower("iI")) - - set casemap& + elseif iupper == "I" call setline(1, 'iI') 1normal gUU call assert_equal("II", getline(1)) @@ -1632,13 +1632,25 @@ fun! Test_normal30_changecase() 1normal guu call assert_equal("ii", getline(1)) call assert_equal("ii", tolower("iI")) - - lang en_US.UTF-8 - catch /E197:/ - " can't use Turkish locale - throw 'Skipped: Turkish locale not available' - endtry - endif + else + call assert_true(false, "expected toupper('i') to be either 'I' or '\u0131'") + endif + set casemap& + call setline(1, 'iI') + 1normal gUU + call assert_equal("II", getline(1)) + call assert_equal("II", toupper("iI")) + + call setline(1, 'iI') + 1normal guu + call assert_equal("ii", getline(1)) + call assert_equal("ii", tolower("iI")) + + lang en_US.UTF-8 + catch /E197:/ + " can't use Turkish locale + throw 'Skipped: Turkish locale not available' + endtry " clean up bw! -- cgit From 0dddd8a27caac1060dedbe55b285e3564e81e995 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 15 Apr 2017 19:13:43 +0300 Subject: os/fileio: Remove FUNC_ATTR_MALLOC for file_open_new fp contains pointer to rbuffer --- src/nvim/os/fileio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/os/fileio.c b/src/nvim/os/fileio.c index 4b7b53fc7f..3c47c66196 100644 --- a/src/nvim/os/fileio.c +++ b/src/nvim/os/fileio.c @@ -100,7 +100,7 @@ int file_open(FileDescriptor *const ret_fp, const char *const fname, /// @return [allocated] Opened file or NULL in case of error. FileDescriptor *file_open_new(int *const error, const char *const fname, const int flags, const int mode) - FUNC_ATTR_NONNULL_ALL FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT { FileDescriptor *const fp = xmalloc(sizeof(*fp)); if ((*error = file_open(fp, fname, flags, mode)) != 0) { -- cgit From b08b71c7288ed7bbeae6066ab36a1366d0673bf5 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 15 Apr 2017 19:16:00 +0300 Subject: eval/typval: Remove FUNC_ATTR_MALLOC from tv_list_alloc Allocated list points to previously allocated list. Allocated list is saved to gc_first_list. --- src/nvim/eval/typval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index eb6db9547b..14db330dba 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -136,7 +136,7 @@ void tv_list_watch_fix(list_T *const l, const listitem_T *const item) /// /// @return [allocated] new list. list_T *tv_list_alloc(void) - FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC + FUNC_ATTR_NONNULL_RET { list_T *const list = xcalloc(1, sizeof(list_T)); -- cgit From b9004d744811f530922fbb194ea02033d332f375 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 15 Apr 2017 19:16:40 +0300 Subject: eval/typval: Remove FUNC_ATTR_MALLOC from tv_dict_item_copy Allocated storage may receive pointer to the list after tv_copy(). --- src/nvim/eval/typval.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 14db330dba..4d1400484a 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -1011,7 +1011,6 @@ void tv_dict_item_free(dictitem_T *const item) /// @return [allocated] new dictionary item. static dictitem_T *tv_dict_item_copy(dictitem_T *const di) FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT - FUNC_ATTR_MALLOC { dictitem_T *const new_di = tv_dict_item_alloc((const char *)di->di_key); tv_copy(&di->di_tv, &new_di->di_tv); -- cgit From af3579d5f7bc86a25fd73e94c6de0e73ae9d8e12 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 15 Apr 2017 19:18:25 +0300 Subject: eval/typval: Remove FUNC_ATTR_MALLOC from tv_dict_alloc Allocated dict points to previously allocated dict. Queue in allocated dict points to itself. Hashtab in allocated dict points to inside itself. Allocated dict is saved to gc_first_dict. --- src/nvim/eval/typval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 4d1400484a..9e954be9b3 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -1039,7 +1039,7 @@ void tv_dict_item_remove(dict_T *const dict, dictitem_T *const item) /// /// @return [allocated] new dictionary. dict_T *tv_dict_alloc(void) - FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT + FUNC_ATTR_NONNULL_RET FUNC_ATTR_WARN_UNUSED_RESULT { dict_T *const d = xmalloc(sizeof(dict_T)); -- cgit From 82ba2891ae905fabacafc58daebedc80533b8334 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 15 Apr 2017 19:19:22 +0300 Subject: eval/typval: Remove FUNC_ATTR_MALLOC from tv_list_alloc_ret Same as tv_list_alloc, but additionally ret_tv receives pointer to the newly allocated list. --- src/nvim/eval/typval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 9e954be9b3..70ec3dfe39 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -1576,7 +1576,7 @@ void tv_dict_set_keys_readonly(dict_T *const dict) /// /// @return [allocated] pointer to the created list. list_T *tv_list_alloc_ret(typval_T *const ret_tv) - FUNC_ATTR_NONNULL_ALL FUNC_ATTR_MALLOC + FUNC_ATTR_NONNULL_ALL { list_T *const l = tv_list_alloc(); ret_tv->vval.v_list = l; -- cgit From d191ba1db38cf4bad3e4ed3e3346f3f8a9c015cf Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 15 Apr 2017 19:23:00 +0300 Subject: option: Remove FUNC_ATTR_MALLOC from get_winbuf_options Same as tv_dict_alloc() and additionally it saves some strings inside a dictionary. --- src/nvim/option.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/option.c b/src/nvim/option.c index 458d80716c..0070a0056d 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -6974,7 +6974,7 @@ bool signcolumn_on(win_T *wp) /// Get window or buffer local options dict_T *get_winbuf_options(const int bufopt) - FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_MALLOC + FUNC_ATTR_WARN_UNUSED_RESULT { dict_T *const d = tv_dict_alloc(); -- cgit From ac47e64ecad6b21d4d29066b37ab4018fcd8da48 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 15 Apr 2017 19:25:00 +0300 Subject: ops: Remove FUNC_ATTR_MALLOC from copy_register Returned storage has a pointer to a newly allocated array. --- src/nvim/ops.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/nvim/ops.c b/src/nvim/ops.c index f11d6b69b2..5212ec45ab 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -802,7 +802,6 @@ static bool is_append_register(int regname) /// Returns a copy of contents in register `name` /// for use in do_put. Should be freed by caller. yankreg_T *copy_register(int name) - FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_RET { yankreg_T *reg = get_yank_register(name, YREG_PASTE); -- cgit From d76a13bb65574f4811313ada6454f7d34cde2a2c Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 15 Apr 2017 19:39:53 +0300 Subject: os/shell: Remove FUNC_ATTR_MALLOC from shell_build_argv Returns an array of allocated strings. --- src/nvim/os/shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index 5cc9d4b79b..29c0431521 100644 --- a/src/nvim/os/shell.c +++ b/src/nvim/os/shell.c @@ -47,7 +47,7 @@ typedef struct { /// @param extra_args Extra arguments to the shell, or NULL. /// @return Newly allocated argument vector. Must be freed with shell_free_argv. char **shell_build_argv(const char *cmd, const char *extra_args) - FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC + FUNC_ATTR_NONNULL_RET { size_t argc = tokenize(p_sh, NULL) + (cmd ? tokenize(p_shcf, NULL) : 0); char **rv = xmalloc((argc + 4) * sizeof(*rv)); -- cgit From ec0fabd4d5129c7293c8b8fcf0d0946ae5bd5fd4 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Sat, 15 Apr 2017 18:45:47 +0200 Subject: eval.c: Code style fixes --- src/nvim/eval.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 6a18baf2e2..33a553436f 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -16696,11 +16696,11 @@ static void f_timer_info(typval_T *argvars, typval_T *rettv, FunPtr fptr) if (argvars[0].v_type != VAR_UNKNOWN) { if (argvars[0].v_type != VAR_NUMBER) { EMSG(_(e_number_exp)); - } else { - timer_T *timer = pmap_get(uint64_t)(timers, tv_get_number(&argvars[0])); - if (timer != NULL && !timer->stopped) { - add_timer_info(rettv, timer); - } + return; + } + timer_T *timer = pmap_get(uint64_t)(timers, tv_get_number(&argvars[0])); + if (timer != NULL && !timer->stopped) { + add_timer_info(rettv, timer); } } else { add_timer_info_all(rettv); @@ -16712,12 +16712,12 @@ static void f_timer_pause(typval_T *argvars, typval_T *unused, FunPtr fptr) { if (argvars[0].v_type != VAR_NUMBER) { EMSG(_(e_number_exp)); - } else { - int paused = (bool)tv_get_number(&argvars[1]); - timer_T *timer = pmap_get(uint64_t)(timers, tv_get_number(&argvars[0])); - if (timer != NULL) { - timer->paused = paused; - } + return; + } + int paused = (bool)tv_get_number(&argvars[1]); + timer_T *timer = pmap_get(uint64_t)(timers, tv_get_number(&argvars[0])); + if (timer != NULL) { + timer->paused = paused; } } @@ -16790,7 +16790,7 @@ static void f_timer_stop(typval_T *argvars, typval_T *rettv, FunPtr fptr) static void f_timer_stopall(typval_T *argvars, typval_T *unused, FunPtr fptr) { - timer_teardown(); + timer_stop_all(); } // invoked on the main loop @@ -16853,7 +16853,7 @@ static void timer_decref(timer_T *timer) } } -void timer_teardown(void) +static void timer_stop_all(void) { timer_T *timer; map_foreach_value(timers, timer, { @@ -16861,6 +16861,11 @@ void timer_teardown(void) }) } +void timer_teardown(void) +{ + timer_stop_all(); +} + /* * "tolower(string)" function */ -- cgit From 33952a7661927f875ebf40a60e236831c789de58 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 18:53:02 +0300 Subject: *: Silence some false positives --- src/nvim/api/private/helpers.h | 1 + src/nvim/buffer.h | 3 ++- src/nvim/eval/typval_encode.c.h | 4 ++-- src/nvim/globals.h | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/api/private/helpers.h b/src/nvim/api/private/helpers.h index 9fe8c351cf..20b4015fb5 100644 --- a/src/nvim/api/private/helpers.h +++ b/src/nvim/api/private/helpers.h @@ -8,6 +8,7 @@ #include "nvim/memory.h" #include "nvim/lib/kvec.h" +// -V:api_set_error:618 #define api_set_error(err, errtype, ...) \ do { \ snprintf((err)->msg, \ diff --git a/src/nvim/buffer.h b/src/nvim/buffer.h index 016c5ce3b7..39b9faf8b1 100644 --- a/src/nvim/buffer.h +++ b/src/nvim/buffer.h @@ -103,7 +103,8 @@ static inline void buf_set_changedtick(buf_T *const buf, const int changedtick) assert(changedtick_di->di_flags == (DI_FLAGS_RO|DI_FLAGS_FIX)); # endif assert(changedtick_di == (dictitem_T *)&buf->changedtick_di); - assert(&buf->b_changedtick == &buf->changedtick_di.di_tv.vval.v_number); + assert(&buf->b_changedtick // -V501 + == &buf->changedtick_di.di_tv.vval.v_number); #endif buf->b_changedtick = changedtick; } diff --git a/src/nvim/eval/typval_encode.c.h b/src/nvim/eval/typval_encode.c.h index ad54eef4a0..3487880bd2 100644 --- a/src/nvim/eval/typval_encode.c.h +++ b/src/nvim/eval/typval_encode.c.h @@ -611,7 +611,7 @@ _convert_one_value_regular_dict: {} typval_encode_stop_converting_one_item: return OK; // Prevent “unused label” warnings. - goto typval_encode_stop_converting_one_item; + goto typval_encode_stop_converting_one_item; // -V779 } TYPVAL_ENCODE_SCOPE int _TYPVAL_ENCODE_ENCODE( @@ -814,6 +814,6 @@ encode_vim_to__error_ret: _mp_destroy(mpstack); return FAIL; // Prevent “unused label” warnings. - goto typval_encode_stop_converting_one_item; + goto typval_encode_stop_converting_one_item; // -V779 } #endif // NVIM_EVAL_TYPVAL_ENCODE_C_H diff --git a/src/nvim/globals.h b/src/nvim/globals.h index 3c705d88a5..df9f418951 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -548,6 +548,7 @@ EXTERN win_T *prevwin INIT(= NULL); /* previous window */ FOR_ALL_TABS(tp) \ FOR_ALL_WINDOWS_IN_TAB(wp, tp) +// -V:FOR_ALL_WINDOWS_IN_TAB:501 # define FOR_ALL_WINDOWS_IN_TAB(wp, tp) \ for (win_T *wp = ((tp) == curtab) \ ? firstwin : (tp)->tp_firstwin; wp != NULL; wp = wp->w_next) -- cgit From a096766ee3edc1197039d236c3a5c42365d60d4d Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 19:27:17 +0300 Subject: diff: Silence -V519 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Not exactly a false positive, but previous assignment is a part of the pattern “change global, run code which uses it, change global back”. --- src/nvim/diff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/diff.c b/src/nvim/diff.c index ff76abc01f..49574fbbfc 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -1076,8 +1076,8 @@ void diff_win_options(win_T *wp, int addbuf) if (!wp->w_p_diff) { wp->w_p_wrap_save = wp->w_p_wrap; } - wp->w_p_wrap = FALSE; - curwin = wp; + wp->w_p_wrap = false; + curwin = wp; // -V519 curbuf = curwin->w_buffer; if (!wp->w_p_diff) { -- cgit From 2901921a1b5bf72cb404fed0ed0510124eaf6e8b Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 19:30:18 +0300 Subject: digraph: Ignore false positive Reversed order is intentional, digraphs allow swapping characters. --- src/nvim/digraph.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c index 560205fe7d..fb4a8c6d0d 100644 --- a/src/nvim/digraph.c +++ b/src/nvim/digraph.c @@ -1569,7 +1569,8 @@ int getdigraph(int char1, int char2, int meta_char) if (((retval = getexactdigraph(char1, char2, meta_char)) == char2) && (char1 != char2) - && ((retval = getexactdigraph(char2, char1, meta_char)) == char1)) { + && ((retval = getexactdigraph(char2, char1, meta_char)) // -V764 + == char1)) { return char2; } return retval; -- cgit From 4f0fc1f06a6b551c081f1e4abf1a119588c6a386 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 19:32:38 +0300 Subject: digraph: Fix errors due to has_mbyte and friends being fixed --- src/nvim/digraph.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c index fb4a8c6d0d..66fb525920 100644 --- a/src/nvim/digraph.c +++ b/src/nvim/digraph.c @@ -1676,11 +1676,7 @@ static void printdigraph(digr_T *dp) int list_width; - if ((dy_flags & DY_UHEX) || has_mbyte) { - list_width = 13; - } else { - list_width = 11; - } + list_width = 13; if (dp->result != 0) { if (msg_col > Columns - list_width) { @@ -1701,15 +1697,11 @@ static void printdigraph(digr_T *dp) *p++ = dp->char2; *p++ = ' '; - if (has_mbyte) { - // add a space to draw a composing char on - if (enc_utf8 && utf_iscomposing(dp->result)) { - *p++ = ' '; - } - p += (*mb_char2bytes)(dp->result, p); - } else { - *p++ = (char_u)dp->result; + // add a space to draw a composing char on + if (utf_iscomposing(dp->result)) { + *p++ = ' '; } + p += (*mb_char2bytes)(dp->result, p); if (char2cells(dp->result) == 1) { *p++ = ' '; -- cgit From 9e9ba14e0e443beff4c1418cdaff412c394852c0 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 19:38:16 +0300 Subject: edit: Fix strange code Based on the flow it looks like ptr could not be NULL here: if ptr_arg is NULL ptr is compl_leader, if compl_leader is NULL function exits. This also applies to Vim as far as I see. --- src/nvim/edit.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index fe00027dec..1ca5424736 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -3427,10 +3427,11 @@ static void ins_compl_fixRedoBufForLeader(char_u *ptr_arg) len -= (*mb_head_off)(p, p + len); for (p += len; *p != NUL; mb_ptr_adv(p)) AppendCharToRedobuff(K_BS); - } else + } else { len = 0; - if (ptr != NULL) - AppendToRedobuffLit(ptr + len, -1); + } + assert(ptr != NULL); + AppendToRedobuffLit(ptr + len, -1); } /* -- cgit From fb4754104b50baa0eb489e5c9b50c1d37523f2d3 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 19:39:55 +0300 Subject: macros: Fix excessive check --- src/nvim/macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/macros.h b/src/nvim/macros.h index b816b34b39..214af82422 100644 --- a/src/nvim/macros.h +++ b/src/nvim/macros.h @@ -75,7 +75,7 @@ do { \ if (*p_langmap \ && (condition) \ - && (p_lrm || (!p_lrm && KeyTyped)) \ + && (p_lrm || KeyTyped) \ && !KeyStuffed \ && (c) >= 0) \ { \ -- cgit From dd5b0cc17a1ec6925c6cd7a5be23eb78bf953f76 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 19:50:23 +0300 Subject: edit: Copy assert to before the warning --- src/nvim/edit.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 1ca5424736..51d0847bc7 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -3419,6 +3419,7 @@ static void ins_compl_fixRedoBufForLeader(char_u *ptr_arg) else return; /* nothing to do */ } + assert(ptr != NULL); if (compl_orig_text != NULL) { p = compl_orig_text; for (len = 0; p[len] != NUL && p[len] == ptr[len]; ++len) -- cgit From d70a0f6895048a3dcb5ec841afd01daee4866be4 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 19:51:35 +0300 Subject: eval/typval_encode: Silence then/else equivalence warning --- src/nvim/eval/typval_encode.c.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval/typval_encode.c.h b/src/nvim/eval/typval_encode.c.h index 3487880bd2..b4a70fb188 100644 --- a/src/nvim/eval/typval_encode.c.h +++ b/src/nvim/eval/typval_encode.c.h @@ -489,7 +489,7 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE( } if (is_string) { TYPVAL_ENCODE_CONV_STR_STRING(tv, buf, len); - } else { + } else { // -V523 TYPVAL_ENCODE_CONV_STRING(tv, buf, len); } xfree(buf); -- cgit From 05c1829a8ccf2df07927bec502467faa443d90d8 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 19:55:49 +0300 Subject: eval: Silence eap->skip false positives `lnum` starts at `eap->line2` in case of skipping, so cycle is always run at least once. --- src/nvim/eval.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 772994de31..49e3590185 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -2747,7 +2747,7 @@ void ex_call(exarg_T *eap) } else lnum = eap->line1; for (; lnum <= eap->line2; ++lnum) { - if (!eap->skip && eap->addr_count > 0) { + if (!eap->skip && eap->addr_count > 0) { // -V560 curwin->w_cursor.lnum = lnum; curwin->w_cursor.col = 0; curwin->w_cursor.coladd = 0; @@ -2768,7 +2768,7 @@ void ex_call(exarg_T *eap) } tv_clear(&rettv); - if (doesrange || eap->skip) { + if (doesrange || eap->skip) { // -V560 break; } -- cgit From 97a1ccf8e7470d8c781c86253f8a7795fe50dc50 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 19:56:55 +0300 Subject: eval: Fix V547: `d == NULL` was already checked at line 2986 --- src/nvim/eval.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 49e3590185..4cc400799d 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -2999,8 +2999,7 @@ int do_unlet(const char *const name, const size_t name_len, const int forceit) return FAIL; } - if (d == NULL - || tv_check_lock(d->dv_lock, (const char *)name, STRLEN(name))) { + if (tv_check_lock(d->dv_lock, (const char *)name, STRLEN(name))) { return FAIL; } -- cgit From 7c9e3d6cadb441aaa40c8539de41e302228196a9 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:02:06 +0300 Subject: eval: Refactor f_char2nr With has_mbyte equal to 1 and &encoding always UTF-8 second argument is no longer useful: utf_ptr2char is the same as mb_ptr2char. Also changes function behaviour a bit: now if second argument is not a number it immediately returns with error, without bothering to get a character. --- src/nvim/eval.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 4cc400799d..bfc9f6eaa6 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -7305,18 +7305,14 @@ static void f_changenr(typval_T *argvars, typval_T *rettv, FunPtr fptr) */ static void f_char2nr(typval_T *argvars, typval_T *rettv, FunPtr fptr) { - if (has_mbyte) { - int utf8 = 0; - - if (argvars[1].v_type != VAR_UNKNOWN) { - utf8 = tv_get_number_chk(&argvars[1], NULL); + if (argvars[1].v_type != VAR_UNKNOWN) { + if (!tv_check_num(&argvars[1])) { + return; } - - rettv->vval.v_number = (utf8 ? *utf_ptr2char : *mb_ptr2char)( - (const char_u *)tv_get_string(&argvars[0])); - } else { - rettv->vval.v_number = (uint8_t)(tv_get_string(&argvars[0])[0]); } + + rettv->vval.v_number = utf_ptr2char( + (const char_u *)tv_get_string(&argvars[0])); } /* -- cgit From 31190879cc85cb3e8a056d544ea0c3ed63ce21df Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:07:54 +0300 Subject: eval: Fix useless NULL check partial_name() as it is written now really cannot return NULL --- src/nvim/eval.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index bfc9f6eaa6..f8afc03c1c 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -8977,13 +8977,10 @@ static void f_get(typval_T *argvars, typval_T *rettv, FunPtr fptr) if (strcmp(what, "func") == 0 || strcmp(what, "name") == 0) { rettv->v_type = (*what == 'f' ? VAR_FUNC : VAR_STRING); const char *const n = (const char *)partial_name(pt); - if (n == NULL) { - rettv->vval.v_string = NULL; - } else { - rettv->vval.v_string = (char_u *)xstrdup(n); - if (rettv->v_type == VAR_FUNC) { - func_ref(rettv->vval.v_string); - } + assert(n != NULL); + rettv->vval.v_string = (char_u *)xstrdup(n); + if (rettv->v_type == VAR_FUNC) { + func_ref(rettv->vval.v_string); } } else if (strcmp(what, "dict") == 0) { rettv->v_type = VAR_DICT; -- cgit From 3c5f4b382f62d9f3cf5d54720592ff75d3a1f86d Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:08:56 +0300 Subject: eval: Silence octal constant warning --- src/nvim/eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index f8afc03c1c..a259bbf0eb 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -12538,7 +12538,7 @@ static void f_min(typval_T *argvars, typval_T *rettv, FunPtr fptr) */ static void f_mkdir(typval_T *argvars, typval_T *rettv, FunPtr fptr) { - int prot = 0755; + int prot = 0755; // -V536 rettv->vval.v_number = FAIL; if (check_restricted() || check_secure()) -- cgit From fbdef2e6f2d65d3cc6f3c8a8dcd8b3cddf41c474 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:16:32 +0300 Subject: eval: Refactor nr2char() Adds error messages, checks type and ignores the second argument. Currently utf_char2bytes is able to handle any 31-bit character, not limited by a unicode range. So checking for INT_MAX and not for something else: function yet uses `int`. --- src/nvim/eval.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index a259bbf0eb..71af801986 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -12763,25 +12763,32 @@ static void f_nextnonblank(typval_T *argvars, typval_T *rettv, FunPtr fptr) */ static void f_nr2char(typval_T *argvars, typval_T *rettv, FunPtr fptr) { - char_u buf[NUMBUFLEN]; - - if (has_mbyte) { - int utf8 = 0; - - if (argvars[1].v_type != VAR_UNKNOWN) { - utf8 = tv_get_number_chk(&argvars[1], NULL); - } - if (utf8) { - buf[(*utf_char2bytes)((int)tv_get_number(&argvars[0]), buf)] = NUL; - } else { - buf[(*mb_char2bytes)((int)tv_get_number(&argvars[0]), buf)] = NUL; + if (argvars[1].v_type != VAR_UNKNOWN) { + if (!tv_check_num(&argvars[1])) { + return; } - } else { - buf[0] = (char_u)tv_get_number(&argvars[0]); - buf[1] = NUL; } + + bool error = false; + const varnumber_T num = tv_get_number_chk(&argvars[0], &error); + if (error) { + return; + } + if (num < 0) { + emsgf(_("E5070: Character number could not be less then zero")); + return; + } + if (num > INT_MAX) { + emsgf(_("E5071: Character number could not be greater then INT_MAX (%i)"), + INT_MAX); + return; + } + + char buf[MB_MAXBYTES]; + const int len = utf_char2bytes((int)num, (char_u *)buf); + rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_strsave(buf); + rettv->vval.v_string = xmemdupz(buf, (size_t)len); } /* -- cgit From 787d71a3afbe619a301ba7898e2c43fdcffdc8ec Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:19:10 +0300 Subject: eval: Fix condition in f_serverstop --- src/nvim/eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 71af801986..2a725c49f7 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -14306,7 +14306,7 @@ static void f_serverstop(typval_T *argvars, typval_T *rettv, FunPtr fptr) return; } - if (argvars[0].v_type == VAR_UNKNOWN || argvars[0].v_type != VAR_STRING) { + if (argvars[0].v_type != VAR_STRING) { EMSG(_(e_invarg)); return; } -- cgit From 9b1dd084257fc2b5f50e29b283be698c13d4a509 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:20:38 +0300 Subject: eval: Remove unneeded varp check --- src/nvim/eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 2a725c49f7..6e204be481 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -14330,7 +14330,7 @@ static void f_setbufvar(typval_T *argvars, typval_T *rettv, FunPtr fptr) buf_T *const buf = get_buf_tv(&argvars[0], false); typval_T *varp = &argvars[2]; - if (buf != NULL && varname != NULL && varp != NULL) { + if (buf != NULL && varname != NULL) { if (*varname == '&') { long numval; bool error = false; -- cgit From 9dd1926df01a27c913dd19ef0a4f79d06842508a Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:20:53 +0300 Subject: eval: Remove unneeded varp check --- src/nvim/eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 6e204be481..30b776c887 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -14874,7 +14874,7 @@ static void f_settabvar(typval_T *argvars, typval_T *rettv, FunPtr fptr) const char *const varname = tv_get_string_chk(&argvars[1]); typval_T *const varp = &argvars[2]; - if (varname != NULL && varp != NULL && tp != NULL) { + if (varname != NULL && tp != NULL) { tabpage_T *const save_curtab = curtab; goto_tabpage_tp(tp, false, false); -- cgit From 1bc080078793aafcecfae95620f6dac917c737dc Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:22:12 +0300 Subject: eval: Remove unneeded !eap->skip check Already checked in the outer if(). --- src/nvim/eval.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 30b776c887..67d5465896 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -19462,8 +19462,9 @@ void ex_function(exarg_T *eap) * interrupt, or an exception. */ if (!aborting()) { - if (!eap->skip && fudi.fd_newkey != NULL) + if (fudi.fd_newkey != NULL) { EMSG2(_(e_dictkey), fudi.fd_newkey); + } xfree(fudi.fd_newkey); return; } else -- cgit From c5010c98ae8532f7f2778ce0e89a01d9e1ca68f9 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:22:58 +0300 Subject: eval: Fix position of buf declaration --- src/nvim/eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 67d5465896..cf55b42bdf 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -21048,8 +21048,8 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, char *s = tofree; emsg_off--; if (s != NULL) { + char buf[MSG_BUF_LEN]; if (vim_strsize((char_u *)s) > MSG_BUF_CLEN) { - char buf[MSG_BUF_LEN]; trunc_string((char_u *)s, (char_u *)buf, MSG_BUF_CLEN, sizeof(buf)); s = buf; -- cgit From d766607dc9e3c54a7575102ecf025eb184d9f648 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:24:30 +0300 Subject: farsi: Simplify condition --- src/nvim/farsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/farsi.c b/src/nvim/farsi.c index e7e93f756f..2d37d1284e 100644 --- a/src/nvim/farsi.c +++ b/src/nvim/farsi.c @@ -321,7 +321,7 @@ static void put_curr_and_l_to_X(char_u c) } if ((curwin->w_cursor.col < (colnr_T)STRLEN(get_cursor_line_ptr()))) { - if ((p_ri && curwin->w_cursor.col) || !p_ri) { + if (!p_ri || curwin->w_cursor.col) { if (p_ri) { dec_cursor(); } else { -- cgit From a894c82defc00fcd0ed14a6d157130d9dc63f314 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:25:00 +0300 Subject: ex_docmd: Remove excessive assignment --- src/nvim/ex_docmd.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 0fd4ae48be..3d1136b7ac 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -1304,7 +1304,6 @@ static char_u * do_one_cmd(char_u **cmdlinep, /* * 2. Handle command modifiers. */ - p = ea.cmd; p = skip_range(ea.cmd, NULL); switch (*p) { /* When adding an entry, also modify cmd_exists(). */ -- cgit From 87e107d92143e108ec3ec5f91851ca3cb3768175 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:27:20 +0300 Subject: ex_docmd: Remove :Ni! easter egg --- src/nvim/ex_docmd.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'src') diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 3d1136b7ac..60d3bb07a3 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -1726,11 +1726,7 @@ static char_u * do_one_cmd(char_u **cmdlinep, errormsg = (char_u *)_("E464: Ambiguous use of user-defined command"); goto doend; } - /* Check for wrong commands. */ - if (*p == '!' && ea.cmd[1] == 0151 && ea.cmd[0] == 78) { - errormsg = uc_fun_cmd(); - goto doend; - } + // Check for wrong commands. if (ea.cmdidx == CMD_SIZE) { if (!ea.skip) { STRCPY(IObuff, _("E492: Not an editor command")); @@ -4961,20 +4957,6 @@ static void uc_list(char_u *name, size_t name_len) MSG(_("No user-defined commands found")); } -static char_u *uc_fun_cmd(void) -{ - static char_u fcmd[] = {0x84, 0xaf, 0x60, 0xb9, 0xaf, 0xb5, 0x60, 0xa4, - 0xa5, 0xad, 0xa1, 0xae, 0xa4, 0x60, 0xa1, 0x60, - 0xb3, 0xa8, 0xb2, 0xb5, 0xa2, 0xa2, 0xa5, 0xb2, - 0xb9, 0x7f, 0}; - int i; - - for (i = 0; fcmd[i]; ++i) - IObuff[i] = fcmd[i] - 0x40; - IObuff[i] = 0; - return IObuff; -} - static int uc_scan_attr(char_u *attr, size_t len, uint32_t *argt, long *def, int *flags, int * compl, char_u **compl_arg, int *addr_type_arg) -- cgit From fe01e9c947b8c2fcb328e79b8b91ceebfd8c04cc Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:27:47 +0300 Subject: ex_docmd: Remove unneeded if() --- src/nvim/ex_docmd.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 60d3bb07a3..0e399c9fb3 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -4097,12 +4097,11 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp) options += WILD_ICASE; p = ExpandOne(&xpc, eap->arg, NULL, options, WILD_EXPAND_FREE); - if (p == NULL) + if (p == NULL) { return FAIL; - if (p != NULL) { - (void)repl_cmdline(eap, eap->arg, STRLEN(eap->arg), p, cmdlinep); - xfree(p); } + (void)repl_cmdline(eap, eap->arg, STRLEN(eap->arg), p, cmdlinep); + xfree(p); } } return OK; -- cgit From d88ae748b51963d0188fe41f0abd6ea208bd2eef Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:29:19 +0300 Subject: getchar: Fix if block indentation --- src/nvim/getchar.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 3b248c4bc6..e056ff488c 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1849,11 +1849,12 @@ static int vgetorpeek(int advance) mp_match = mp; mp_match_len = keylen; } - } else - /* No match; may have to check for - * termcode at next character. */ - if (max_mlen < mlen) - max_mlen = mlen; + } else { + // No match; may have to check for termcode at next character. + if (max_mlen < mlen) { + max_mlen = mlen; + } + } } } -- cgit From e3de83a8291cf0ef1481a2631dda04b37b6e3412 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:32:10 +0300 Subject: hardcopy: Remove unneeded prt_do_conv assignment --- src/nvim/hardcopy.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c index 4cb05ffc12..b2cbe30a43 100644 --- a/src/nvim/hardcopy.c +++ b/src/nvim/hardcopy.c @@ -2576,13 +2576,12 @@ int mch_print_begin(prt_settings_T *psettings) prt_conv.vc_type = CONV_NONE; if (!(enc_canon_props(p_enc) & enc_canon_props(p_encoding) & ENC_8BIT)) { - /* Set up encoding conversion if required */ - if (FAIL == convert_setup(&prt_conv, p_enc, p_encoding)) { - EMSG2(_("E620: Unable to convert to print encoding \"%s\""), - p_encoding); - return FALSE; + // Set up encoding conversion if required + if (convert_setup(&prt_conv, p_enc, p_encoding) == FAIL) { + emsgf(_("E620: Unable to convert to print encoding \"%s\""), + p_encoding); + return false; } - prt_do_conv = TRUE; } prt_do_conv = prt_conv.vc_type != CONV_NONE; -- cgit From 0f7c260cd873c996da9badb42b9135cd15bee285 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:39:57 +0300 Subject: fileio: Simlify help files encoding detection Most of code is dead when enc_utf8 is always true. Given that `c` is being reused for other purposes I left it set to 1 just in case. --- src/nvim/fileio.c | 43 ++++++++----------------------------------- 1 file changed, 8 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index c1b8203ed1..74fa5aa1de 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -730,43 +730,16 @@ readfile ( fenc = (char_u *)""; /* binary: don't convert */ fenc_alloced = FALSE; } else if (curbuf->b_help) { - char_u firstline[80]; - int fc; - - /* Help files are either utf-8 or latin1. Try utf-8 first, if this - * fails it must be latin1. - * Always do this when 'encoding' is "utf-8". Otherwise only do - * this when needed to avoid [converted] remarks all the time. - * It is needed when the first line contains non-ASCII characters. - * That is only in *.??x files. */ - fenc = (char_u *)"latin1"; - c = enc_utf8; - if (!c && !read_stdin) { - fc = fname[STRLEN(fname) - 1]; - if (TOLOWER_ASC(fc) == 'x') { - /* Read the first line (and a bit more). Immediately rewind to - * the start of the file. If the read() fails "len" is -1. */ - len = read_eintr(fd, firstline, 80); - lseek(fd, (off_t)0L, SEEK_SET); - for (p = firstline; p < firstline + len; ++p) - if (*p >= 0x80) { - c = TRUE; - break; - } - } - } + // Help files are either utf-8 or latin1. Try utf-8 first, if this + // fails it must be latin1. + // It is needed when the first line contains non-ASCII characters. + // That is only in *.??x files. + fenc_next = (char_u *)"latin1"; + fenc = (char_u *)"utf-8"; - if (c) { - fenc_next = fenc; - fenc = (char_u *)"utf-8"; + fenc_alloced = false; - /* When the file is utf-8 but a character doesn't fit in - * 'encoding' don't retry. In help text editing utf-8 bytes - * doesn't make sense. */ - if (!enc_utf8) - keep_dest_enc = TRUE; - } - fenc_alloced = FALSE; + c = 1; } else if (*p_fencs == NUL) { fenc = curbuf->b_p_fenc; /* use format from buffer */ fenc_alloced = FALSE; -- cgit From 2394c9f2b79e5c9c121c21dcb324f9c18b473853 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:47:06 +0300 Subject: memline: Silence “buffer underflow” warning, looks like false positive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nvim/memline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 5ea2397db3..45e16554e6 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -616,7 +616,7 @@ static bool ml_check_b0_strings(ZERO_BL *b0p) return (memchr(b0p->b0_version, NUL, 10) && memchr(b0p->b0_uname, NUL, B0_UNAME_SIZE) && memchr(b0p->b0_hname, NUL, B0_HNAME_SIZE) - && memchr(b0p->b0_fname, NUL, B0_FNAME_SIZE_CRYPT)); + && memchr(b0p->b0_fname, NUL, B0_FNAME_SIZE_CRYPT)); // -V512 } /* -- cgit From 10ce00efa8c9d4e9f2b588063ce04f7d49050d8b Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:55:29 +0300 Subject: memline: Fix “NULL pointer dereference” warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was actually a false positive indicating always-true condition, not real dereference. --- src/nvim/memline.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 45e16554e6..b31ca136dd 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -3362,29 +3362,32 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname, } if (swap_exists_action != SEA_NONE && choice == 0) { - char *name; + const char *const sw_msg_1 = _("Swap file \""); + const char *const sw_msg_2 = _("\" already exists!"); const size_t fname_len = strlen(fname); - name = xmalloc(fname_len - + strlen(_("Swap file \"")) - + strlen(_("\" already exists!")) + 5); - STRCPY(name, _("Swap file \"")); - home_replace(NULL, (char_u *) fname, (char_u *)&name[strlen(name)], - fname_len, true); - STRCAT(name, _("\" already exists!")); - choice = do_dialog(VIM_WARNING, - (char_u *)_("VIM - ATTENTION"), - (char_u *)(name == NULL - ? _("Swap file already exists!") - : name), + const size_t sw_msg_1_len = strlen(sw_msg_1); + const size_t sw_msg_2_len = strlen(sw_msg_2); + + const size_t name_len = sw_msg_1_len + fname_len + sw_msg_2_len + 5; + + char *const name = xmalloc(name_len); + memcpy(name, sw_msg_1, sw_msg_1_len + 1); + home_replace(NULL, (char_u *)fname, (char_u *)&name[sw_msg_1_len], + fname_len, true); + xstrlcat(name, sw_msg_2, name_len); + choice = do_dialog(VIM_WARNING, (char_u *)_("VIM - ATTENTION"), + (char_u *)name, # if defined(UNIX) - process_still_running - ? (char_u *)_( - "&Open Read-Only\n&Edit anyway\n&Recover\n&Quit\n&Abort") : + process_still_running + ? (char_u *)_( + "&Open Read-Only\n&Edit anyway\n&Recover" + "\n&Quit\n&Abort") : # endif - (char_u *)_( - "&Open Read-Only\n&Edit anyway\n&Recover\n&Delete it\n&Quit\n&Abort"), - 1, NULL, FALSE); + (char_u *)_( + "&Open Read-Only\n&Edit anyway\n&Recover" + "\n&Delete it\n&Quit\n&Abort"), + 1, NULL, false); # if defined(UNIX) if (process_still_running && choice >= 4) -- cgit From 083792e1374100f1b0c48c72987935f56ebbd8ad Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:56:30 +0300 Subject: message: Remove some enc_utf8/… checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nvim/message.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/nvim/message.c b/src/nvim/message.c index 3e4a1e10b6..91dfc79e38 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1165,15 +1165,9 @@ int msg_outtrans_len_attr(char_u *msgstr, int len, int attr) * Normal characters are printed several at a time. */ while (--len >= 0) { - if (enc_utf8) { - // Don't include composing chars after the end. - mb_l = utfc_ptr2len_len((char_u *)str, len + 1); - } else if (has_mbyte) { - mb_l = (*mb_ptr2len)((char_u *)str); - } else { - mb_l = 1; - } - if (has_mbyte && mb_l > 1) { + // Don't include composing chars after the end. + mb_l = utfc_ptr2len_len((char_u *)str, len + 1); + if (mb_l > 1) { c = (*mb_ptr2char)((char_u *)str); if (vim_isprintc(c)) { // Printable multi-byte char: count the cells. -- cgit From 0718d0e6d44536547dac2248c65b15547e56fc10 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:58:19 +0300 Subject: message: Some more has_mbyte/enc_utf8 removal --- src/nvim/message.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/nvim/message.c b/src/nvim/message.c index 91dfc79e38..42e1fd1cf9 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1657,16 +1657,13 @@ static void msg_puts_display(const char_u *str, int maxlen, int attr, // Display char in last column before showing more-prompt. if (*s >= ' ' && !cmdmsg_rl) { - if (has_mbyte) { - if (enc_utf8 && maxlen >= 0) - /* avoid including composing chars after the end */ - l = utfc_ptr2len_len(s, (int)((str + maxlen) - s)); - else - l = (*mb_ptr2len)(s); - s = screen_puts_mbyte((char_u *)s, l, attr); + if (maxlen >= 0) { + // Avoid including composing chars after the end. + l = utfc_ptr2len_len(s, (int)((str + maxlen) - s)); } else { - msg_screen_putchar(*s++, attr); + l = utfc_ptr2len(s); } + s = screen_puts_mbyte((char_u *)s, l, attr); did_last_char = true; } else { did_last_char = false; -- cgit From dc523eed8ec2ea238dde21f39fdbb6343227c16e Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 20:59:44 +0300 Subject: fileio: Silence “!= identical subexpressions” warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nvim/os/fileio.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/nvim/os/fileio.c b/src/nvim/os/fileio.c index 3c47c66196..27eb448c3d 100644 --- a/src/nvim/os/fileio.c +++ b/src/nvim/os/fileio.c @@ -47,6 +47,7 @@ int file_open(FileDescriptor *const ret_fp, const char *const fname, int os_open_flags = 0; int fd; TriState wr = kNone; + // -V:FLAG:501 #define FLAG(flags, flag, fcntl_flags, wrval, cond) \ do { \ if (flags & flag) { \ -- cgit From 84aa457ccdf88baeee1e87ba763fafe0ff77095e Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:02:43 +0300 Subject: os/env: Fix “invalid pointer to local” false positive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nvim/os/env.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index ad51e598c1..f3187de182 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -641,7 +641,7 @@ char *vim_getenv(const char *name) exe_name, "share" _PATHSEPSTR "nvim" _PATHSEPSTR "runtime" _PATHSEPSTR, MAXPATHL) == OK) { - vim_path = exe_name; + vim_path = exe_name; // -V507 } } } @@ -675,6 +675,7 @@ char *vim_getenv(const char *name) vim_path = NULL; } } + assert(vim_path != exe_name); } #ifdef HAVE_PATHDEF -- cgit From cdbfff077b23d666036bd9967756938df9044b38 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:05:50 +0300 Subject: ops: Silence “counter not used in loop” false positive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nvim/ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 5212ec45ab..6ea3a45049 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -2785,7 +2785,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags) } if (curbuf->terminal) { - for (int i = 0; i < count; i++) { + for (int i = 0; i < count; i++) { // -V756 // feed the lines to the terminal for (size_t j = 0; j < y_size; j++) { if (j) { -- cgit From 54bd78b8a8d212a0278b1d9517dd0dcc4df79a0b Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:06:22 +0300 Subject: normal: Remove unneeded assignment --- src/nvim/normal.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 388ddfc8bb..1809b98586 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -694,7 +694,6 @@ static void normal_get_additional_char(NormalState *s) if (langmap_active) { // Undo the decrement done above no_mapping++; - State = NORMAL_BUSY; } State = NORMAL_BUSY; s->need_flushbuf |= add_to_showcmd(*cp); -- cgit From b5db7cde366ae159aee6826167b68c3aff0cdf19 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:08:12 +0300 Subject: normal: Clarify the code Current variant works only because of PUT_FIXINDENT being equal to true. --- src/nvim/normal.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 1809b98586..d7c7c7d48c 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -2336,7 +2336,8 @@ do_mouse ( if ((State & REPLACE_FLAG) && !yank_register_mline(regname)) insert_reg(regname, true); else { - do_put(regname, NULL, BACKWARD, 1L, fixindent | PUT_CURSEND); + do_put(regname, NULL, BACKWARD, 1L, + (fixindent ? PUT_FIXINDENT : 0) | PUT_CURSEND); /* Repeat it with CTRL-R CTRL-O r or CTRL-R CTRL-P r */ AppendCharToRedobuff(Ctrl_R); @@ -2688,7 +2689,8 @@ do_mouse ( */ if (restart_edit != 0) where_paste_started = curwin->w_cursor; - do_put(regname, NULL, dir, count, fixindent | PUT_CURSEND); + do_put(regname, NULL, dir, count, + (fixindent ? PUT_FIXINDENT : 0)| PUT_CURSEND); } /* * Ctrl-Mouse click or double click in a quickfix window jumps to the -- cgit From aa3b1f695f699e189d5190c57e6c5e2bce4b0c9e Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:09:31 +0300 Subject: normal: Add figure braces so that code is clearer --- src/nvim/normal.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/nvim/normal.c b/src/nvim/normal.c index d7c7c7d48c..9340a45f62 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -7613,11 +7613,13 @@ static void nv_record(cmdarg_T *cap) if (cap->nchar == ':' || cap->nchar == '/' || cap->nchar == '?') { stuffcharReadbuff(cap->nchar); stuffcharReadbuff(K_CMDWIN); - } else - /* (stop) recording into a named register, unless executing a - * register */ - if (!Exec_reg && do_record(cap->nchar) == false) - clearopbeep(cap->oap); + } else { + // (stop) recording into a named register, unless executing a + // register. + if (!Exec_reg && do_record(cap->nchar) == false) { + clearopbeep(cap->oap); + } + } } } -- cgit From be9d98cb45aab402b7666776ad1288b9a79bb0c1 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:10:40 +0300 Subject: quickfix: Remove unneeded condition fmt_ptr was checked for being NULL in if() condition earlier. --- src/nvim/quickfix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 4fa5c85abd..33b832c033 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -856,7 +856,7 @@ restofline: if (fmt_ptr == NULL) { qi->qf_multiline = qi->qf_multiignore = false; } - } else if (fmt_ptr != NULL) { + } else { // honor %> item if (fmt_ptr->conthere) { fmt_start = fmt_ptr; -- cgit From 4e7150ee94d967ff51cbef24a7e18f71290ed9a2 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:11:37 +0300 Subject: quicfix: Remove duplicate condition --- src/nvim/quickfix.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 33b832c033..af055e9b75 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -3284,7 +3284,6 @@ void ex_cc(exarg_T *eap) || eap->cmdidx == CMD_lrewind || eap->cmdidx == CMD_lfirst || eap->cmdidx == CMD_llast - || eap->cmdidx == CMD_llast || eap->cmdidx == CMD_ldo || eap->cmdidx == CMD_lfdo) { qi = GET_LOC_LIST(curwin); @@ -3341,7 +3340,6 @@ void ex_cnext(exarg_T *eap) || eap->cmdidx == CMD_lnfile || eap->cmdidx == CMD_lNfile || eap->cmdidx == CMD_lpfile - || eap->cmdidx == CMD_lpfile || eap->cmdidx == CMD_ldo || eap->cmdidx == CMD_lfdo) { qi = GET_LOC_LIST(curwin); -- cgit From b396a3f72edb3fb345e516a12b92991b249da572 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:13:49 +0300 Subject: quicfix: Avoid possible NULL dereference --- src/nvim/quickfix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index af055e9b75..1241841885 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -984,7 +984,7 @@ qf_init_ext( } // Use the local value of 'errorformat' if it's set. - if (errorformat == p_efm && tv == NULL && *buf->b_p_efm != NUL) { + if (errorformat == p_efm && tv == NULL && buf && *buf->b_p_efm != NUL) { efm = buf->b_p_efm; } else { efm = errorformat; -- cgit From a65867542d291cda6cdd68e56e0d5d3866dbbb72 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:17:08 +0300 Subject: screen: Remove unneeded check --- src/nvim/screen.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index febca105e9..79596f73cd 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -1016,9 +1016,7 @@ static void win_update(win_T *wp) linenr_T from, to; if (VIsual_active) { - if (VIsual_active - && (VIsual_mode != wp->w_old_visual_mode - || type == INVERTED_ALL)) { + if (VIsual_mode != wp->w_old_visual_mode || type == INVERTED_ALL) { /* * If the type of Visual selection changed, redraw the whole * selection. Also when the ownership of the X selection is -- cgit From 7cf4b0ac06c7d6675a05924b6aff3850fde3bcf2 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:18:00 +0300 Subject: screen: Silence “buffer underflow” warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nvim/screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 79596f73cd..cf116e1930 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2447,7 +2447,7 @@ win_line ( } else { /* Long line, use only the last SPWORDLEN bytes. */ nextlinecol = v - SPWORDLEN; - memmove(nextline, line + nextlinecol, SPWORDLEN); + memmove(nextline, line + nextlinecol, SPWORDLEN); // -V512 nextline_idx = SPWORDLEN + 1; } } -- cgit From 48ad8e0ff1ba721a5607c20f48e813400041299c Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:22:02 +0300 Subject: screen: Silence NULL dereference false positive Based on the loop condition when shl_flag is true cur != NULL. --- src/nvim/screen.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index cf116e1930..db757a54f5 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2579,13 +2579,14 @@ win_line ( * Do this for both search_hl and the match list. */ cur = wp->w_match_head; - shl_flag = FALSE; - while (cur != NULL || shl_flag == FALSE) { - if (shl_flag == FALSE) { + shl_flag = false; + while (cur != NULL || !shl_flag) { + if (!shl_flag) { shl = &search_hl; - shl_flag = TRUE; - } else - shl = &cur->hl; + shl_flag = true; + } else { + shl = &cur->hl; // -V595 + } shl->startcol = MAXCOL; shl->endcol = MAXCOL; shl->attr_cur = 0; @@ -5536,13 +5537,14 @@ static void prepare_search_hl(win_T *wp, linenr_T lnum) * Do this both for search_hl and the match list. */ cur = wp->w_match_head; - shl_flag = FALSE; - while (cur != NULL || shl_flag == FALSE) { - if (shl_flag == FALSE) { + shl_flag = false; + while (cur != NULL || shl_flag == false) { + if (shl_flag == false) { shl = &search_hl; - shl_flag = TRUE; - } else - shl = &cur->hl; + shl_flag = true; + } else { + shl = &cur->hl; // -V595 + } if (shl->rm.regprog != NULL && shl->lnum == 0 && re_multiline(shl->rm.regprog)) { -- cgit From e131194db71c5fc20148ea6e463de997917f6c0a Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:22:46 +0300 Subject: screen: Remove unneeded condition Already checked in outer if() --- src/nvim/screen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index db757a54f5..431f74508d 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2784,8 +2784,8 @@ win_line ( // draw 'breakindent': indent wrapped text accodringly if (draw_state == WL_BRI - 1 && n_extra == 0) { draw_state = WL_BRI; - if (wp->w_p_bri && n_extra == 0 && row != startrow && filler_lines == 0) { - char_attr = 0; // was: hl_attr(HLF_AT); + if (wp->w_p_bri && row != startrow && filler_lines == 0) { + char_attr = 0; // was: hl_attr(HLF_AT); if (diff_hlf != (hlf_T)0) { char_attr = hl_attr(diff_hlf); -- cgit From c0cbc507202231d5dd9c5c8669e6116f3344d535 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:26:07 +0300 Subject: screen: Remove another portion of has_mbyte/friends-checking stuff --- src/nvim/screen.c | 95 +++++++++++++++++++++++++------------------------------ 1 file changed, 43 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 431f74508d..66b52c3b25 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -5330,43 +5330,39 @@ void screen_puts_len(char_u *text, int textlen, int row, int col, int attr) c = *ptr; /* check if this is the first byte of a multibyte */ if (l_has_mbyte) { - if (l_enc_utf8 && len > 0) + if (len > 0) { mbyte_blen = utfc_ptr2len_len(ptr, (int)((text + len) - ptr)); - else - mbyte_blen = (*mb_ptr2len)(ptr); - if (l_enc_dbcs == DBCS_JPNU && c == 0x8e) - mbyte_cells = 1; - else if (l_enc_dbcs != 0) - mbyte_cells = mbyte_blen; - else { /* enc_utf8 */ - if (len >= 0) - u8c = utfc_ptr2char_len(ptr, u8cc, - (int)((text + len) - ptr)); - else - u8c = utfc_ptr2char(ptr, u8cc); - mbyte_cells = utf_char2cells(u8c); - if (p_arshape && !p_tbidi && arabic_char(u8c)) { - /* Do Arabic shaping. */ - if (len >= 0 && (int)(ptr - text) + mbyte_blen >= len) { - /* Past end of string to be displayed. */ - nc = NUL; - nc1 = NUL; - } else { - nc = utfc_ptr2char_len(ptr + mbyte_blen, pcc, - (int)((text + len) - ptr - mbyte_blen)); - nc1 = pcc[0]; - } - pc = prev_c; - prev_c = u8c; - u8c = arabic_shape(u8c, &c, &u8cc[0], nc, nc1, pc); - } else - prev_c = u8c; - if (col + mbyte_cells > screen_Columns) { - /* Only 1 cell left, but character requires 2 cells: - * display a '>' in the last column to avoid wrapping. */ - c = '>'; - mbyte_cells = 1; + } else { + mbyte_blen = utfc_ptr2len(ptr); + } + if (len >= 0) { + u8c = utfc_ptr2char_len(ptr, u8cc, (int)((text + len) - ptr)); + } else { + u8c = utfc_ptr2char(ptr, u8cc); + } + mbyte_cells = utf_char2cells(u8c); + if (p_arshape && !p_tbidi && arabic_char(u8c)) { + // Do Arabic shaping. + if (len >= 0 && (int)(ptr - text) + mbyte_blen >= len) { + // Past end of string to be displayed. + nc = NUL; + nc1 = NUL; + } else { + nc = utfc_ptr2char_len(ptr + mbyte_blen, pcc, + (int)((text + len) - ptr - mbyte_blen)); + nc1 = pcc[0]; } + pc = prev_c; + prev_c = u8c; + u8c = arabic_shape(u8c, &c, &u8cc[0], nc, nc1, pc); + } else { + prev_c = u8c; + } + if (col + mbyte_cells > screen_Columns) { + // Only 1 cell left, but character requires 2 cells: + // display a '>' in the last column to avoid wrapping. */ + c = '>'; + mbyte_cells = 1; } } @@ -5374,16 +5370,11 @@ void screen_puts_len(char_u *text, int textlen, int row, int col, int attr) force_redraw_next = FALSE; need_redraw = ScreenLines[off] != c - || (mbyte_cells == 2 - && ScreenLines[off + 1] != (l_enc_dbcs ? ptr[1] : 0)) - || (l_enc_dbcs == DBCS_JPNU - && c == 0x8e - && ScreenLines2[off] != ptr[1]) - || (l_enc_utf8 - && (ScreenLinesUC[off] != - (u8char_T)(c < 0x80 && u8cc[0] == 0 ? 0 : u8c) - || (ScreenLinesUC[off] != 0 - && screen_comp_differs(off, u8cc)))) + || (mbyte_cells == 2 && ScreenLines[off + 1] != 0) + || (ScreenLinesUC[off] != + (u8char_T)(c < 0x80 && u8cc[0] == 0 ? 0 : u8c) + || (ScreenLinesUC[off] != 0 + && screen_comp_differs(off, u8cc))) || ScreenAttrs[off] != attr || exmode_active; @@ -6103,8 +6094,7 @@ retry: if (new_ScreenLinesC[i] == NULL) break; if (new_ScreenLines == NULL - || (l_enc_utf8 && (new_ScreenLinesUC == NULL || i != p_mco)) - || (l_enc_dbcs == DBCS_JPNU && new_ScreenLines2 == NULL) + || (new_ScreenLinesUC == NULL || i != p_mco) || new_ScreenAttrs == NULL || new_LineOffset == NULL || new_LineWraps == NULL @@ -6189,13 +6179,14 @@ retry: ScreenLinesC[i] + LineOffset[old_row], (size_t)len * sizeof(u8char_T)); } - if (l_enc_dbcs == DBCS_JPNU && ScreenLines2 != NULL) + if (ScreenLines2 != NULL) { memmove(new_ScreenLines2 + new_LineOffset[new_row], - ScreenLines2 + LineOffset[old_row], - (size_t)len * sizeof(schar_T)); + ScreenLines2 + LineOffset[old_row], + (size_t)len * sizeof(schar_T)); + } memmove(new_ScreenAttrs + new_LineOffset[new_row], - ScreenAttrs + LineOffset[old_row], - (size_t)len * sizeof(sattr_T)); + ScreenAttrs + LineOffset[old_row], + (size_t)len * sizeof(sattr_T)); } } } -- cgit From 316789e14c3910c0b4c5dd710a1c82ebd7b01ac2 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:33:10 +0300 Subject: tag: Silence “buffer underflow” warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nvim/tag.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/tag.c b/src/nvim/tag.c index f01b8b8ab1..1ce2a4e2eb 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -1222,9 +1222,9 @@ find_tags ( if (has_re && orgpat.regmatch.regprog == NULL) goto findtag_end; - /* This is only to avoid a compiler warning for using search_info - * uninitialised. */ - memset(&search_info, 0, (size_t)1); + // This is only to avoid a compiler warning for using search_info + // uninitialised. + memset(&search_info, 0, 1); // -V512 /* * When finding a specified number of matches, first try with matching -- cgit From 76783963ebc90ca565311489bb2206b208d2e147 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:34:15 +0300 Subject: tag: Fix “initialized twice successively” false positive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nvim/tag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 1ce2a4e2eb..0c7244cbb3 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -2534,7 +2534,7 @@ jumpto_tag ( } } p_ws = save_p_ws; - p_ic = save_p_ic; + p_ic = save_p_ic; // -V519 p_scs = save_p_scs; /* A search command may have positioned the cursor beyond the end -- cgit From 69ebfb8d8ea26061a4fbfe9ee07d7bfff49e6a2b Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:35:50 +0300 Subject: regexp: Fix warning about octal constant --- src/nvim/regexp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 4b5e17b00b..e15a2eebe5 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -2398,7 +2398,7 @@ collection: regc('\b'); break; case CLASS_ESCAPE: - regc('\033'); + regc(ESC); break; } } else { -- cgit From b7118a008af1f0a15f7cfbe070a1f590310cc7b5 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:36:53 +0300 Subject: regexp: Remove another has_mbyte/…-checking stuff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nvim/regexp.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index e15a2eebe5..284cb27c40 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -2923,13 +2923,8 @@ static void skipchr(void) else prevchr_len = 0; if (regparse[prevchr_len] != NUL) { - if (enc_utf8) - /* exclude composing chars that mb_ptr2len does include */ - prevchr_len += utf_ptr2len(regparse + prevchr_len); - else if (has_mbyte) - prevchr_len += (*mb_ptr2len)(regparse + prevchr_len); - else - ++prevchr_len; + // Exclude composing chars that utfc_ptr2len does include. + prevchr_len += utf_ptr2len(regparse + prevchr_len); } regparse += prevchr_len; prev_at_start = at_start; -- cgit From 30561afe4128ab0c5371af00641d5c5a682d6270 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:38:06 +0300 Subject: regexp: Silence octal constant warning --- src/nvim/regexp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 284cb27c40..7be89c2d7e 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -3047,7 +3047,7 @@ static int getoctchrs(void) int c; int i; - for (i = 0; i < 3 && nr < 040; ++i) { + for (i = 0; i < 3 && nr < 040; i++) { // -V536 c = regparse[0]; if (c < '0' || c > '7') break; -- cgit From 372b6af8ea09bced16e8c793cbab304d2393bfa6 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:41:55 +0300 Subject: regexp_nfa: Remove another has_mbyte/…-checking code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nvim/regexp_nfa.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index caf26fdd35..67a405daf5 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -2772,15 +2772,10 @@ static int nfa_max_width(nfa_state_T *startstate, int depth) case NFA_ANY: case NFA_START_COLL: case NFA_START_NEG_COLL: - /* matches some character, including composing chars */ - if (enc_utf8) - len += MB_MAXBYTES; - else if (has_mbyte) - len += 2; - else - ++len; + // Matches some character, including composing chars. + len += MB_MAXBYTES; if (state->c != NFA_ANY) { - /* skip over the characters */ + // Skip over the characters. state = state->out1->out; continue; } -- cgit From 9d302c60f084c33c05b758cae12cc2dfa775e48e Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 21:42:20 +0300 Subject: regexp_nfa: Remove octal constant --- src/nvim/regexp_nfa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index 67a405daf5..506e6277e9 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -4407,8 +4407,9 @@ static int check_char_class(int class, int c) return OK; break; case NFA_CLASS_ESCAPE: - if (c == '\033') + if (c == ESC) { return OK; + } break; default: -- cgit From 58300d70d26969546e204983f8b4e505771ec8dd Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 22:20:19 +0300 Subject: *: Fix linter errors --- src/nvim/eval.c | 9 +++++---- src/nvim/ex_docmd.c | 3 +-- src/nvim/normal.c | 6 +++--- src/nvim/screen.c | 10 ++++------ 4 files changed, 13 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index cf55b42bdf..7c5b23f567 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -2742,11 +2742,12 @@ void ex_call(exarg_T *eap) * call, and the loop is broken. */ if (eap->skip) { - ++emsg_skip; - lnum = eap->line2; /* do it once, also with an invalid range */ - } else + emsg_skip++; + lnum = eap->line2; // Do it once, also with an invalid range. + } else { lnum = eap->line1; - for (; lnum <= eap->line2; ++lnum) { + } + for (; lnum <= eap->line2; lnum++) { if (!eap->skip && eap->addr_count > 0) { // -V560 curwin->w_cursor.lnum = lnum; curwin->w_cursor.col = 0; diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 0e399c9fb3..17b3b512ef 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -4095,8 +4095,7 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp) xpc.xp_context = EXPAND_FILES; if (p_wic) options += WILD_ICASE; - p = ExpandOne(&xpc, eap->arg, NULL, - options, WILD_EXPAND_FREE); + p = ExpandOne(&xpc, eap->arg, NULL, options, WILD_EXPAND_FREE); if (p == NULL) { return FAIL; } diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 9340a45f62..7f087dcd20 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -2333,9 +2333,9 @@ do_mouse ( if (regname == 0 && eval_has_provider("clipboard")) { regname = '*'; } - if ((State & REPLACE_FLAG) && !yank_register_mline(regname)) + if ((State & REPLACE_FLAG) && !yank_register_mline(regname)) { insert_reg(regname, true); - else { + } else { do_put(regname, NULL, BACKWARD, 1L, (fixindent ? PUT_FIXINDENT : 0) | PUT_CURSEND); @@ -7616,7 +7616,7 @@ static void nv_record(cmdarg_T *cap) } else { // (stop) recording into a named register, unless executing a // register. - if (!Exec_reg && do_record(cap->nchar) == false) { + if (!Exec_reg && do_record(cap->nchar) == FAIL) { clearopbeep(cap->oap); } } diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 66b52c3b25..a8993be4e5 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -1017,11 +1017,9 @@ static void win_update(win_T *wp) if (VIsual_active) { if (VIsual_mode != wp->w_old_visual_mode || type == INVERTED_ALL) { - /* - * If the type of Visual selection changed, redraw the whole - * selection. Also when the ownership of the X selection is - * gained or lost. - */ + // If the type of Visual selection changed, redraw the whole + // selection. Also when the ownership of the X selection is + // gained or lost. if (curwin->w_cursor.lnum < VIsual.lnum) { from = curwin->w_cursor.lnum; to = VIsual.lnum; @@ -5349,7 +5347,7 @@ void screen_puts_len(char_u *text, int textlen, int row, int col, int attr) nc1 = NUL; } else { nc = utfc_ptr2char_len(ptr + mbyte_blen, pcc, - (int)((text + len) - ptr - mbyte_blen)); + (int)((text + len) - ptr - mbyte_blen)); nc1 = pcc[0]; } pc = prev_c; -- cgit From 2eb9150a4fcb8f43599e5f470cbcb3a12195d910 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 16 Apr 2017 23:58:32 +0300 Subject: buffer: Adjust where do_buffer call is located It is located there in Vim, but in dd7657c1605246e8f7ade35184069a09dc254e84 position was for some reason swapped. --- src/nvim/buffer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 292eb03a16..e48b7846ae 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -741,12 +741,13 @@ static void clear_wininfo(buf_T *buf) */ void goto_buffer(exarg_T *eap, int start, int dir, int count) { - (void)do_buffer(*eap->cmd == 's' ? DOBUF_SPLIT : DOBUF_GOTO, - start, dir, count, eap->forceit); bufref_T old_curbuf; set_bufref(&old_curbuf, curbuf); swap_exists_action = SEA_DIALOG; + (void)do_buffer(*eap->cmd == 's' ? DOBUF_SPLIT : DOBUF_GOTO, + start, dir, count, eap->forceit); + if (swap_exists_action == SEA_QUIT && *eap->cmd == 's') { cleanup_T cs; -- cgit From 263849b2dd4dc98bbe0870f5654c77809caeb965 Mon Sep 17 00:00:00 2001 From: Matthew Malcomson Date: Sun, 16 Apr 2017 20:15:50 +0100 Subject: fold: foldMoveRange(): fix :move bug #6534 Closes #6540 In #6221 there was a mistake in calculating which folds need to be re-ordered. When there are no folds after those that have been adjusted, then `move_end` remains 0. This results in reverse_fold_order() swapping folds that have been adjusted with uninitialised folds in the remainder of the grow array. Add a check in foldMoveRange() to account for this case. --- src/nvim/fold.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/fold.c b/src/nvim/fold.c index d810aee0ce..34db4d2171 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -2765,10 +2765,13 @@ void foldMoveRange(garray_T *gap, const linenr_T line1, const linenr_T line2, } dest_index = FOLD_INDEX(fp, gap); - // All folds are now correct, but they are not necessarily in the correct - // order. - // We have to swap folds in the range [move_end, dest_index) with those in - // the range [move_start, move_end). + // All folds are now correct, but not necessarily in the correct order. + // We must swap folds in the range [move_end, dest_index) with those in the + // range [move_start, move_end). + if (move_end == 0) { + // There are no folds after those moved, so none were moved out of order. + return; + } reverse_fold_order(gap, move_start, dest_index - 1); reverse_fold_order(gap, move_start, move_start + dest_index - move_end - 1); reverse_fold_order(gap, move_start + dest_index - move_end, dest_index - 1); -- cgit From 3345382cc2afd3b3a027d9abb5c101507ebb57d7 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Mon, 17 Apr 2017 00:00:04 +0200 Subject: highlight: default Cursor to guibg=fg, guifg=bg Closes #6508 --- src/nvim/syntax.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 1ed65ec52a..d5ff3707e8 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -5898,6 +5898,8 @@ static void syntime_report(void) static char *highlight_init_both[] = { "Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey", + "Cursor guibg=fg guifg=bg", + "lCursor guibg=fg guifg=bg", "DiffText cterm=bold ctermbg=Red gui=bold guibg=Red", "ErrorMsg ctermbg=DarkRed ctermfg=White guibg=Red guifg=White", "IncSearch cterm=reverse gui=reverse", -- cgit From 14b1becb5466003a65fa6be0517352abb7bc0f42 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Wed, 19 Apr 2017 03:20:05 +0300 Subject: doc: fix typo (#6504) --- src/nvim/buffer.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index e48b7846ae..1f44e1adb0 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1839,9 +1839,7 @@ int buflist_getfile(int n, linenr_T lnum, int options, int forceit) return FAIL; } -/* - * go to the last know line number for the current buffer - */ +// Go to the last known line number for the current buffer. void buflist_getfpos(void) { pos_T *fpos; @@ -2339,9 +2337,7 @@ linenr_T buflist_findlnum(buf_T *buf) return buflist_findfpos(buf)->lnum; } -/* - * List all know file names (for :files and :buffers command). - */ +// List all known file names (for :files and :buffers command). void buflist_list(exarg_T *eap) { buf_T *buf; -- cgit From c2f3e361c52ec4e7149ea1d8c6a1202e0873da8e Mon Sep 17 00:00:00 2001 From: ZyX Date: Wed, 19 Apr 2017 19:11:50 +0300 Subject: *: Add comment to all C files --- src/nvim/api/buffer.c | 3 +++ src/nvim/api/private/dispatch.c | 3 +++ src/nvim/api/private/handle.c | 3 +++ src/nvim/api/private/helpers.c | 3 +++ src/nvim/api/tabpage.c | 3 +++ src/nvim/api/ui.c | 3 +++ src/nvim/api/vim.c | 3 +++ src/nvim/api/window.c | 3 +++ src/nvim/arabic.c | 3 +++ src/nvim/buffer.c | 3 +++ src/nvim/charset.c | 3 +++ src/nvim/cursor.c | 3 +++ src/nvim/cursor_shape.c | 3 +++ src/nvim/diff.c | 3 +++ src/nvim/digraph.c | 3 +++ src/nvim/edit.c | 3 +++ src/nvim/eval.c | 3 +++ src/nvim/eval/decode.c | 3 +++ src/nvim/eval/encode.c | 3 +++ src/nvim/eval/executor.c | 3 +++ src/nvim/eval/gc.c | 3 +++ src/nvim/eval/typval.c | 3 +++ src/nvim/event/libuv_process.c | 3 +++ src/nvim/event/loop.c | 3 +++ src/nvim/event/multiqueue.c | 3 +++ src/nvim/event/process.c | 3 +++ src/nvim/event/rstream.c | 3 +++ src/nvim/event/signal.c | 3 +++ src/nvim/event/socket.c | 3 +++ src/nvim/event/stream.c | 3 +++ src/nvim/event/time.c | 3 +++ src/nvim/event/wstream.c | 3 +++ src/nvim/ex_cmds.c | 3 +++ src/nvim/ex_cmds2.c | 3 +++ src/nvim/ex_docmd.c | 3 +++ src/nvim/ex_eval.c | 3 +++ src/nvim/ex_getln.c | 3 +++ src/nvim/farsi.c | 3 +++ src/nvim/file_search.c | 3 +++ src/nvim/fileio.c | 3 +++ src/nvim/fold.c | 3 +++ src/nvim/garray.c | 3 +++ src/nvim/getchar.c | 3 +++ src/nvim/hardcopy.c | 3 +++ src/nvim/hashtab.c | 3 +++ src/nvim/if_cscope.c | 3 +++ src/nvim/indent.c | 3 +++ src/nvim/indent_c.c | 3 +++ src/nvim/keymap.c | 3 +++ src/nvim/log.c | 3 +++ src/nvim/main.c | 3 +++ src/nvim/map.c | 3 +++ src/nvim/mark.c | 3 +++ src/nvim/mbyte.c | 3 +++ src/nvim/memfile.c | 3 +++ src/nvim/memline.c | 3 +++ src/nvim/memory.c | 3 +++ src/nvim/menu.c | 3 +++ src/nvim/message.c | 3 +++ src/nvim/misc1.c | 3 +++ src/nvim/mouse.c | 3 +++ src/nvim/move.c | 3 +++ src/nvim/msgpack_rpc/channel.c | 3 +++ src/nvim/msgpack_rpc/helpers.c | 3 +++ src/nvim/msgpack_rpc/server.c | 3 +++ src/nvim/normal.c | 3 +++ src/nvim/ops.c | 3 +++ src/nvim/option.c | 3 +++ src/nvim/os/dl.c | 3 +++ src/nvim/os/env.c | 3 +++ src/nvim/os/fileio.c | 3 +++ src/nvim/os/fs.c | 3 +++ src/nvim/os/input.c | 3 +++ src/nvim/os/mem.c | 3 +++ src/nvim/os/pty_process_unix.c | 3 +++ src/nvim/os/shell.c | 3 +++ src/nvim/os/signal.c | 3 +++ src/nvim/os/stdpaths.c | 3 +++ src/nvim/os/time.c | 3 +++ src/nvim/os/users.c | 3 +++ src/nvim/os_unix.c | 3 +++ src/nvim/path.c | 3 +++ src/nvim/popupmnu.c | 3 +++ src/nvim/profile.c | 3 +++ src/nvim/quickfix.c | 3 +++ src/nvim/rbuffer.c | 3 +++ src/nvim/regexp.c | 3 +++ src/nvim/regexp_nfa.c | 3 +++ src/nvim/screen.c | 3 +++ src/nvim/search.c | 3 +++ src/nvim/sha256.c | 3 +++ src/nvim/shada.c | 3 +++ src/nvim/spell.c | 3 +++ src/nvim/spellfile.c | 3 +++ src/nvim/state.c | 3 +++ src/nvim/strings.c | 3 +++ src/nvim/syntax.c | 3 +++ src/nvim/tag.c | 3 +++ src/nvim/terminal.c | 3 +++ src/nvim/testdir/samples/memfile_test.c | 3 +++ src/nvim/tui/input.c | 3 +++ src/nvim/tui/tui.c | 3 +++ src/nvim/ugrid.c | 3 +++ src/nvim/ui.c | 3 +++ src/nvim/ui_bridge.c | 3 +++ src/nvim/undo.c | 3 +++ src/nvim/version.c | 3 +++ src/nvim/window.c | 3 +++ 108 files changed, 324 insertions(+) (limited to 'src') diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 26f9a6f592..1b3592679b 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + // Much of this code was adapted from 'if_py_both.h' from the original // vim source #include diff --git a/src/nvim/api/private/dispatch.c b/src/nvim/api/private/dispatch.c index 9b3bcc380a..f8eebcdb10 100644 --- a/src/nvim/api/private/dispatch.c +++ b/src/nvim/api/private/dispatch.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/api/private/handle.c b/src/nvim/api/private/handle.c index acb0fb332a..eb96192af2 100644 --- a/src/nvim/api/private/handle.c +++ b/src/nvim/api/private/handle.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index fe15b28041..5877b848fc 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/api/tabpage.c b/src/nvim/api/tabpage.c index 0f0c33f621..29592408fc 100644 --- a/src/nvim/api/tabpage.c +++ b/src/nvim/api/tabpage.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index de60339e5f..3cc2870792 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 6926436d2f..e5ef4a35c1 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c index 3c564ada99..e1bb70ee0d 100644 --- a/src/nvim/api/window.c +++ b/src/nvim/api/window.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/arabic.c b/src/nvim/arabic.c index db97bd9dc4..1ef51d2a2a 100644 --- a/src/nvim/arabic.c +++ b/src/nvim/arabic.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// @file arabic.c /// /// Functions for Arabic language. diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 1f44e1adb0..46f2cdac79 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * buffer.c: functions for dealing with the buffer structure */ diff --git a/src/nvim/charset.c b/src/nvim/charset.c index 3037cfe669..ee58e0af91 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// @file charset.c /// /// Code related to character sets. diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c index 45abd314fc..60002f3cea 100644 --- a/src/nvim/cursor.c +++ b/src/nvim/cursor.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c index 34ee53bf75..24a5672d0f 100644 --- a/src/nvim/cursor_shape.c +++ b/src/nvim/cursor_shape.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include "nvim/vim.h" diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 49574fbbfc..0bd3f59cf2 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// @file diff.c /// /// Code for diff'ing two, three or four buffers. diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c index 66fb525920..32e71f61f7 100644 --- a/src/nvim/digraph.c +++ b/src/nvim/digraph.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// @file digraph.c /// /// code for digraphs diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 51d0847bc7..678fa851eb 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * edit.c: functions for Insert mode */ diff --git a/src/nvim/eval.c b/src/nvim/eval.c index dcbd7ab152..16f054957f 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * eval.c: Expression evaluation. */ diff --git a/src/nvim/eval/decode.c b/src/nvim/eval/decode.c index a7dc6b205d..8905317f15 100644 --- a/src/nvim/eval/decode.c +++ b/src/nvim/eval/decode.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c index d74913a481..e32f893faa 100644 --- a/src/nvim/eval/encode.c +++ b/src/nvim/eval/encode.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// @file encode.c /// /// File containing functions for encoding and decoding VimL values. diff --git a/src/nvim/eval/executor.c b/src/nvim/eval/executor.c index ec6c86ac64..91bb61323f 100644 --- a/src/nvim/eval/executor.c +++ b/src/nvim/eval/executor.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include "nvim/eval/typval.h" #include "nvim/eval/executor.h" #include "nvim/eval.h" diff --git a/src/nvim/eval/gc.c b/src/nvim/eval/gc.c index 5ce52ddd70..2bbf78d827 100644 --- a/src/nvim/eval/gc.c +++ b/src/nvim/eval/gc.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include "nvim/eval/typval.h" #include "nvim/eval/gc.h" diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 70ec3dfe39..a57dd42f6e 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index f5a41d151b..3116adbde8 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include diff --git a/src/nvim/event/loop.c b/src/nvim/event/loop.c index 0e1775d01b..6963978581 100644 --- a/src/nvim/event/loop.c +++ b/src/nvim/event/loop.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include diff --git a/src/nvim/event/multiqueue.c b/src/nvim/event/multiqueue.c index 79b4dd9458..a17bae31e3 100644 --- a/src/nvim/event/multiqueue.c +++ b/src/nvim/event/multiqueue.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + // Multi-level queue for selective async event processing. // Not threadsafe; access must be synchronized externally. // diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c index 4429a65f92..ffda10a494 100644 --- a/src/nvim/event/process.c +++ b/src/nvim/event/process.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include diff --git a/src/nvim/event/rstream.c b/src/nvim/event/rstream.c index 2737dad305..854af474b2 100644 --- a/src/nvim/event/rstream.c +++ b/src/nvim/event/rstream.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/event/signal.c b/src/nvim/event/signal.c index 11ce15a882..fec46da4ff 100644 --- a/src/nvim/event/signal.c +++ b/src/nvim/event/signal.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include "nvim/event/loop.h" diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c index 8f9327f3d4..e536d79a2a 100644 --- a/src/nvim/event/socket.c +++ b/src/nvim/event/socket.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include diff --git a/src/nvim/event/stream.c b/src/nvim/event/stream.c index 26083c20f4..860a957b3e 100644 --- a/src/nvim/event/stream.c +++ b/src/nvim/event/stream.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/event/time.c b/src/nvim/event/time.c index 77260546db..80289c27d1 100644 --- a/src/nvim/event/time.c +++ b/src/nvim/event/time.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include diff --git a/src/nvim/event/wstream.c b/src/nvim/event/wstream.c index fc7aad8eb9..f453e5898d 100644 --- a/src/nvim/event/wstream.c +++ b/src/nvim/event/wstream.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 9a847a4c0a..117ef6a507 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * ex_cmds.c: some functions for command line commands */ diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index eeace789b2..a1a32d9f52 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// @file ex_cmds2.c /// /// Some more functions for command line commands diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 17b3b512ef..7568d71ac0 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * ex_docmd.c: functions for executing an Ex command line. */ diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c index 65112c4dd8..5d664b94a8 100644 --- a/src/nvim/ex_eval.c +++ b/src/nvim/ex_eval.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + // TODO(ZyX-I): move to eval/executor /// @file ex_eval.c diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 0b6036ace9..1affdb2fe7 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * ex_getln.c: Functions for entering and editing an Ex command line. */ diff --git a/src/nvim/farsi.c b/src/nvim/farsi.c index 2d37d1284e..1053cb3ac2 100644 --- a/src/nvim/farsi.c +++ b/src/nvim/farsi.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// @file farsi.c /// /// Functions for Farsi language diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c index db745bdd15..8094a1b266 100644 --- a/src/nvim/file_search.c +++ b/src/nvim/file_search.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + // File searching functions for 'path', 'tags' and 'cdpath' options. // // External visible functions: diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 74fa5aa1de..3e062aecc0 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * fileio.c: read from and write to a file */ diff --git a/src/nvim/fold.c b/src/nvim/fold.c index 34db4d2171..2aa9a9cb5e 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + // vim: set fdm=marker fdl=1 fdc=3 /* diff --git a/src/nvim/garray.c b/src/nvim/garray.c index 9ed3b901ef..2d2af54c95 100644 --- a/src/nvim/garray.c +++ b/src/nvim/garray.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// @file garray.c /// /// Functions for handling growing arrays. diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index e056ff488c..9d32df5a68 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * getchar.c * diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c index b2cbe30a43..abc4773d84 100644 --- a/src/nvim/hardcopy.c +++ b/src/nvim/hardcopy.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * hardcopy.c: printing to paper */ diff --git a/src/nvim/hashtab.c b/src/nvim/hashtab.c index 354c9718ba..3397788b00 100644 --- a/src/nvim/hashtab.c +++ b/src/nvim/hashtab.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// @file hashtab.c /// /// Handling of a hashtable with Vim-specific properties. diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index b647b8146a..e1c7df9175 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * CSCOPE support for Vim added by Andy Kahn * Ported to Win32 by Sergey Khorev diff --git a/src/nvim/indent.c b/src/nvim/indent.c index 8fbad38495..5471b41b2c 100644 --- a/src/nvim/indent.c +++ b/src/nvim/indent.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c index 8f5547544d..4806f46705 100644 --- a/src/nvim/indent_c.c +++ b/src/nvim/indent_c.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c index 72b0d0aa40..0fe2ffe6f2 100644 --- a/src/nvim/keymap.c +++ b/src/nvim/keymap.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/log.c b/src/nvim/log.c index bbb4dfb944..d059e28d5d 100644 --- a/src/nvim/log.c +++ b/src/nvim/log.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/main.c b/src/nvim/main.c index 7ad42d6776..1095d4d3b5 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #define EXTERN #include #include diff --git a/src/nvim/map.c b/src/nvim/map.c index 73af487f90..54a9e559af 100644 --- a/src/nvim/map.c +++ b/src/nvim/map.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/mark.c b/src/nvim/mark.c index ae94ec7ecd..675fe4d57f 100644 --- a/src/nvim/mark.c +++ b/src/nvim/mark.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * mark.c: functions for setting marks and jumping to them */ diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index b18459a2b5..b21ec944c1 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// mbyte.c: Code specifically for handling multi-byte characters. /// Multibyte extensions partly by Sung-Hoon Baek /// diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c index 5d6639c4d0..efaf1f94c5 100644 --- a/src/nvim/memfile.c +++ b/src/nvim/memfile.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// An abstraction to handle blocks of memory which can be stored in a file. /// This is the implementation of a sort of virtual memory. /// diff --git a/src/nvim/memline.c b/src/nvim/memline.c index b31ca136dd..40a6761225 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* for debugging */ /* #define CHECK(c, s) if (c) EMSG(s) */ #define CHECK(c, s) diff --git a/src/nvim/memory.c b/src/nvim/memory.c index 85ec916ba0..0ee4776581 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + // Various routines dealing with allocation and deallocation of memory. #include diff --git a/src/nvim/menu.c b/src/nvim/menu.c index 529978e3f0..4e621b49c1 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * Code for menus. Used for the GUI and 'wildmenu'. * GUI/Motif support by Robert Webb diff --git a/src/nvim/message.c b/src/nvim/message.c index 42e1fd1cf9..146937c25a 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * message.c: functions for displaying messages on the command line */ diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 8d93505be3..6de74fddf2 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * misc1.c: functions that didn't seem to fit elsewhere */ diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c index 2ebe199f47..6088488388 100644 --- a/src/nvim/mouse.c +++ b/src/nvim/mouse.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include "nvim/mouse.h" diff --git a/src/nvim/move.c b/src/nvim/move.c index 4feabf624b..d5be4cb8c3 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * move.c: Functions for moving the cursor and scrolling text. * diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index 259dcc523c..b2c6ef852c 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/msgpack_rpc/helpers.c b/src/nvim/msgpack_rpc/helpers.c index 4d8a9984e1..967ce31c1b 100644 --- a/src/nvim/msgpack_rpc/helpers.c +++ b/src/nvim/msgpack_rpc/helpers.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/msgpack_rpc/server.c b/src/nvim/msgpack_rpc/server.c index d7c2926a0f..b6958088ca 100644 --- a/src/nvim/msgpack_rpc/server.c +++ b/src/nvim/msgpack_rpc/server.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 7f087dcd20..51da9429b6 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * normal.c: Contains the main routine for processing characters in command * mode. Communicates closely with the code in ops.c to handle diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 6ea3a45049..c77781b1d1 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * ops.c: implementation of various operators: op_shift, op_delete, op_tilde, * op_change, op_yank, do_put, do_join diff --git a/src/nvim/option.c b/src/nvim/option.c index 0070a0056d..bade4af8e3 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + // User-settable options. Checklist for adding a new option: // - Put it in options.lua // - For a global option: Add a variable for it in option_defs.h. diff --git a/src/nvim/os/dl.c b/src/nvim/os/dl.c index fef02cc784..267cf5ae4b 100644 --- a/src/nvim/os/dl.c +++ b/src/nvim/os/dl.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// Functions for using external native libraries #include diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index f3187de182..72bd0bf788 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + // Environment inspection #include diff --git a/src/nvim/os/fileio.c b/src/nvim/os/fileio.c index 27eb448c3d..4309ac723c 100644 --- a/src/nvim/os/fileio.c +++ b/src/nvim/os/fileio.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// @file fileio.c /// /// Buffered reading/writing to a file. Unlike fileio.c this is not dealing with diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index c33e1140e8..c39ff5d358 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + // fs.c -- filesystem access #include #include diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c index 5f0f2ec677..80457eaa14 100644 --- a/src/nvim/os/input.c +++ b/src/nvim/os/input.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/os/mem.c b/src/nvim/os/mem.c index 871ece7a0e..eccb3c97e5 100644 --- a/src/nvim/os/mem.c +++ b/src/nvim/os/mem.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// Functions for accessing system memory information. #include diff --git a/src/nvim/os/pty_process_unix.c b/src/nvim/os/pty_process_unix.c index 71a5e13de5..eb9335b03c 100644 --- a/src/nvim/os/pty_process_unix.c +++ b/src/nvim/os/pty_process_unix.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + // Some of the code came from pangoterm and libuv #include #include diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index 29c0431521..fc8ab7dc8f 100644 --- a/src/nvim/os/shell.c +++ b/src/nvim/os/shell.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/os/signal.c b/src/nvim/os/signal.c index 1ac6d3f5e1..fd6d3b32e4 100644 --- a/src/nvim/os/signal.c +++ b/src/nvim/os/signal.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include diff --git a/src/nvim/os/stdpaths.c b/src/nvim/os/stdpaths.c index afb9bdec31..a41fb7c621 100644 --- a/src/nvim/os/stdpaths.c +++ b/src/nvim/os/stdpaths.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include "nvim/os/stdpaths_defs.h" diff --git a/src/nvim/os/time.c b/src/nvim/os/time.c index 8ce2ecf4f4..c471352c02 100644 --- a/src/nvim/os/time.c +++ b/src/nvim/os/time.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/os/users.c b/src/nvim/os/users.c index 1c94ef0067..82bb918f70 100644 --- a/src/nvim/os/users.c +++ b/src/nvim/os/users.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + // users.c -- operating system user information #include diff --git a/src/nvim/os_unix.c b/src/nvim/os_unix.c index acd86f06dc..c5a42204be 100644 --- a/src/nvim/os_unix.c +++ b/src/nvim/os_unix.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * os_unix.c -- code for all flavors of Unix (BSD, SYSV, SVR4, POSIX, ...) * diff --git a/src/nvim/path.c b/src/nvim/path.c index 205fc2ed62..12952f49db 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c index 6346951c05..6e81c5a171 100644 --- a/src/nvim/popupmnu.c +++ b/src/nvim/popupmnu.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// @file popupmnu.c /// /// Popup menu (PUM) diff --git a/src/nvim/profile.c b/src/nvim/profile.c index 97d7d77359..8fb8e92add 100644 --- a/src/nvim/profile.c +++ b/src/nvim/profile.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 1241841885..112498ae20 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * quickfix.c: functions for quickfix mode, using a file with error messages */ diff --git a/src/nvim/rbuffer.c b/src/nvim/rbuffer.c index 111af0d0fb..18d453cbe9 100644 --- a/src/nvim/rbuffer.c +++ b/src/nvim/rbuffer.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 7be89c2d7e..7a00ee27bb 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * Handling of regular expressions: vim_regcomp(), vim_regexec(), vim_regsub() * diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index 506e6277e9..139772d51e 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * NFA regular expression implementation. * diff --git a/src/nvim/screen.c b/src/nvim/screen.c index a8993be4e5..818c2c577d 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * screen.c: code for displaying on the screen * diff --git a/src/nvim/search.c b/src/nvim/search.c index 91a558045f..c662e3ba40 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * search.c: code for normal mode searching commands */ diff --git a/src/nvim/sha256.c b/src/nvim/sha256.c index c72dafd08e..a2378cc202 100644 --- a/src/nvim/sha256.c +++ b/src/nvim/sha256.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// @file sha256.c /// /// FIPS-180-2 compliant SHA-256 implementation diff --git a/src/nvim/shada.c b/src/nvim/shada.c index 8c5d6dff65..a6d8cb6563 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 17016be35f..25ae562e65 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + // spell.c: code for spell checking // // See spellfile.c for the Vim spell file format. diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index 1da71dc4f9..d34d69b3a4 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + // spellfile.c: code for reading and writing spell files. // // See spell.c for information about spell checking. diff --git a/src/nvim/state.c b/src/nvim/state.c index 44c6441e40..210708c3f4 100644 --- a/src/nvim/state.c +++ b/src/nvim/state.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include "nvim/lib/kvec.h" diff --git a/src/nvim/strings.c b/src/nvim/strings.c index 8a1a3beddd..743b43c2e5 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index d5ff3707e8..ce48547163 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * syntax.c: code for syntax highlighting */ diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 0c7244cbb3..b8b86bf979 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * Code to handle tags and the tag stack */ diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 85c4950b42..19b9bdc19f 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + // VT220/xterm-like terminal emulator. // Powered by libvterm http://www.leonerd.org.uk/code/libvterm // diff --git a/src/nvim/testdir/samples/memfile_test.c b/src/nvim/testdir/samples/memfile_test.c index 0fa1e14c40..3c8f108255 100644 --- a/src/nvim/testdir/samples/memfile_test.c +++ b/src/nvim/testdir/samples/memfile_test.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c index 8e5adb14f9..3f2ccd4746 100644 --- a/src/nvim/tui/input.c +++ b/src/nvim/tui/input.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include "nvim/tui/input.h" #include "nvim/vim.h" diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index f34f5f1bc4..941fdb2570 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + // Terminal UI functions. Invoked (by ui_bridge.c) on the TUI thread. #include diff --git a/src/nvim/ugrid.c b/src/nvim/ugrid.c index 127b18feb6..7a0a16687e 100644 --- a/src/nvim/ugrid.c +++ b/src/nvim/ugrid.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/ui.c b/src/nvim/ui.c index 28f71b7ef2..cfa186987c 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include diff --git a/src/nvim/ui_bridge.c b/src/nvim/ui_bridge.c index 9f780663ac..2c70b46c14 100644 --- a/src/nvim/ui_bridge.c +++ b/src/nvim/ui_bridge.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + // UI wrapper that sends requests to the UI thread. // Used by the built-in TUI and libnvim-based UIs. diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 571ad7204f..290d5d7553 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /* * undo.c: multi level undo facility * diff --git a/src/nvim/version.c b/src/nvim/version.c index 9a5d7ce169..29ce741ba0 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// @file version.c /// /// Nvim was forked from Vim 7.4.160. diff --git a/src/nvim/window.c b/src/nvim/window.c index 6020159af9..60bba19b07 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + #include #include #include -- cgit From d194380de93023c8901eb77b2820b0f74e8a5283 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 16 Apr 2017 17:42:41 +0200 Subject: vim-patch:e4a3bcf28d92 Updated runtime files. Add Scala files. https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5 --- src/nvim/po/fi.po | 7869 +++++++++++++++++++++++++---------------------------- 1 file changed, 3774 insertions(+), 4095 deletions(-) (limited to 'src') diff --git a/src/nvim/po/fi.po b/src/nvim/po/fi.po index d30faeb554..d817144151 100644 --- a/src/nvim/po/fi.po +++ b/src/nvim/po/fi.po @@ -1,247 +1,419 @@ # Finnish translation for Vim. # Copyright (C) 2003-2006 Free Software Foundation, Inc. -# 2007-2010, Flammie Pirinen +# 2007-2016, Flammie Pirinen # -# Vimin kyttjt on nrttej. Sanasto on jargonia :-p -# -# Lhinn latin-1:t, sill vim pit portata ilmeisen obskuureille -# alustoille. Mys: pluralit puuttuu, ohjelman kyttliittymn fontti -# tasavlinen, tila rajattu, jne. jne., luovia ratkaisuja edess. +# Jargonia ei ole yritetty suotta kotoperäistää missä teknisempi lainasanasto +# tulee paremmin kyseeseen. # # Sanastosta: -# Fold on sellainen moderneissa ohjelmointi-IDE:iss oleva toiminto, jolla -# lohko koodia esim. funktio piilotetaan nkymst: suom. taitos alkup. +# * Fold on sellainen moderneissa ohjelmointi-IDE:issä oleva toiminto, jolla +# lohko koodia esim. funktio piilotetaan näkymästä: suom. taitos alkup. # analogian mukaan -# source v. lataa tiedoston, kuten bash-komento source (tai .) +# * source, v. lataa tiedoston, kuten bash-komento source (tai .) +# * dictionary (dict) on vaihtelevasti sanakirja tai tietorakenne # msgid "" msgstr "" "Project-Id-Version: Vim 7\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-05-26 14:21+0200\n" -"PO-Revision-Date: 2010-08-09 02:35+0300\n" -"Last-Translator: Flammie Pirinen \n" +"POT-Creation-Date: 2017-04-19 16:46+0200\n" +"PO-Revision-Date: 2016-08-29 11:27+0200\n" +"Last-Translator: Flammie A Pirinen \n" "Language-Team: Finnish \n" "Language: fi\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: ../api/private/helpers.c:201 #, fuzzy -msgid "Unable to get option value" -msgstr "Roskaa argumentin perss" +#~ msgid "Index out of bounds" +#~ msgstr "ei löytynyt " -#: ../api/private/helpers.c:204 -msgid "internal error: unknown option type" -msgstr "" +#, fuzzy +#~ msgid "Line index is too high" +#~ msgstr "ikkunan indeksi alueen ulkopuolella" + +#~ msgid "Argument \"start\" is higher than \"end\"" +#~ msgstr "" + +#~ msgid "All items in the replacement array must be strings" +#~ msgstr "" + +msgid "string cannot contain newlines" +msgstr "merkkijono ei saa sisältää rivinvaihtoja" + +#, fuzzy +#~ msgid "Failed to save undo information" +#~ msgstr "ei voitu tallentaa kumoustietoja" + +#, fuzzy +#~ msgid "Failed to delete line" +#~ msgstr "ei voitu poistaa riviä" + +#~ msgid "Index value is too high" +#~ msgstr "" + +#, fuzzy +#~ msgid "Failed to replace line" +#~ msgstr "ei voitu korvata riviä" + +#, fuzzy +#~ msgid "Failed to insert line" +#~ msgstr "ei voitu lisätä riviä" + +#, fuzzy +#~ msgid "Failed to rename buffer" +#~ msgstr "ei voity uudelleennimetä puskuria" + +#, fuzzy +#~ msgid "Mark name must be a single character" +#~ msgstr "merkin nimen pitää olla yksi merkki" + +#, fuzzy +#~ msgid "Invalid mark name" +#~ msgstr "virheellinen merkin nimi" + +#, fuzzy +#~ msgid "Line number outside range" +#~ msgstr "rivinumero arvoalueen ulkopuolella" + +#, fuzzy +#~ msgid "Column value outside range" +#~ msgstr "rivinumero arvoalueen ulkopuolella" + +#, fuzzy +#~ msgid "Keyboard interrupt" +#~ msgstr "näppäimistökeskeytys" + +#, fuzzy +#~ msgid "Key not found" +#~ msgstr "ei löytynyt " + +#, fuzzy +#~ msgid "Dictionary is locked" +#~ msgstr "dictionary on lukittu" + +#, fuzzy +#~ msgid "Empty variable names aren't allowed" +#~ msgstr "tyhjiä avaimia ei voi käyttää" + +#, fuzzy +#~ msgid "Key length is too high" +#~ msgstr "Liian pitkä polku" + +#, c-format +#~ msgid "Key is read-only: %s" +#~ msgstr "" + +#, c-format +#~ msgid "Key is fixed: %s" +#~ msgstr "" + +#, fuzzy, c-format +#~ msgid "Key is locked: %s" +#~ msgstr "E741: Arvo on lukittu: %s" + +#. Doesn't exist, fail +#, fuzzy, c-format +#~ msgid "Key \"%s\" doesn't exist" +#~ msgstr "Tiedostoa %s ei ole" + +#, fuzzy +#~ msgid "Empty option name" +#~ msgstr "E792: tyhjä valikkonimi" + +#, fuzzy, c-format +#~ msgid "Invalid option name \"%s\"" +#~ msgstr "E755: Virheellinen alue kohteelle %s" + +#, fuzzy, c-format +#~ msgid "Unable to get value for option \"%s\"" +#~ msgstr "ei voi tyhjentää yleistä asetusta %s" + +#, fuzzy, c-format +#~ msgid "Unknown type for option \"%s\"" +#~ msgstr "E113: Tuntematon asetus: %s" + +#, fuzzy, c-format +#~ msgid "Unable to unset option \"%s\"" +#~ msgstr "ei voi tyhjentää yleistä asetusta %s" + +#, fuzzy, c-format +#~ msgid "Cannot unset option \"%s\" because it doesn't have a global value" +#~ msgstr "ei voi tyhjentää asetusta %s jolla ei ole yleistä arvoa" + +#, c-format +#~ msgid "Option \"%s\" requires a boolean value" +#~ msgstr "" + +#, fuzzy, c-format +#~ msgid "Option \"%s\" requires an integer value" +#~ msgstr "E709: [:] toimii vain listalla" + +#, c-format +#~ msgid "Value for option \"%s\" is outside range" +#~ msgstr "" + +#, fuzzy, c-format +#~ msgid "Option \"%s\" requires a string value" +#~ msgstr "E709: [:] toimii vain listalla" + +#, fuzzy +#~ msgid "Invalid buffer id" +#~ msgstr "virheellinen puskurinumero" + +#, fuzzy +#~ msgid "Invalid window id" +#~ msgstr "E534: Viallinen leveä fontti" + +#, fuzzy +#~ msgid "Invalid tabpage id" +#~ msgstr "Väärä argumentti valitsimelle" + +#~ msgid "Integer value outside range" +#~ msgstr "" + +#, fuzzy +#~ msgid "Empty dictionary keys aren't allowed" +#~ msgstr "tyhjiä avaimia ei voi käyttää" + +#, fuzzy +#~ msgid "Problem while switching windows" +#~ msgstr "virhe ikkunaa vaihtaessa" + +#, fuzzy +#~ msgid "UI already attached for channel" +#~ msgstr "Vanhimmassa muutoksessa" + +#~ msgid "Expected width > 0 and height > 0" +#~ msgstr "" + +#~ msgid "UI is not attached for channel" +#~ msgstr "" + +#~ msgid "rgb must be a Boolean" +#~ msgstr "" + +#~ msgid "popupmenu_external must be a Boolean" +#~ msgstr "" + +#, fuzzy +#~ msgid "No such ui option" +#~ msgstr "E24: Lyhennettä ei ole" + +#~ msgid "Function called with too many arguments." +#~ msgstr "" + +#~ msgid "Error calling function." +#~ msgstr "" + +#, fuzzy +#~ msgid "String length is too high" +#~ msgstr "Liian pitkä polku" + +#~ msgid "Directory string is too long" +#~ msgstr "" + +#, fuzzy +#~ msgid "Failed to change directory" +#~ msgstr "hakemistoa ei voitu muuttaa" + +#, fuzzy, c-format +#~ msgid "Failed to switch to buffer %d" +#~ msgstr "ei voitu vaihtaa puskuriin %d" + +#, fuzzy, c-format +#~ msgid "Failed to switch to window %d" +#~ msgstr "ei voitu vaihtaa puskuriin %d" + +#, fuzzy, c-format +#~ msgid "Failed to switch to tabpage %d" +#~ msgstr "ei voitu vaihtaa puskuriin %d" + +#~ msgid "All items in calls array must be arrays" +#~ msgstr "" + +#~ msgid "All items in calls array must be arrays of size 2" +#~ msgstr "" + +#~ msgid "name must be String" +#~ msgstr "" + +#~ msgid "args must be Array" +#~ msgstr "" + +# datarakenteita +#, fuzzy +#~ msgid "Argument \"pos\" must be a [row, col] array" +#~ msgstr "E712: Argumentin %s pitää olla lista tai sanakirja" + +#, fuzzy +#~ msgid "Cursor position outside buffer" +#~ msgstr "kursorin sijainti puskurin ulkopuolella" + +#~ msgid "Height value outside range" +#~ msgstr "" + +#~ msgid "Width value outside range" +#~ msgstr "" -#: ../buffer.c:92 msgid "[Location List]" msgstr "[Sijaintiluettelo]" -#: ../buffer.c:93 msgid "[Quickfix List]" msgstr "[Pikakorjausluettelo]" -#: ../buffer.c:94 -#, fuzzy msgid "E855: Autocommands caused command to abort" -msgstr "E812: Autocommands muutti puskurin tai sen nimen" +msgstr "E855: Autocommands lopetti komennon" -#: ../buffer.c:135 msgid "E82: Cannot allocate any buffer, exiting..." -msgstr "E82: Mitn puskuria ei voitu varata, lopetetaan..." +msgstr "E82: Mitään puskuria ei voitu varata, lopetetaan..." -#: ../buffer.c:138 msgid "E83: Cannot allocate buffer, using other one..." -msgstr "E83: Puskuria ei voitu varata, kytetn toista..." +msgstr "E83: Puskuria ei voitu varata, käytetään toista..." + +#, fuzzy +#~ msgid "E937: Attempt to delete a buffer that is in use" +#~ msgstr "E934: Ei voida hypätä puskuriin jolla ei ole nimeä" -#: ../buffer.c:763 msgid "E515: No buffers were unloaded" msgstr "E515: Puskureita ei vapautettu" -#: ../buffer.c:765 msgid "E516: No buffers were deleted" msgstr "E516: Puskureita ei poistettu" -#: ../buffer.c:767 msgid "E517: No buffers were wiped out" msgstr "E517: Puskureita ei pyyhitty" -#: ../buffer.c:772 msgid "1 buffer unloaded" msgstr "1 puskuri vapautettiin" -#: ../buffer.c:774 #, c-format msgid "%d buffers unloaded" msgstr "%d puskuria vapautettiin" -#: ../buffer.c:777 msgid "1 buffer deleted" msgstr "1 puskuri poistettu" -#: ../buffer.c:779 #, c-format msgid "%d buffers deleted" msgstr "%d puskuria poistettu" -#: ../buffer.c:782 msgid "1 buffer wiped out" msgstr "1 puskuri pyyhitty" -#: ../buffer.c:784 #, c-format msgid "%d buffers wiped out" msgstr "%d puskuria pyyhitty" -#: ../buffer.c:806 msgid "E90: Cannot unload last buffer" -msgstr "E90: Ei voi vapauttaa viimeist puskuria" +msgstr "E90: Ei voi vapauttaa viimeistä puskuria" -#: ../buffer.c:874 msgid "E84: No modified buffer found" msgstr "E84: Ei muokattuja puskureita" #. back where we started, didn't find anything. -#: ../buffer.c:903 msgid "E85: There is no listed buffer" msgstr "E85: Luetteloitua puskuria ei ole" -#: ../buffer.c:913 -#, c-format -msgid "E86: Buffer % does not exist" -msgstr "E86: Puskuria % ei ole" - -#: ../buffer.c:915 msgid "E87: Cannot go beyond last buffer" -msgstr "E87: Viimeisen puskurin ohi ei voi edet" +msgstr "E87: Viimeisen puskurin ohi ei voi edetä" -#: ../buffer.c:917 msgid "E88: Cannot go before first buffer" -msgstr "E88: Ensimmisen puskurin ohi ei voi edet" +msgstr "E88: Ensimmäisen puskurin ohi ei voi edetä" -#: ../buffer.c:945 -#, c-format +#, fuzzy, c-format +#~ msgid "E89: %s will be killed(add ! to override)" +#~ msgstr "E189: %s on jo olemassa (lisää komentoon ! ohittaaksesi)" + +#, fuzzy, c-format msgid "" "E89: No write since last change for buffer % (add ! to override)" msgstr "" -"E89: Puskurin % muutoksia ei ole tallennettu (lis komentoon ! " +"E89: Puskurin %ld muutoksia ei ole tallennettu (lisää komentoon ! " "ohittaaksesi)" #. wrap around (may cause duplicates) -#: ../buffer.c:1423 msgid "W14: Warning: List of file names overflow" msgstr "W14: Varoitus: Tiedostonimiluettelon ylivuoto" -#: ../buffer.c:1555 ../quickfix.c:3361 -#, c-format -msgid "E92: Buffer % not found" -msgstr "E92: Puskuria % ei lydy" +#, fuzzy, c-format +#~ msgid "E92: Buffer % not found" +#~ msgstr "E92: Puskuria %ld ei löydy" -#: ../buffer.c:1798 #, c-format msgid "E93: More than one match for %s" -msgstr "E93: %s tsm useampaan kuin yhteen puskuriin" +msgstr "E93: %s täsmää useampaan kuin yhteen puskuriin" -#: ../buffer.c:1800 #, c-format msgid "E94: No matching buffer for %s" -msgstr "E94: %s ei tsm yhteenkn puskuriin" +msgstr "E94: %s ei täsmää yhteenkään puskuriin" -#: ../buffer.c:2161 -#, c-format -msgid "line %" -msgstr "rivi %" +#, fuzzy, c-format +#~ msgid "line %" +#~ msgstr "rivi %ld" -#: ../buffer.c:2233 msgid "E95: Buffer with this name already exists" msgstr "E95: Samanniminen puskuri on jo olemassa" -#: ../buffer.c:2498 msgid " [Modified]" msgstr " [Muokattu]" -#: ../buffer.c:2501 msgid "[Not edited]" msgstr "[Muokkaamaton]" -#: ../buffer.c:2504 msgid "[New file]" msgstr "[Uusi tiedosto]" -#: ../buffer.c:2505 msgid "[Read errors]" -msgstr "[Lukuvirheit]" +msgstr "[Lukuvirheitä]" -#: ../buffer.c:2506 ../buffer.c:3217 ../fileio.c:1807 ../screen.c:4895 msgid "[RO]" msgstr "[Luku]" -#: ../buffer.c:2507 ../fileio.c:1807 msgid "[readonly]" msgstr "[kirjoitussuojattu]" -#: ../buffer.c:2524 #, c-format msgid "1 line --%d%%--" msgstr "1 rivi --%d %%--" -#: ../buffer.c:2526 -#, c-format -msgid "% lines --%d%%--" -msgstr "% rivi --%d %%--" +#, fuzzy, c-format +#~ msgid "% lines --%d%%--" +#~ msgstr "%ld riviä --%d %%--" -#: ../buffer.c:2530 -#, c-format -msgid "line % of % --%d%%-- col " -msgstr "rivi %/% --%d %%-- sarake " +#, fuzzy, c-format +#~ msgid "line % of % --%d%%-- col " +#~ msgstr "rivi %ld/%ld --%d %%-- sarake " -#: ../buffer.c:2632 ../buffer.c:4292 ../memline.c:1554 msgid "[No Name]" -msgstr "[Nimetn]" +msgstr "[Nimetön]" #. must be a help buffer -#: ../buffer.c:2667 msgid "help" msgstr "ohje" -#: ../buffer.c:3225 ../screen.c:4883 msgid "[Help]" msgstr "[Ohje]" -#: ../buffer.c:3254 ../screen.c:4887 msgid "[Preview]" msgstr "[Esikatselu]" # sijainti tiedostossa -indikaattoreja: -# 4 merkki sais riitt -#: ../buffer.c:3528 +# 4 merkkiä sais riittää msgid "All" msgstr "Kaik" -#: ../buffer.c:3528 msgid "Bot" msgstr "Loppu" -#: ../buffer.c:3531 msgid "Top" msgstr "Alku" -#: ../buffer.c:4244 -msgid "" -"\n" -"# Buffer list:\n" -msgstr "" -"\n" -"# Puskuriluettelo:\n" - -#: ../buffer.c:4289 msgid "[Scratch]" msgstr "[Raapust]" -#: ../buffer.c:4529 msgid "" "\n" "--- Signs ---" @@ -249,795 +421,669 @@ msgstr "" "\n" "--- Merkit ---" -#: ../buffer.c:4538 #, c-format msgid "Signs for %s:" msgstr "Merkit kohteelle %s:" -#: ../buffer.c:4543 -#, c-format -msgid " line=% id=%d name=%s" -msgstr " rivi=% id=%d nimi=%s" +#, fuzzy, c-format +#~ msgid " line=% id=%d name=%s" +#~ msgstr " rivi=%ld id=%d nimi=%s" -#: ../cursor_shape.c:68 msgid "E545: Missing colon" msgstr "E545: Kaksoispiste puuttuu" -#: ../cursor_shape.c:70 ../cursor_shape.c:94 msgid "E546: Illegal mode" msgstr "E546: Virheellinen tila" -#: ../cursor_shape.c:134 msgid "E548: digit expected" -msgstr "E548: pit olla numero" +msgstr "E548: pitää olla numero" -#: ../cursor_shape.c:138 msgid "E549: Illegal percentage" msgstr "E549: Virheellinen prosenttiluku" -#: ../diff.c:146 -#, c-format -msgid "E96: Can not diff more than % buffers" -msgstr "E96: Ei voi diffata enemp kuin % puskuria" +#, fuzzy, c-format +#~ msgid "E96: Cannot diff more than % buffers" +#~ msgstr "E96: Ei voi diffata enempää kuin %ld puskuria" -#: ../diff.c:753 msgid "E810: Cannot read or write temp files" -msgstr "E810: Ei voi lukea tai kirjoittaa vliaikaistiedostoja" +msgstr "E810: Ei voi lukea tai kirjoittaa väliaikaistiedostoja" -#: ../diff.c:755 msgid "E97: Cannot create diffs" -msgstr "E97: Ei voi luoda diffej" +msgstr "E97: Ei voi luoda diffejä" -#: ../diff.c:966 msgid "E816: Cannot read patch output" msgstr "E816: Ei voi lukea patchin tulostetta" -#: ../diff.c:1220 msgid "E98: Cannot read diff output" msgstr "E98: Ei voi lukea diffin tulostetta" -#: ../diff.c:2081 msgid "E99: Current buffer is not in diff mode" -msgstr "E99: Tm puskuri ei ole diff-tilassa" +msgstr "E99: Tämä puskuri ei ole diff-tilassa" -#: ../diff.c:2100 msgid "E793: No other buffer in diff mode is modifiable" -msgstr "E793: Yksikn muu diff-tilan puskurit ei ole muokattavissa" +msgstr "E793: Yksikään muu diff-tilan puskurit ei ole muokattavissa" -#: ../diff.c:2102 msgid "E100: No other buffer in diff mode" -msgstr "E100: Yksikn muu puskuri ei ole diff-tilassa" +msgstr "E100: Yksikään muu puskuri ei ole diff-tilassa" -#: ../diff.c:2112 msgid "E101: More than two buffers in diff mode, don't know which one to use" -msgstr "E101: Monta puskuria on diff-tilassa, kytettvn valinta ei onnistu" +msgstr "E101: Monta puskuria on diff-tilassa, käytettävän valinta ei onnistu" -#: ../diff.c:2141 #, c-format msgid "E102: Can't find buffer \"%s\"" -msgstr "E102: Puskuria %s ei lydy" +msgstr "E102: Puskuria %s ei löydy" -#: ../diff.c:2152 #, c-format msgid "E103: Buffer \"%s\" is not in diff mode" msgstr "E103: Puskuri %s ei ole diff-tilassa" -#: ../diff.c:2193 msgid "E787: Buffer changed unexpectedly" msgstr "E787: Puskuri vaihtui odottamatta" -#: ../digraph.c:1598 msgid "E104: Escape not allowed in digraph" -msgstr "E104: Escapea ei voi kytt digraafissa" +msgstr "E104: Escapea ei voi käyttää digraafissa" -#: ../digraph.c:1760 msgid "E544: Keymap file not found" -msgstr "E544: Nppinkarttaa ei lydy" +msgstr "E544: Näppäinkarttaa ei löydy" -#: ../digraph.c:1785 msgid "E105: Using :loadkeymap not in a sourced file" -msgstr "E105: Kytetn :loadkeymapia ladatun tiedoston ulkopuolella" +msgstr "E105: Käytetään :loadkeymapia ladatun tiedoston ulkopuolella" -#: ../digraph.c:1821 msgid "E791: Empty keymap entry" -msgstr "E791: Tyhj keymap-kentt" +msgstr "E791: Tyhjä keymap-kenttä" -#: ../edit.c:82 msgid " Keyword completion (^N^P)" -msgstr " Avainsanatydennys (^N^P)" +msgstr " Avainsanatäydennys (^N^P)" #. ctrl_x_mode == 0, ^P/^N compl. -#: ../edit.c:83 msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" msgstr " ^X-tila (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" -#: ../edit.c:85 msgid " Whole line completion (^L^N^P)" -msgstr " Tysrivitydennys (^L^N^P)" +msgstr " Täysrivitäydennys (^L^N^P)" -#: ../edit.c:86 msgid " File name completion (^F^N^P)" -msgstr " Tiedostonimitydennys (^F^N^P)" +msgstr " Tiedostonimitäydennys (^F^N^P)" -#: ../edit.c:87 msgid " Tag completion (^]^N^P)" -msgstr " Tgitydennys (^]^N^P)" +msgstr " Tägitäydennys (^]^N^P)" -#: ../edit.c:88 msgid " Path pattern completion (^N^P)" -msgstr " Polkukuviotydennys (^N^P)" +msgstr " Polkukuviotäydennys (^N^P)" -#: ../edit.c:89 msgid " Definition completion (^D^N^P)" -msgstr " Mritelmtydennys (^D^N^P)" +msgstr " Määritelmätäydennys (^D^N^P)" -#: ../edit.c:91 msgid " Dictionary completion (^K^N^P)" -msgstr " Sanakirjatydennys (^K^N^P)" +msgstr " Sanakirjatäydennys (^K^N^P)" -#: ../edit.c:92 msgid " Thesaurus completion (^T^N^P)" -msgstr " Thesaurus-tydennys (^T^N^P)" +msgstr " Thesaurus-täydennys (^T^N^P)" -#: ../edit.c:93 msgid " Command-line completion (^V^N^P)" -msgstr " Komentorivitydennys (^V^N^P)" +msgstr " Komentorivitäydennys (^V^N^P)" -#: ../edit.c:94 msgid " User defined completion (^U^N^P)" -msgstr " Kyttjn mrittelem tydennys (^U^N^P)" +msgstr " Käyttäjän määrittelemä täydennys (^U^N^P)" -#: ../edit.c:95 msgid " Omni completion (^O^N^P)" -msgstr " Omnitydennys (^O^N^P)" +msgstr " Omnitäydennys (^O^N^P)" -#: ../edit.c:96 msgid " Spelling suggestion (s^N^P)" msgstr " Oikaisulukuehdotus (s^N^P)" -#: ../edit.c:97 msgid " Keyword Local completion (^N^P)" -msgstr " Avainsanan paikallinen tydennys (^N^P)" +msgstr " Avainsanan paikallinen täydennys (^N^P)" -#: ../edit.c:100 msgid "Hit end of paragraph" msgstr "Kappaleen loppu tuli vastaan" -#: ../edit.c:101 -#, fuzzy msgid "E839: Completion function changed window" -msgstr "E813: Ei voi sulkea autocmd-ikkunaa" +msgstr "E839: Täydennys vaihtoi ikkunaa" -#: ../edit.c:102 msgid "E840: Completion function deleted text" -msgstr "" +msgstr "E840: Täydennys poisti tekstiä" -#: ../edit.c:1847 msgid "'dictionary' option is empty" -msgstr "dictionary-asetus on tyhj" +msgstr "dictionary-asetus on tyhjä" -#: ../edit.c:1848 msgid "'thesaurus' option is empty" -msgstr "thesaurus-asetus on tyhj" +msgstr "thesaurus-asetus on tyhjä" -#: ../edit.c:2655 #, c-format msgid "Scanning dictionary: %s" msgstr "Luetaan sanakirjaa: %s" -#: ../edit.c:3079 msgid " (insert) Scroll (^E/^Y)" -msgstr " (sytt) Vieritys (^E/^Y)" +msgstr " (syöttö) Vieritys (^E/^Y)" -#: ../edit.c:3081 msgid " (replace) Scroll (^E/^Y)" msgstr " (korvaus) Vieritys (^E/^Y)" -#: ../edit.c:3587 #, c-format msgid "Scanning: %s" msgstr "Luetaan: %s" -#: ../edit.c:3614 msgid "Scanning tags." -msgstr "Luetaan tgej." +msgstr "Luetaan tägejä." -#: ../edit.c:4519 msgid " Adding" -msgstr " Listn" +msgstr " Lisätään" #. showmode might reset the internal line pointers, so it must #. * be called before line = ml_get(), or when this address is no #. * longer needed. -- Acevedo. #. -#: ../edit.c:4562 msgid "-- Searching..." msgstr "-- Haetaan..." -#: ../edit.c:4618 msgid "Back at original" -msgstr "Takaisin lhtpisteess" +msgstr "Takaisin lähtöpisteessä" -#: ../edit.c:4621 msgid "Word from other line" -msgstr "Sana toisella rivill" +msgstr "Sana toisella rivillä" -#: ../edit.c:4624 msgid "The only match" -msgstr "Ainoa tsmys" +msgstr "Ainoa täsmäys" -#: ../edit.c:4680 #, c-format msgid "match %d of %d" -msgstr "tsmys %d/%d" +msgstr "täsmäys %d/%d" -#: ../edit.c:4684 #, c-format msgid "match %d" -msgstr "tsmys %d" +msgstr "täsmäys %d" -#: ../eval.c:137 msgid "E18: Unexpected characters in :let" -msgstr "E18: Odottamattomia merkkej komennossa :let" - -#: ../eval.c:138 -#, c-format -msgid "E684: list index out of range: %" -msgstr "E684: Indeksi % luettelon rajojen ulkopuolella" - -#: ../eval.c:139 -#, c-format -msgid "E121: Undefined variable: %s" -msgstr "E121: Mrittelemtn muuttuja: %s" +msgstr "E18: Odottamattomia merkkejä komennossa :let" -#: ../eval.c:140 msgid "E111: Missing ']'" msgstr "E111: ] puuttuu" -#: ../eval.c:141 #, c-format msgid "E686: Argument of %s must be a List" -msgstr "E686: Argumentin %s pit olla lista" +msgstr "E686: Argumentin %s pitää olla lista" # datarakenteita -#: ../eval.c:143 #, c-format msgid "E712: Argument of %s must be a List or Dictionary" -msgstr "E712: Argumentin %s pit olla lista tai sanakirja" +msgstr "E712: Argumentin %s pitää olla lista tai sanakirja" -#: ../eval.c:144 -msgid "E713: Cannot use empty key for Dictionary" -msgstr "E713: Sanakirjassa ei voi olla tyhji avaimia" - -#: ../eval.c:145 msgid "E714: List required" msgstr "E714: Lista tarvitaan" -#: ../eval.c:146 msgid "E715: Dictionary required" msgstr "E715: Sanakirja tarvitaan" -#: ../eval.c:147 +msgid "E928: String required" +msgstr "E928: Merkkijono puuttuu" + #, c-format msgid "E118: Too many arguments for function: %s" msgstr "E118: Liikaa argumentteja funktiolle: %s" -#: ../eval.c:148 #, c-format msgid "E716: Key not present in Dictionary: %s" msgstr "E716: Avainta %s ei ole sanakirjassa" -#: ../eval.c:150 #, c-format msgid "E122: Function %s already exists, add ! to replace it" -msgstr "E122: Funktio %s on jo olemassa, lis ! korvataksesi" +msgstr "E122: Funktio %s on jo olemassa, lisää ! korvataksesi" -#: ../eval.c:151 msgid "E717: Dictionary entry already exists" msgstr "E717: Sanakirja-alkio on jo olemassa" -#: ../eval.c:152 msgid "E718: Funcref required" msgstr "E718: Funcref tarvitaan" -#: ../eval.c:153 msgid "E719: Cannot use [:] with a Dictionary" -msgstr "E719: Sanakirjassa ei voi kytt merkint [:]" - -#: ../eval.c:154 -#, c-format -msgid "E734: Wrong variable type for %s=" -msgstr "E734: Vr muuttujatyyppi muuttujalle %s=" +msgstr "E719: Sanakirjassa ei voi käyttää merkintää [:]" -#: ../eval.c:155 #, c-format msgid "E130: Unknown function: %s" msgstr "E130: Tuntematon funktio: %s" -#: ../eval.c:156 #, c-format msgid "E461: Illegal variable name: %s" msgstr "E461: Virheellinen muuttujanimi: %s" -#: ../eval.c:157 -msgid "E806: using Float as a String" -msgstr "E806: Float ei ky merkkijonosta" +#, fuzzy, c-format +#~ msgid "E46: Cannot change read-only variable \"%.*s\"" +#~ msgstr "E46: Kirjoitussuojattua muuttujaa %s ei voi muuttaa" + +#. TODO(ZyX-I): move to eval/executor +#, c-format +msgid "E734: Wrong variable type for %s=" +msgstr "E734: Väärä muuttujatyyppi muuttujalle %s=" -#: ../eval.c:1830 msgid "E687: Less targets than List items" -msgstr "E687: Kohteita on vhemmn kuin listan alkioita" +msgstr "E687: Kohteita on vähemmän kuin listan alkioita" -#: ../eval.c:1834 msgid "E688: More targets than List items" -msgstr "E688: Kohteita on enemmn kuin listan alkioita" +msgstr "E688: Kohteita on enemmän kuin listan alkioita" -#: ../eval.c:1906 msgid "Double ; in list of variables" -msgstr "Kaksi ;:tt listan muuttujissa" +msgstr "Kaksi ;:ttä listan muuttujissa" -#: ../eval.c:2078 #, c-format msgid "E738: Can't list variables for %s" msgstr "E738: Kohteen %s muuttujia ei voi listata" -#: ../eval.c:2391 +#, fuzzy, c-format +#~ msgid "E121: Undefined variable: %.*s" +#~ msgstr "E121: Määrittelemätön muuttuja: %s" + msgid "E689: Can only index a List or Dictionary" -msgstr "E689: Vain listalla ja sanakirjalla voi olla indeksej" +msgstr "E689: Vain listalla ja sanakirjalla voi olla indeksejä" -#: ../eval.c:2396 msgid "E708: [:] must come last" -msgstr "E708: [:]:n pit olla viimeisen" +msgstr "E708: [:]:n pitää olla viimeisenä" + +#, fuzzy +#~ msgid "E713: Cannot use empty key after ." +#~ msgstr "E713: Sanakirjassa ei voi olla tyhjiä avaimia" -#: ../eval.c:2439 msgid "E709: [:] requires a List value" msgstr "E709: [:] toimii vain listalla" -#: ../eval.c:2674 msgid "E710: List value has more items than target" -msgstr "E710: Listalla on enemmn alkioita kuin kohteella" +msgstr "E710: Listalla on enemmän alkioita kuin kohteella" -#: ../eval.c:2678 msgid "E711: List value has not enough items" msgstr "E711: Listalla ei ole tarpeeksi alkioita" -#: ../eval.c:2867 msgid "E690: Missing \"in\" after :for" msgstr "E690: :for-kommenolta puuttuu in" -#: ../eval.c:3063 #, c-format msgid "E107: Missing parentheses: %s" msgstr "E107: Sulkeita puuttuu: %s" -#: ../eval.c:3263 #, c-format msgid "E108: No such variable: \"%s\"" msgstr "E108: Muuttujaa %s ei ole" -#: ../eval.c:3333 -msgid "E743: variable nested too deep for (un)lock" -msgstr "E743: muuttujassa liian monta tasoa lukituksen ksittelyyn" +#. For historical reasons this error is not given for Lists and +#. Dictionaries. E.g. b: dictionary may be locked/unlocked. +#, fuzzy, c-format +#~ msgid "E940: Cannot lock or unlock variable %s" +#~ msgstr "E46: Kirjoitussuojattua muuttujaa %s ei voi muuttaa" -#: ../eval.c:3630 msgid "E109: Missing ':' after '?'" -msgstr "E109: ?:n jlkeen puuttuu :" +msgstr "E109: ?:n jälkeen puuttuu :" -#: ../eval.c:3893 msgid "E691: Can only compare List with List" msgstr "E691: Listaa voi verrata vain listaan" -#: ../eval.c:3895 -msgid "E692: Invalid operation for Lists" +msgid "E692: Invalid operation for List" msgstr "E692: Virheellinen toiminto listalle" -#: ../eval.c:3915 msgid "E735: Can only compare Dictionary with Dictionary" msgstr "E735: Sanakirjaa voi verrata vain sanakirjaan" -#: ../eval.c:3917 msgid "E736: Invalid operation for Dictionary" msgstr "E736: Virheellinen toiminto sanakirjalle" -#: ../eval.c:3932 -msgid "E693: Can only compare Funcref with Funcref" -msgstr "E693: Funcrefi voi verrata vain funcrefiin" - -#: ../eval.c:3934 msgid "E694: Invalid operation for Funcrefs" msgstr "E694: Virheellinen toiminto funcrefille" -#: ../eval.c:4277 msgid "E804: Cannot use '%' with Float" -msgstr "E804: Ei voi kytt '%':a Floatin kanssa" +msgstr "E804: Ei voi käyttää '%':a Floatin kanssa" -#: ../eval.c:4478 msgid "E110: Missing ')'" msgstr "E110: ) puuttuu" -#: ../eval.c:4609 msgid "E695: Cannot index a Funcref" -msgstr "E695: Funcrefi ei voi indeksoida" +msgstr "E695: Funcrefiä ei voi indeksoida" + +msgid "E909: Cannot index a special variable" +msgstr "E909: erikoismuuttujaa ei voi indeksoida" -#: ../eval.c:4839 #, c-format msgid "E112: Option name missing: %s" msgstr "E112: Asetuksen nimi puuttuu: %s" -#: ../eval.c:4855 #, c-format msgid "E113: Unknown option: %s" msgstr "E113: Tuntematon asetus: %s" -#: ../eval.c:4904 #, c-format msgid "E114: Missing quote: %s" msgstr "E114: Puuttuva lainausmerkki: %s" -#: ../eval.c:5020 #, c-format msgid "E115: Missing quote: %s" msgstr "E115: Puuttuva lainausmerkki: %s" -#: ../eval.c:5084 #, c-format msgid "E696: Missing comma in List: %s" msgstr "E696: Listasta puuttuu pilkku: %s" -#: ../eval.c:5091 #, c-format msgid "E697: Missing end of List ']': %s" msgstr "E697: Listan lopusta puuttuu ]: %s" -#: ../eval.c:6475 +msgid "Not enough memory to set references, garbage collection aborted!" +msgstr "" +"Ei tarpeeksi muistia viitteiden asettamista varten, roskiekeruu peruttiin." + #, c-format msgid "E720: Missing colon in Dictionary: %s" msgstr "E720: Sanakirjasta puuttuu kaksoispiste: %s" -#: ../eval.c:6499 #, c-format msgid "E721: Duplicate key in Dictionary: \"%s\"" msgstr "E721: Kaksi samaa avainta sanakirjassa: %s" -#: ../eval.c:6517 #, c-format msgid "E722: Missing comma in Dictionary: %s" msgstr "E722: Sanakirjasta puuttuu pilkku: %s" -#: ../eval.c:6524 #, c-format msgid "E723: Missing end of Dictionary '}': %s" msgstr "E723: Sanakirjan lopusta puuttuu }: %s" -#: ../eval.c:6555 -msgid "E724: variable nested too deep for displaying" -msgstr "E724: muuttuja on upotettu liian syvlle nytettvksi" +#, c-format +msgid "E125: Illegal argument: %s" +msgstr "E125: Virheellinen argumentti: %s" + +#, c-format +msgid "E853: Duplicate argument name: %s" +msgstr "E853: Kaksoiskappale argumentin nimestä: %s" -#: ../eval.c:7188 #, c-format msgid "E740: Too many arguments for function %s" msgstr "E740: Liikaa argumentteja funktiolle %s" -#: ../eval.c:7190 #, c-format msgid "E116: Invalid arguments for function %s" -msgstr "E116: Vri argumentteja funktiolle %s" +msgstr "E116: Vääriä argumentteja funktiolle %s" -#: ../eval.c:7377 #, c-format msgid "E117: Unknown function: %s" msgstr "E117: Tuntematon funktio: %s" -#: ../eval.c:7383 +#, c-format +msgid "E933: Function was deleted: %s" +msgstr "E933: Funktion nimi poistettu: %s" + #, c-format msgid "E119: Not enough arguments for function: %s" msgstr "E119: Liikaa argumentteja funktiolle %s" -#: ../eval.c:7387 #, c-format msgid "E120: Using not in a script context: %s" msgstr "E120: skriptin ulkopuolella: %s" -#: ../eval.c:7391 #, c-format msgid "E725: Calling dict function without Dictionary: %s" msgstr "E725: dict-funktio ilman sanakirjaa: %s" -#: ../eval.c:7453 -msgid "E808: Number or Float required" -msgstr "E808: Number tai Float vaaditaan" +#, fuzzy, c-format +#~ msgid "Error converting the call result: %s" +#~ msgstr "virhe Schemestä Vimiin konversiossa" -#: ../eval.c:7503 -#, fuzzy msgid "add() argument" -msgstr "-c-argumentti" +msgstr "add()-argumentti" -#: ../eval.c:7907 msgid "E699: Too many arguments" msgstr "E699: Liikaa argumentteja" -#: ../eval.c:8073 msgid "E785: complete() can only be used in Insert mode" -msgstr "E785: complete() toimii vain sytttilassa" +msgstr "E785: complete() toimii vain syöttötilassa" -#: ../eval.c:8156 msgid "&Ok" msgstr "&Ok" -#: ../eval.c:8676 -#, c-format -msgid "E737: Key already exists: %s" -msgstr "E737: Avain on jo olemassa: %s" - -#: ../eval.c:8692 #, fuzzy +#~ msgid "dictwatcheradd() argument" +#~ msgstr "add()-argumentti" + msgid "extend() argument" -msgstr "--cmd-argumentti" +msgstr "extend()-argumentti" -#: ../eval.c:8915 -#, fuzzy msgid "map() argument" -msgstr "-c-argumentti" +msgstr "map()-argumentti" -#: ../eval.c:8916 -#, fuzzy msgid "filter() argument" -msgstr "-c-argumentti" +msgstr "filter()-argumentti" -#: ../eval.c:9229 -#, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld rivi: " +#, fuzzy, c-format +#~ msgid "+-%s%3ld lines: " +#~ msgstr "+-%s%3ld rivi: " -#: ../eval.c:9291 #, c-format msgid "E700: Unknown function: %s" msgstr "E700: Tuntematon funktio: %s" -#: ../eval.c:10729 +msgid "E922: expected a dict" +msgstr "E922: odotettiin dictiä" + +# datarakenteita +msgid "E923: Second argument of function() must be a list or a dict" +msgstr "E923: toisen function()-argumentin pitää olla lista tai sanakirja" + +#, fuzzy +#~ msgid "E5000: Cannot find tab number." +#~ msgstr "E695: Funcrefiä ei voi indeksoida" + +#~ msgid "E5001: Higher scope cannot be -1 if lower scope is >= 0." +#~ msgstr "" + +#, fuzzy +#~ msgid "E5002: Cannot find window number." +#~ msgstr "E671: Ikkunan otsikkoa ei löydy %s" + msgid "called inputrestore() more often than inputsave()" msgstr "inputrestore() suoritettu useammin kuin inputsave()" -#: ../eval.c:10771 -#, fuzzy msgid "insert() argument" -msgstr "-c-argumentti" +msgstr "insert()-argumentti" -#: ../eval.c:10841 msgid "E786: Range not allowed" -msgstr "E786: Aluetta ei voi kytt" +msgstr "E786: Aluetta ei voi käyttää" + +#~ msgid "Invalid stream on rpc job, use jobclose(id, 'rpc')" +#~ msgstr "" + +#~ msgid "Invalid job stream: Not an rpc job" +#~ msgstr "" + +#, c-format +#~ msgid "Invalid job stream \"%s\"" +#~ msgstr "" + +#~ msgid "Can't send data to the job: stdin is closed" +#~ msgstr "" + +#~ msgid "Can't send raw data to rpc channel" +#~ msgstr "" + +#, fuzzy +#~ msgid "E474: Failed to convert list to string" +#~ msgstr "ei voitu konvertoida tyypistä %s vim-listaksi" + +#, fuzzy, c-format +#~ msgid "E474: Failed to parse %.*s" +#~ msgstr "E241: Kohteeseen %s lähettäminen ei onnistunut" -#: ../eval.c:11140 msgid "E701: Invalid type for len()" msgstr "E701: Virheellinen tyyppi funktiolle len()" -#: ../eval.c:11980 +#, fuzzy, c-format +#~ msgid "msgpackdump() argument, index %i" +#~ msgstr "map()-argumentti" + +#, fuzzy +#~ msgid "E5070: Character number must not be less than zero" +#~ msgstr "luvun on oltava nollaa suurempi" + +#, fuzzy, c-format +#~ msgid "E5071: Character number must not be greater than INT_MAX (%i)" +#~ msgstr "luvun on oltava nollaa suurempi" + msgid "E726: Stride is zero" msgstr "E726: Stride on nolla" -#: ../eval.c:11982 msgid "E727: Start past end" -msgstr "E727: Alku on lopun jlkeen" +msgstr "E727: Alku on lopun jälkeen" -#: ../eval.c:12024 ../eval.c:15297 msgid "" -msgstr "" +msgstr "" -#: ../eval.c:12282 -#, fuzzy msgid "remove() argument" -msgstr "--cmd-argumentti" +msgstr "remove()-argumentti" -#: ../eval.c:12466 msgid "E655: Too many symbolic links (cycle?)" -msgstr "E655: Liikaa symbolisia linkkej (mahdollinen sykli)" +msgstr "E655: Liikaa symbolisia linkkejä (mahdollinen sykli)" -#: ../eval.c:12593 -#, fuzzy msgid "reverse() argument" -msgstr "-c-argumentti" +msgstr "reverse()-argumentti" + +#, c-format +msgid "E927: Invalid action: '%s'" +msgstr "E927: Viallinen toiminto: %s" -#: ../eval.c:13721 -#, fuzzy msgid "sort() argument" -msgstr "-c-argumentti" +msgstr "sort()-argumentti" -#: ../eval.c:13721 -#, fuzzy msgid "uniq() argument" -msgstr "-c-argumentti" +msgstr "uniq()-argumentti" -#: ../eval.c:13776 msgid "E702: Sort compare function failed" msgstr "E702: Lajittelun vertausfunktio ei onnistunut" -#: ../eval.c:13806 -#, fuzzy msgid "E882: Uniq compare function failed" -msgstr "E702: Lajittelun vertausfunktio ei onnistunut" +msgstr "E882: Uniqin vertausfunktio ei onnistunut" -#: ../eval.c:14085 msgid "(Invalid)" msgstr "(Virheellinen)" -#: ../eval.c:14590 -msgid "E677: Error writing temp file" -msgstr "E677: Vliaikaistiedostoon kirjoittaminen ei onnistunut" +#, c-format +msgid "E935: invalid submatch number: %d" +msgstr "E935: Virheellinen alitäsmäyksen numero: %d" -#: ../eval.c:16159 -msgid "E805: Using a Float as a Number" -msgstr "E805: Float ei ky Numberista" +#~ msgid "Can only call this function in an unmodified buffer" +#~ msgstr "" -#: ../eval.c:16162 -msgid "E703: Using a Funcref as a Number" -msgstr "E703: Funcref ei ky Numberista" +msgid "E921: Invalid callback argument" +msgstr "E921: Virheellinen callback-argumentti" -#: ../eval.c:16170 -msgid "E745: Using a List as a Number" -msgstr "E745: Lista ei ky Numberista" +#, fuzzy, c-format +#~ msgid "E80: Error while writing: %s" +#~ msgstr "E80: Kirjoitusvirhe" -#: ../eval.c:16173 -msgid "E728: Using a Dictionary as a Number" -msgstr "E728: Sanakirja ei ky Numberista" +#. Using %s, p and not %c, *p to preserve multibyte characters +#, fuzzy, c-format +#~ msgid "E5060: Unknown flag: %s" +#~ msgstr "E235: Tuntematon fontti: %s" -#: ../eval.c:16259 -msgid "E729: using Funcref as a String" -msgstr "E729: Funcref ei ky merkkijonosta" +#, fuzzy +#~ msgid "E482: Can't open file with an empty name" +#~ msgstr "E212: Tiedoston avaus kirjoittamista varten ei onnistu" -#: ../eval.c:16262 -msgid "E730: using List as a String" -msgstr "E730: Lista ei ky merkkijonosta" +#, fuzzy, c-format +#~ msgid "E482: Can't open file %s for writing: %s" +#~ msgstr "E212: Tiedoston avaus kirjoittamista varten ei onnistu" -#: ../eval.c:16265 -msgid "E731: using Dictionary as a String" -msgstr "E731: Sanakirja ei ky merkkijonosta" +#, fuzzy, c-format +#~ msgid "E80: Error when closing file %s: %s" +#~ msgstr "E209: Virhe suljettaessa tiedostoa %s" -#: ../eval.c:16619 -#, c-format -msgid "E706: Variable type mismatch for: %s" -msgstr "E706: Muuttujatyyppi ei tsm: %s" +#, fuzzy, c-format +#~ msgid "E794: Cannot set variable in the sandbox: \"%.*s\"" +#~ msgstr "E794: Muuttujaa ei voi asettaa hiekkalaatikossa: %s" -#: ../eval.c:16705 -#, c-format -msgid "E795: Cannot delete variable %s" -msgstr "E795: Muuttujaa %s ei voi poistaa" +#, fuzzy, c-format +#~ msgid "E795: Cannot delete variable %.*s" +#~ msgstr "E795: Muuttujaa %s ei voi poistaa" -#: ../eval.c:16724 #, c-format msgid "E704: Funcref variable name must start with a capital: %s" -msgstr "E704: Funcrefin muuttujanimen pit alkaa suuraakkosella: %s" +msgstr "E704: Funcrefin muuttujanimen pitää alkaa suuraakkosella: %s" -#: ../eval.c:16732 #, c-format msgid "E705: Variable name conflicts with existing function: %s" msgstr "E705: Muuttujanimi on sama kuin olemassaolevan funktion: %s" -#: ../eval.c:16763 -#, c-format -msgid "E741: Value is locked: %s" -msgstr "E741: Arvo on lukittu: %s" - -#: ../eval.c:16764 ../eval.c:16769 ../message.c:1839 -msgid "Unknown" -msgstr "Tuntematon" - -#: ../eval.c:16768 -#, c-format -msgid "E742: Cannot change value of %s" -msgstr "E742: Ei voi muuttaa muuttujan %s arvoa" - -#: ../eval.c:16838 msgid "E698: variable nested too deep for making a copy" -msgstr "E698: muuttuja on upotettu liian syvlle kopioitavaksi" +msgstr "E698: muuttuja on upotettu liian syvälle kopioitavaksi" -#: ../eval.c:17249 #, c-format msgid "E123: Undefined function: %s" msgstr "E123: Tuntematon funktio: %s" -#: ../eval.c:17260 #, c-format msgid "E124: Missing '(': %s" msgstr "E124: ( puuttuu: %s" -#: ../eval.c:17293 -#, fuzzy msgid "E862: Cannot use g: here" -msgstr "E284: Ei voi asettaa IC-arvoja" - -#: ../eval.c:17312 -#, c-format -msgid "E125: Illegal argument: %s" -msgstr "E125: Virheellinen argumentti: %s" +msgstr "E862: g: ei toimi täällä" -#: ../eval.c:17323 #, fuzzy, c-format -msgid "E853: Duplicate argument name: %s" -msgstr "Kaksoiskappale kentn nimest: %s" +#~ msgid "E932: Closure function should not be at top level: %s" +#~ msgstr "E932 Sulkeumafunktio ei voi olla uloimmalla tasolla: %s" -#: ../eval.c:17416 msgid "E126: Missing :endfunction" msgstr "E126: :endfunction puuttuu" -#: ../eval.c:17537 #, c-format msgid "E707: Function name conflicts with variable: %s" msgstr "E707: Funktion nimi on ristiriidassa muuttujan kanssa: %s" -#: ../eval.c:17549 #, c-format msgid "E127: Cannot redefine function %s: It is in use" -msgstr "E127: Funktiota %s ei voi mritell uudestaan, koska se on kytss" +msgstr "E127: Funktiota %s ei voi määritellä uudestaan, koska se on käytössä" -#: ../eval.c:17604 #, c-format msgid "E746: Function name does not match script file name: %s" msgstr "E746: Funktion nimi ei ole sama kuin skriptin tiedostonnimi: %s" -#: ../eval.c:17716 msgid "E129: Function name required" msgstr "E129: Funktion nimi puuttuu" -#: ../eval.c:17824 -#, fuzzy, c-format +#, c-format msgid "E128: Function name must start with a capital or \"s:\": %s" -msgstr "" -"E128: Funktion nimen pit alkaa suuraakkosella tai sislt kaksoispisteen: " -"%s" +msgstr "E128: Funktion nimen pitää alkaa suuraakkosella tai merkeillä ’s:’: %s" -#: ../eval.c:17833 -#, fuzzy, c-format +#, c-format msgid "E884: Function name cannot contain a colon: %s" -msgstr "" -"E128: Funktion nimen pit alkaa suuraakkosella tai sislt kaksoispisteen: " -"%s" +msgstr "E884: Funktion nimessä ei saa olla kaksoispistettä: %s" -#: ../eval.c:18336 #, c-format msgid "E131: Cannot delete function %s: It is in use" msgstr "E131: Funktiota %s ei voi poistaa" -#: ../eval.c:18441 +#, fuzzy, c-format +#~ msgid "Cannot delete function %s: It is being used internally" +#~ msgstr "E131: Funktiota %s ei voi poistaa" + msgid "E132: Function call depth is higher than 'maxfuncdepth'" -msgstr "E132: Funktiokutsujen syvyys on enemmn kuin maxfuncdepth" +msgstr "E132: Funktiokutsujen syvyys on enemmän kuin maxfuncdepth" -#: ../eval.c:18568 #, c-format msgid "calling %s" msgstr "kutsutaan funktiota %s" -#: ../eval.c:18651 #, c-format msgid "%s aborted" msgstr "%s keskeytettiin" -#: ../eval.c:18653 -#, c-format -msgid "%s returning #%" -msgstr "%s palaa kohdassa #%" +#, fuzzy, c-format +#~ msgid "%s returning #%" +#~ msgstr "%s palaa kohdassa #%ld" -#: ../eval.c:18670 #, c-format msgid "%s returning %s" msgstr "%s palaa kohdassa %s" -#: ../eval.c:18691 ../ex_cmds2.c:2695 #, c-format msgid "continuing in %s" msgstr "jatkaa kohdassa %s" -#: ../eval.c:18795 msgid "E133: :return not inside a function" -msgstr "E133: :return ei ole funktion sisll" - -#: ../eval.c:19159 -msgid "" -"\n" -"# global variables:\n" -msgstr "" -"\n" -"# globaalit muuttujat:\n" +msgstr "E133: :return ei ole funktion sisällä" -#: ../eval.c:19254 msgid "" "\n" "\tLast set from " @@ -1045,964 +1091,1005 @@ msgstr "" "\n" "\tViimeksi asetettu kohteesta " -#: ../eval.c:19272 msgid "No old files" msgstr "Ei vanhoja tiedostoja" -# puhutaan merkin ulkoasusta snprintf(..., c, c, c, c) -#: ../ex_cmds.c:122 #, c-format -msgid "<%s>%s%s %d, Hex %02x, Octal %03o" -msgstr "<%s>%s%s %d, heksana %02x, oktaalina %03o" +#~ msgid "E474: Expected comma before list item: %s" +#~ msgstr "" -#: ../ex_cmds.c:145 #, c-format -msgid "> %d, Hex %04x, Octal %o" -msgstr "> %d, heksana %04x, oktaalina %o" +#~ msgid "E474: Expected colon before dictionary value: %s" +#~ msgstr "" -#: ../ex_cmds.c:146 -#, c-format -msgid "> %d, Hex %08x, Octal %o" -msgstr "> %d, hekdana %08x, oktaalina %o" +#, fuzzy, c-format +#~ msgid "E474: Expected string key: %s" +#~ msgstr "E415: odotuksenvastainen =-merkki: %s" -#: ../ex_cmds.c:684 -msgid "E134: Move lines into themselves" -msgstr "E134: Rivien siirto itsejens plle" +#, fuzzy, c-format +#~ msgid "E474: Expected comma before dictionary key: %s" +#~ msgstr "E722: Sanakirjasta puuttuu pilkku: %s" -#: ../ex_cmds.c:747 -msgid "1 line moved" -msgstr "1 rivi siirretty" +#, fuzzy, c-format +#~ msgid "E474: Unfinished escape sequence: %.*s" +#~ msgstr "E540: Sulkematon lausekesarja" -#: ../ex_cmds.c:749 #, c-format -msgid "% lines moved" -msgstr "% rivi siirretty" +#~ msgid "E474: Unfinished unicode escape sequence: %.*s" +#~ msgstr "" -#: ../ex_cmds.c:1175 #, c-format -msgid "% lines filtered" -msgstr "% rivi suodatettu" - -#: ../ex_cmds.c:1194 -msgid "E135: *Filter* Autocommands must not change current buffer" -msgstr "E135: *Filter*-autocommand ei voi vaihtaa puskuria" +#~ msgid "E474: Expected four hex digits after \\u: %.*s" +#~ msgstr "" -#: ../ex_cmds.c:1244 -msgid "[No write since last change]\n" -msgstr "[Viimeisint muutosta ei ole kirjoitettu]\n" +#, fuzzy, c-format +#~ msgid "E474: Unknown escape sequence: %.*s" +#~ msgstr "E409: Tuntematon ryhmän nimi: %s" -#: ../ex_cmds.c:1424 #, c-format -msgid "%sviminfo: %s in line: " -msgstr "%sviminfo: %s rivill: " - -#: ../ex_cmds.c:1431 -msgid "E136: viminfo: Too many errors, skipping rest of file" -msgstr "E136: viminfo: liikaa virheit, ohitetaan lopputiedosto" +#~ msgid "E474: ASCII control characters cannot be present inside string: %.*s" +#~ msgstr "" -#: ../ex_cmds.c:1458 #, c-format -msgid "Reading viminfo file \"%s\"%s%s%s" -msgstr "Luetaan viminfo-tiedostoa \"%s\"%s%s%s" +#~ msgid "E474: Only UTF-8 strings allowed: %.*s" +#~ msgstr "" -#: ../ex_cmds.c:1460 -msgid " info" -msgstr " info" +#, c-format +#~ msgid "" +#~ "E474: Only UTF-8 code points up to U+10FFFF are allowed to appear unescaped: " +#~ "%.*s" +#~ msgstr "" -#: ../ex_cmds.c:1461 -msgid " marks" -msgstr " merkit" +#, fuzzy, c-format +#~ msgid "E474: Expected string end: %.*s" +#~ msgstr "E415: odotuksenvastainen =-merkki: %s" -#: ../ex_cmds.c:1462 -msgid " oldfiles" -msgstr " vanhaatiedostoa" +#, fuzzy, c-format +#~ msgid "E474: Leading zeroes are not allowed: %.*s" +#~ msgstr "E786: Aluetta ei voi käyttää" -#: ../ex_cmds.c:1463 -msgid " FAILED" -msgstr " EPONNISTUI" +#, fuzzy, c-format +#~ msgid "E474: Missing number after minus sign: %.*s" +#~ msgstr "E526: Lukuarvo puuttuu merkkijonon <%s> jälkeen" -#. avoid a wait_return for this message, it's annoying -#: ../ex_cmds.c:1541 -#, c-format -msgid "E137: Viminfo file is not writable: %s" -msgstr "E137: Viminfo-tiedostoon ei voitu kirjoittaa: %s" +#, fuzzy, c-format +#~ msgid "E474: Missing number after decimal dot: %.*s" +#~ msgstr "E526: Lukuarvo puuttuu merkkijonon <%s> jälkeen" -#: ../ex_cmds.c:1626 -#, c-format -msgid "E138: Can't write viminfo file %s!" -msgstr "E138: Viminfo-tiedoston kirjoittaminen ei onnistu %s" +#, fuzzy, c-format +#~ msgid "E474: Missing exponent: %.*s" +#~ msgstr "E114: Puuttuva lainausmerkki: %s" -#: ../ex_cmds.c:1635 #, c-format -msgid "Writing viminfo file \"%s\"" -msgstr "Kirjoitetaan viminfo-tiedostoa %s" +#~ msgid "" +#~ "E685: internal error: while converting number \"%.*s\" to float string2float " +#~ "consumed %zu bytes in place of %zu" +#~ msgstr "" -#. Write the info: -#: ../ex_cmds.c:1720 #, c-format -msgid "# This viminfo file was generated by Vim %s.\n" -msgstr "# Vimin %s generoima viminfo-tiedosto.\n" +#~ msgid "" +#~ "E685: internal error: while converting number \"%.*s\" to integer vim_str2nr " +#~ "consumed %i bytes in place of %zu" +#~ msgstr "" -#: ../ex_cmds.c:1722 -msgid "" -"# You may edit it if you're careful!\n" -"\n" -msgstr "" -"# Muokkaa varovasti!\n" -"\n" +#~ msgid "E474: Attempt to decode a blank string" +#~ msgstr "" -#: ../ex_cmds.c:1723 -msgid "# Value of 'encoding' when this file was written\n" -msgstr "# encoding-muuttujan arvo tiedostoa kirjoitettaessa\n" +#, c-format +#~ msgid "E474: No container to close: %.*s" +#~ msgstr "" -#: ../ex_cmds.c:1800 -msgid "Illegal starting char" -msgstr "Virheellinen aloitusmerkki" +#, c-format +#~ msgid "E474: Closing list with curly bracket: %.*s" +#~ msgstr "" -#: ../ex_cmds.c:2162 -msgid "Write partial file?" -msgstr "Kirjoita osittainen tiedosto" +#, fuzzy, c-format +#~ msgid "E474: Closing dictionary with square bracket: %.*s" +#~ msgstr "E725: dict-funktio ilman sanakirjaa: %s" -#: ../ex_cmds.c:2166 -msgid "E140: Use ! to write partial buffer" -msgstr "E140: Kyt !-komentoa osittaisen puskurin kirjoittamiseen" +#, fuzzy, c-format +#~ msgid "E474: Trailing comma: %.*s" +#~ msgstr "E488: Ylimääräisiä merkkejä perässä" -#: ../ex_cmds.c:2281 #, c-format -msgid "Overwrite existing file \"%s\"?" -msgstr "Ylikirjoitetaanko olemassaoleva tiedosto %s?" +#~ msgid "E474: Expected value after colon: %.*s" +#~ msgstr "" -#: ../ex_cmds.c:2317 -#, c-format -msgid "Swap file \"%s\" exists, overwrite anyway?" -msgstr "Swap-tiedosto %s on olemassa, ylikirjoitetaanko?" +#, fuzzy, c-format +#~ msgid "E474: Expected value: %.*s" +#~ msgstr "E415: odotuksenvastainen =-merkki: %s" -#: ../ex_cmds.c:2326 #, c-format -msgid "E768: Swap file exists: %s (:silent! overrides)" -msgstr "E768: Swap-tiedosto on jo olemassa: %s (komento :silent! ohittaa)" +#~ msgid "E474: Comma not inside container: %.*s" +#~ msgstr "" -#: ../ex_cmds.c:2381 -#, c-format -msgid "E141: No file name for buffer %" -msgstr "E141: Ei tiedostonime puskurille %" +#, fuzzy, c-format +#~ msgid "E474: Duplicate comma: %.*s" +#~ msgstr "E721: Kaksi samaa avainta sanakirjassa: %s" -#: ../ex_cmds.c:2412 -msgid "E142: File not written: Writing is disabled by 'write' option" -msgstr "" -"E142: Tiedostoa ei kirjoitettu; write-asetus poistaa kirjoituksen kytst" +#, fuzzy, c-format +#~ msgid "E474: Comma after colon: %.*s" +#~ msgstr "E254: Väriä %s ei voi määritellä" -#: ../ex_cmds.c:2434 -#, c-format -msgid "" -"'readonly' option is set for \"%s\".\n" -"Do you wish to write anyway?" -msgstr "" -"readonly asetettu tiedostolle \"%s\".\n" -"Kirjoitetaanko?" +#, fuzzy, c-format +#~ msgid "E474: Using comma in place of colon: %.*s" +#~ msgstr "E722: Sanakirjasta puuttuu pilkku: %s" -#: ../ex_cmds.c:2439 #, c-format -msgid "" -"File permissions of \"%s\" are read-only.\n" -"It may still be possible to write it.\n" -"Do you wish to try?" -msgstr "" -"Tiedosto %s on kirjoitussuojattu.\n" -"Siihen saattaa voida silti kirjoittaa.\n" -"Yritetnk?" +#~ msgid "E474: Leading comma: %.*s" +#~ msgstr "" -#: ../ex_cmds.c:2451 #, c-format -msgid "E505: \"%s\" is read-only (add ! to override)" -msgstr "E505: %s on kirjoitussuojattu (lis komentoon ! ohittaaksesi)" +#~ msgid "E474: Colon not inside container: %.*s" +#~ msgstr "" + +#, fuzzy, c-format +#~ msgid "E474: Using colon not in dictionary: %.*s" +#~ msgstr "E720: Sanakirjasta puuttuu kaksoispiste: %s" + +#, fuzzy, c-format +#~ msgid "E474: Unexpected colon: %.*s" +#~ msgstr "E415: odotuksenvastainen =-merkki: %s" -#: ../ex_cmds.c:3120 #, c-format -msgid "E143: Autocommands unexpectedly deleted new buffer %s" -msgstr "E143: Autocommand poisti uuden puskurin odotuksen vastaisesti %s" +#~ msgid "E474: Colon after comma: %.*s" +#~ msgstr "" -#: ../ex_cmds.c:3313 -msgid "E144: non-numeric argument to :z" -msgstr "E144: :z:n argumentti ei ole numero" +#, fuzzy, c-format +#~ msgid "E474: Duplicate colon: %.*s" +#~ msgstr "E721: Kaksi samaa avainta sanakirjassa: %s" -#: ../ex_cmds.c:3404 -msgid "E145: Shell commands not allowed in rvim" -msgstr "E145: Kuoren komennot eivt toimi rvimiss" +#, fuzzy, c-format +#~ msgid "E474: Expected null: %.*s" +#~ msgstr "E415: odotuksenvastainen =-merkki: %s" -#: ../ex_cmds.c:3498 -msgid "E146: Regular expressions can't be delimited by letters" -msgstr "E146: Snnllist ilmausta ei voi rajata kirjaimilla" +#, fuzzy, c-format +#~ msgid "E474: Expected true: %.*s" +#~ msgstr "E270: odotuksenvastainen redo" -#: ../ex_cmds.c:3964 -#, c-format -msgid "replace with %s (y/n/a/q/l/^E/^Y)?" -msgstr "korvaa kohteella %s (y/n/a/q/l/^E/^Y)?" +#, fuzzy, c-format +#~ msgid "E474: Expected false: %.*s" +#~ msgstr "E415: odotuksenvastainen =-merkki: %s" -#: ../ex_cmds.c:4379 -msgid "(Interrupted) " -msgstr "(Keskeytetty)" +#, fuzzy, c-format +#~ msgid "E474: Unidentified byte: %.*s" +#~ msgstr "E121: Määrittelemätön muuttuja: %s" -#: ../ex_cmds.c:4384 -msgid "1 match" -msgstr "1 tsmys" +#, fuzzy, c-format +#~ msgid "E474: Trailing characters: %.*s" +#~ msgstr "E488: Ylimääräisiä merkkejä perässä" -#: ../ex_cmds.c:4384 -msgid "1 substitution" -msgstr "1 korvaus" +#, fuzzy, c-format +#~ msgid "E474: Unexpected end of input: %.*s" +#~ msgstr "E415: odotuksenvastainen =-merkki: %s" -#: ../ex_cmds.c:4387 #, c-format -msgid "% matches" -msgstr "% tsmyst" +#~ msgid "key %s" +#~ msgstr "" -#: ../ex_cmds.c:4388 #, c-format -msgid "% substitutions" -msgstr "% korvausta" - -#: ../ex_cmds.c:4392 -msgid " on 1 line" -msgstr " 1 rivill" +#~ msgid "key %s at index %i from special map" +#~ msgstr "" -#: ../ex_cmds.c:4395 #, c-format -msgid " on % lines" -msgstr " % rivill" - -#: ../ex_cmds.c:4438 -msgid "E147: Cannot do :global recursive" -msgstr "E147: :globalia ei voi suorittaa rekursiivisesti" - -#: ../ex_cmds.c:4467 -msgid "E148: Regular expression missing from global" -msgstr "E148: Snnllinen ilmaus puuttuu globaalista" +#~ msgid "index %i" +#~ msgstr "" -#: ../ex_cmds.c:4508 -#, c-format -msgid "Pattern found in every line: %s" -msgstr "Kuvio lytyi joka rivilt: %s" +#~ msgid "partial" +#~ msgstr "" -#: ../ex_cmds.c:4510 #, fuzzy, c-format -msgid "Pattern not found: %s" -msgstr "Kuviota ei lydy" +#~ msgid "argument %i" +#~ msgstr "-c-argumentti" -#: ../ex_cmds.c:4587 -msgid "" -"\n" -"# Last Substitute String:\n" -"$" -msgstr "" -"\n" -"# Viimeisin korvausmerkkijono:\n" -"$" +#, fuzzy +#~ msgid "partial self dictionary" +#~ msgstr "ei voida muuttaa kiinnitettyä sanakirjaa" -#: ../ex_cmds.c:4679 -msgid "E478: Don't panic!" -msgstr "E478: l panikoi." +#~ msgid "itself" +#~ msgstr "" -#: ../ex_cmds.c:4717 -#, c-format -msgid "E661: Sorry, no '%s' help for %s" -msgstr "E661: Sori, ei lydy %s-ohjetta kohteelle %s" +#. Only give this message once for a recursive call to avoid +#. flooding the user with errors. +#~ msgid "E724: unable to correctly dump variable with self-referencing container" +#~ msgstr "" -#: ../ex_cmds.c:4719 -#, c-format -msgid "E149: Sorry, no help for %s" -msgstr "E149: Sori, ei lydy ohjetta kohteelle %s" +#~ msgid "E474: Unable to represent NaN value in JSON" +#~ msgstr "" -#: ../ex_cmds.c:4751 -#, c-format -msgid "Sorry, help file \"%s\" not found" -msgstr "Sori, ohjetiedostoa %s ei lydy" +#~ msgid "E474: Unable to represent infinity in JSON" +#~ msgstr "" -#: ../ex_cmds.c:5323 #, c-format -msgid "E150: Not a directory: %s" -msgstr "E150: Ei ole hakemisto: %s" +#~ msgid "" +#~ "E474: String \"%.*s\" contains byte that does not start any UTF-8 character" +#~ msgstr "" -#: ../ex_cmds.c:5446 #, c-format -msgid "E152: Cannot open %s for writing" -msgstr "E152: Ei voi avata tiedostoa %s kirjoittamista varten" +#~ msgid "" +#~ "E474: UTF-8 string contains code point which belongs to a surrogate pair: " +#~ "%.*s" +#~ msgstr "" -#: ../ex_cmds.c:5471 -#, c-format -msgid "E153: Unable to open %s for reading" -msgstr "E153: Ei voi avata tiedostoa %s lukemista varten" +#, fuzzy +#~ msgid "E474: Unable to convert EXT string to JSON" +#~ msgstr "E620: Tulostuskoodaukseen %s muunto ei onnistu" -#: ../ex_cmds.c:5500 #, c-format -msgid "E670: Mix of help file encodings within a language: %s" -msgstr "E670: Monia ohjetiedostokoodauksia kieless: %s" +#~ msgid "E474: Error while dumping %s, %s: attempt to dump function reference" +#~ msgstr "" + +#, fuzzy +#~ msgid "E474: Invalid key in special dictionary" +#~ msgstr "E736: Virheellinen toiminto sanakirjalle" -#: ../ex_cmds.c:5565 #, c-format -msgid "E154: Duplicate tag \"%s\" in file %s/%s" -msgstr "E154: Kaksoiskappale tgist %s tiedostossa %s/%s" +#~ msgid "E5004: Error while dumping %s, %s: attempt to dump function reference" +#~ msgstr "" -#: ../ex_cmds.c:5687 #, c-format -msgid "E160: Unknown sign command: %s" -msgstr "E160: Tuntematon merkkikomento: %s" +#~ msgid "E5005: Unable to dump %s: container references itself in %s" +#~ msgstr "" -#: ../ex_cmds.c:5704 -msgid "E156: Missing sign name" -msgstr "E156: Merkki puuttuu" +#, fuzzy, c-format +#~ msgid "E684: list index out of range: %" +#~ msgstr "E684: Indeksi %ld luettelon rajojen ulkopuolella" -#: ../ex_cmds.c:5746 -msgid "E612: Too many signs defined" -msgstr "E612: Liikaa merkkej mritelty" +#~ msgid "E6000: Argument is not a function or function name" +#~ msgstr "" -#: ../ex_cmds.c:5813 #, c-format -msgid "E239: Invalid sign text: %s" -msgstr "E239: Virheellinen merkkiteksti: %s" +msgid "E737: Key already exists: %s" +msgstr "E737: Avain on jo olemassa: %s" -#: ../ex_cmds.c:5844 ../ex_cmds.c:6035 -#, c-format -msgid "E155: Unknown sign: %s" -msgstr "E155: Tuntematon merkki: %s" +#, fuzzy +#~ msgid "tv_clear() argument" +#~ msgstr "filter()-argumentti" -#: ../ex_cmds.c:5877 -msgid "E159: Missing sign number" -msgstr "E159: Merkin numero puuttuu" +msgid "E743: variable nested too deep for (un)lock" +msgstr "E743: muuttujassa liian monta tasoa lukituksen käsittelyyn" -#: ../ex_cmds.c:5971 -#, c-format -msgid "E158: Invalid buffer name: %s" -msgstr "E158: Virheellinen puskurin nimi: %s" +#, fuzzy, c-format +#~ msgid "E741: Value is locked: %.*s" +#~ msgstr "E741: Arvo on lukittu: %s" -#: ../ex_cmds.c:6008 -#, c-format -msgid "E157: Invalid sign ID: %" -msgstr "E157: Virheellinen merkin tunnus: %" +#, fuzzy, c-format +#~ msgid "E742: Cannot change value of %.*s" +#~ msgstr "E742: Ei voi muuttaa muuttujan %s arvoa" -#: ../ex_cmds.c:6066 -msgid " (not supported)" -msgstr " (ei tuettu)" +msgid "Unknown" +msgstr "Tuntematon" -#: ../ex_cmds.c:6169 -msgid "[Deleted]" -msgstr "[Poistettu]" +#, fuzzy +#~ msgid "E805: Expected a Number or a String, Float found" +#~ msgstr "E807: Odotettiin Float-argumenttia printf():lle" -#: ../ex_cmds2.c:139 -msgid "Entering Debug mode. Type \"cont\" to continue." -msgstr "Siirrytn vianetsinttilaan, kirjoita cont jatkaaksesi." +#~ msgid "E703: Expected a Number or a String, Funcref found" +#~ msgstr "" -#: ../ex_cmds2.c:143 ../ex_docmd.c:759 -#, c-format -msgid "line %: %s" -msgstr "rivi %: %s" +#, fuzzy +#~ msgid "E745: Expected a Number or a String, List found" +#~ msgstr "E807: Odotettiin Float-argumenttia printf():lle" -#: ../ex_cmds2.c:145 -#, c-format -msgid "cmd: %s" -msgstr "kmnt: %s" +#~ msgid "E728: Expected a Number or a String, Dictionary found" +#~ msgstr "" + +#, fuzzy +#~ msgid "E5300: Expected a Number or a String" +#~ msgstr "E807: Odotettiin Float-argumenttia printf():lle" + +msgid "E745: Using a List as a Number" +msgstr "E745: Lista ei käy Numberista" + +msgid "E728: Using a Dictionary as a Number" +msgstr "E728: Sanakirja ei käy Numberista" + +msgid "E805: Using a Float as a Number" +msgstr "E805: Float ei käy Numberista" + +#, fuzzy +#~ msgid "E685: using an invalid value as a Number" +#~ msgstr "E908: huono arvo merkkijonolle" + +msgid "E730: using List as a String" +msgstr "E730: Lista ei käy merkkijonosta" + +msgid "E731: using Dictionary as a String" +msgstr "E731: Sanakirja ei käy merkkijonosta" + +msgid "E908: using an invalid value as a String" +msgstr "E908: huono arvo merkkijonolle" + +msgid "E891: Using a Funcref as a Float" +msgstr "E891: Funcref ei käy Floatista" + +msgid "E892: Using a String as a Float" +msgstr "E892: String ei käy Floatista" + +msgid "E893: Using a List as a Float" +msgstr "E893: Lista ei käy Floatista" + +msgid "E894: Using a Dictionary as a Float" +msgstr "E894: Sanakirja ei käy Floatista" + +msgid "E907: Using a special value as a Float" +msgstr "E907: Käytettiin erikoisarvoa Floattina" + +msgid "E808: Number or Float required" +msgstr "E808: Number tai Float vaaditaan" + +# puhutaan merkin ulkoasusta snprintf(..., c, c, c, c) +#, c-format +msgid "<%s>%s%s %d, Hex %02x, Octal %03o" +msgstr "<%s>%s%s %d, heksana %02x, oktaalina %03o" + +#, c-format +msgid "> %d, Hex %04x, Octal %o" +msgstr "> %d, heksana %04x, oktaalina %o" + +#, c-format +msgid "> %d, Hex %08x, Octal %o" +msgstr "> %d, hekdana %08x, oktaalina %o" + +msgid "E134: Move lines into themselves" +msgstr "E134: Rivien siirto itsejensä päälle" + +msgid "1 line moved" +msgstr "1 rivi siirretty" + +#, fuzzy, c-format +#~ msgid "% lines moved" +#~ msgstr "%ld riviä siirretty" + +#, c-format +msgid "E482: Can't create file %s" +msgstr "E482: Tiedostoa %s ei voi luoda" + +#, fuzzy, c-format +#~ msgid "% lines filtered" +#~ msgstr "%ld riviä suodatettu" + +msgid "E135: *Filter* Autocommands must not change current buffer" +msgstr "E135: *Filter*-autocommand ei voi vaihtaa puskuria" + +msgid "[No write since last change]\n" +msgstr "[Viimeisintä muutosta ei ole kirjoitettu]\n" + +msgid "Write partial file?" +msgstr "Kirjoita osittainen tiedosto" + +msgid "E140: Use ! to write partial buffer" +msgstr "E140: Käytä !-komentoa osittaisen puskurin kirjoittamiseen" + +#, c-format +msgid "Overwrite existing file \"%s\"?" +msgstr "Ylikirjoitetaanko olemassaoleva tiedosto %s?" + +#, c-format +msgid "Swap file \"%s\" exists, overwrite anyway?" +msgstr "Swap-tiedosto %s on olemassa, ylikirjoitetaanko?" + +#, c-format +msgid "E768: Swap file exists: %s (:silent! overrides)" +msgstr "E768: Swap-tiedosto on jo olemassa: %s (komento :silent! ohittaa)" + +#, fuzzy, c-format +#~ msgid "E141: No file name for buffer %" +#~ msgstr "E141: Ei tiedostonimeä puskurille %ld" + +msgid "E142: File not written: Writing is disabled by 'write' option" +msgstr "" +"E142: Tiedostoa ei kirjoitettu; write-asetus poistaa kirjoituksen käytöstä" + +#, c-format +msgid "" +"'readonly' option is set for \"%s\".\n" +"Do you wish to write anyway?" +msgstr "" +"readonly asetettu tiedostolle \"%s\".\n" +"Kirjoitetaanko?" + +#, c-format +msgid "" +"File permissions of \"%s\" are read-only.\n" +"It may still be possible to write it.\n" +"Do you wish to try?" +msgstr "" +"Tiedosto %s on kirjoitussuojattu.\n" +"Siihen saattaa voida silti kirjoittaa.\n" +"Yritetäänkö?" + +#, c-format +msgid "E505: \"%s\" is read-only (add ! to override)" +msgstr "E505: %s on kirjoitussuojattu (lisää komentoon ! ohittaaksesi)" + +#, c-format +msgid "E143: Autocommands unexpectedly deleted new buffer %s" +msgstr "E143: Autocommand poisti uuden puskurin odotuksen vastaisesti %s" + +msgid "E144: non-numeric argument to :z" +msgstr "E144: :z:n argumentti ei ole numero" + +#, fuzzy +#~ msgid "E145: Shell commands not allowed in restricted mode" +#~ msgstr "E145: Kuoren komennot eivät toimi rvimissä" + +msgid "E146: Regular expressions can't be delimited by letters" +msgstr "E146: Säännöllistä ilmausta ei voi rajata kirjaimilla" + +#, c-format +msgid "replace with %s (y/n/a/q/l/^E/^Y)?" +msgstr "korvaa kohteella %s (y/n/a/q/l/^E/^Y)?" + +msgid "(Interrupted) " +msgstr "(Keskeytetty)" + +msgid "1 match" +msgstr "1 täsmäys" + +msgid "1 substitution" +msgstr "1 korvaus" + +#, fuzzy, c-format +#~ msgid "% matches" +#~ msgstr "%ld täsmäystä" + +#, fuzzy, c-format +#~ msgid "% substitutions" +#~ msgstr "%ld korvausta" + +msgid " on 1 line" +msgstr " 1 rivillä" + +#, fuzzy, c-format +#~ msgid " on % lines" +#~ msgstr " %ld rivillä" + +msgid "E147: Cannot do :global recursive" +msgstr "E147: :globalia ei voi suorittaa rekursiivisesti" + +msgid "E148: Regular expression missing from global" +msgstr "E148: Säännöllinen ilmaus puuttuu globaalista" + +#, c-format +msgid "Pattern found in every line: %s" +msgstr "Kuvio löytyi joka riviltä: %s" + +#, c-format +msgid "Pattern not found: %s" +msgstr "Kuviota ei löydy: %s" + +msgid "E478: Don't panic!" +msgstr "E478: Älä panikoi." + +#, c-format +msgid "E661: Sorry, no '%s' help for %s" +msgstr "E661: ei löydy %s-ohjetta kohteelle %s" + +#, c-format +msgid "E149: Sorry, no help for %s" +msgstr "E149: ei löydy ohjetta kohteelle %s" + +#, c-format +msgid "Sorry, help file \"%s\" not found" +msgstr "ohjetiedostoa %s ei löydy" + +#, c-format +msgid "E152: Cannot open %s for writing" +msgstr "E152: Ei voi avata tiedostoa %s kirjoittamista varten" + +#, c-format +msgid "E153: Unable to open %s for reading" +msgstr "E153: Ei voi avata tiedostoa %s lukemista varten" + +#, c-format +msgid "E670: Mix of help file encodings within a language: %s" +msgstr "E670: Monia ohjetiedostokoodauksia kielessä: %s" + +#, c-format +msgid "E154: Duplicate tag \"%s\" in file %s/%s" +msgstr "E154: Kaksoiskappale tägistä %s tiedostossa %s/%s" + +#, c-format +msgid "E150: Not a directory: %s" +msgstr "E150: Ei ole hakemisto: %s" + +#, c-format +msgid "E160: Unknown sign command: %s" +msgstr "E160: Tuntematon merkkikomento: %s" + +msgid "E156: Missing sign name" +msgstr "E156: Merkki puuttuu" + +msgid "E612: Too many signs defined" +msgstr "E612: Liikaa merkkejä määritelty" + +#, c-format +msgid "E239: Invalid sign text: %s" +msgstr "E239: Virheellinen merkkiteksti: %s" + +#, c-format +msgid "E155: Unknown sign: %s" +msgstr "E155: Tuntematon merkki: %s" + +msgid "E159: Missing sign number" +msgstr "E159: Merkin numero puuttuu" + +#, c-format +msgid "E158: Invalid buffer name: %s" +msgstr "E158: Virheellinen puskurin nimi: %s" + +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: Ei voida hypätä puskuriin jolla ei ole nimeä" + +#, fuzzy, c-format +#~ msgid "E157: Invalid sign ID: %" +#~ msgstr "E157: Virheellinen merkin tunnus: %ld" + +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: Ei voida muuttaa merkkiä %s" + +msgid " (not supported)" +msgstr " (ei tuettu)" + +msgid "[Deleted]" +msgstr "[Poistettu]" + +msgid "Entering Debug mode. Type \"cont\" to continue." +msgstr "Siirrytään vianetsintätilaan, kirjoita cont jatkaaksesi." + +#, fuzzy, c-format +#~ msgid "line %: %s" +#~ msgstr "rivi %ld: %s" + +#, c-format +msgid "cmd: %s" +msgstr "kmnt: %s" + +msgid "frame is zero" +msgstr "kehys on nolla" -#: ../ex_cmds2.c:322 #, c-format -msgid "Breakpoint in \"%s%s\" line %" -msgstr "Katkaisukohta %s%s rivill %" +msgid "frame at highest level: %d" +msgstr "kehys ylimmällä tasolla: %d" + +#, fuzzy, c-format +#~ msgid "Breakpoint in \"%s%s\" line %" +#~ msgstr "Katkaisukohta %s%s rivillä %ld" -#: ../ex_cmds2.c:581 #, c-format msgid "E161: Breakpoint not found: %s" msgstr "E161: Katkaisukohta puuttuu: %s" -#: ../ex_cmds2.c:611 msgid "No breakpoints defined" msgstr "Ei katkaisukohtia" -#: ../ex_cmds2.c:617 -#, c-format -msgid "%3d %s %s line %" -msgstr "%3d %s %s rivi %" +#, fuzzy, c-format +#~ msgid "%3d %s %s line %" +#~ msgstr "%3d %s %s rivi %ld" -#: ../ex_cmds2.c:942 msgid "E750: First use \":profile start {fname}\"" -msgstr "E750: Aloita kskyll :profile start {fname}" +msgstr "E750: Aloita käskyllä :profile start {fname}" -#: ../ex_cmds2.c:1269 #, c-format msgid "Save changes to \"%s\"?" msgstr "Tallennetaanko muutokset tiedostoon %s?" -#: ../ex_cmds2.c:1271 ../ex_docmd.c:8851 msgid "Untitled" -msgstr "Nimetn" +msgstr "Nimetön" -#: ../ex_cmds2.c:1421 #, c-format msgid "E162: No write since last change for buffer \"%s\"" -msgstr "E162: Muutoksia ei ole kirjoitettu puskurin %s viime muutoksen jlkeen" +msgstr "E162: Muutoksia ei ole kirjoitettu puskurin %s viime muutoksen jälkeen" -#: ../ex_cmds2.c:1480 msgid "Warning: Entered other buffer unexpectedly (check autocommands)" msgstr "Varoitus: Puskuri vaihtui odottamatta (tarkista autocommands)" -#: ../ex_cmds2.c:1826 msgid "E163: There is only one file to edit" msgstr "E163: Vain yksi tiedosto muokattavana" -#: ../ex_cmds2.c:1828 msgid "E164: Cannot go before first file" -msgstr "E164: Ensimmisen tiedoston ohi ei voi menn" +msgstr "E164: Ensimmäisen tiedoston ohi ei voi mennä" -#: ../ex_cmds2.c:1830 msgid "E165: Cannot go beyond last file" -msgstr "E165: Viimeisen tiedoston ohi ei voi menn" +msgstr "E165: Viimeisen tiedoston ohi ei voi mennä" -#: ../ex_cmds2.c:2175 #, c-format msgid "E666: compiler not supported: %s" -msgstr "E666: kntj ei tueta: %s" +msgstr "E666: kääntäjää ei tueta: %s" -#: ../ex_cmds2.c:2257 #, c-format msgid "Searching for \"%s\" in \"%s\"" -msgstr "Etsitn ilmausta %s kohteesta %s" +msgstr "Etsitään ilmausta %s kohteesta %s" -#: ../ex_cmds2.c:2284 #, c-format msgid "Searching for \"%s\"" -msgstr "Etsitn ilmausta %s" +msgstr "Etsitään ilmausta %s" -#: ../ex_cmds2.c:2307 #, c-format -msgid "not found in 'runtimepath': \"%s\"" -msgstr "ei lydy runtimepathista: %s" +msgid "not found in '%s': \"%s\"" +msgstr "'%s' ei löydy kohteesta: %s" -#: ../ex_cmds2.c:2472 #, c-format msgid "Cannot source a directory: \"%s\"" msgstr "Hakemistoa ei voi ladata: %s" -#: ../ex_cmds2.c:2518 #, c-format msgid "could not source \"%s\"" msgstr "ei voitu ladata %s" -#: ../ex_cmds2.c:2520 -#, c-format -msgid "line %: could not source \"%s\"" -msgstr "rivi %: ei voitu ladata %s" +#, fuzzy, c-format +#~ msgid "line %: could not source \"%s\"" +#~ msgstr "rivi %ld: ei voitu ladata %s" -#: ../ex_cmds2.c:2535 #, c-format msgid "sourcing \"%s\"" msgstr "ladataan %s" -#: ../ex_cmds2.c:2537 -#, c-format -msgid "line %: sourcing \"%s\"" -msgstr "rivi %: ladataan %s" +#, fuzzy, c-format +#~ msgid "line %: sourcing \"%s\"" +#~ msgstr "rivi %ld: ladataan %s" -#: ../ex_cmds2.c:2693 #, c-format msgid "finished sourcing %s" msgstr "ladattu %s" -#: ../ex_cmds2.c:2765 msgid "modeline" msgstr "mode-rivi" -#: ../ex_cmds2.c:2767 msgid "--cmd argument" msgstr "--cmd-argumentti" -#: ../ex_cmds2.c:2769 msgid "-c argument" msgstr "-c-argumentti" -#: ../ex_cmds2.c:2771 msgid "environment variable" -msgstr "ympristmuuttuja" +msgstr "ympäristömuuttuja" -#: ../ex_cmds2.c:2773 msgid "error handler" -msgstr "virheksittelin" +msgstr "virhekäsittelin" -#: ../ex_cmds2.c:3020 msgid "W15: Warning: Wrong line separator, ^M may be missing" -msgstr "W15: Varoitus: Vr rivierotin, ^M saattaa puuttua" +msgstr "W15: Varoitus: Väärä rivierotin, ^M saattaa puuttua" -#: ../ex_cmds2.c:3139 msgid "E167: :scriptencoding used outside of a sourced file" msgstr "E167: :scriptencoding ladatun tiedoston ulkopuolella" -#: ../ex_cmds2.c:3166 msgid "E168: :finish used outside of a sourced file" msgstr "E168: :finish ladatun tiedoston ulkopuolella" -#: ../ex_cmds2.c:3389 #, c-format msgid "Current %slanguage: \"%s\"" -msgstr "Kytss oleva %skieli: %s" +msgstr "Käytössä oleva %skieli: %s" -#: ../ex_cmds2.c:3404 #, c-format msgid "E197: Cannot set language to \"%s\"" -msgstr "E197: Kieleksi ei voitu asettaa kielt %s" +msgstr "E197: Kieleksi ei voitu asettaa kieltä %s" #. don't redisplay the window #. don't wait for return -#: ../ex_docmd.c:387 msgid "Entering Ex mode. Type \"visual\" to go to Normal mode." -msgstr "Siirrytn Ex-tilaan, kirjoita visual palataksesi normaaliin tilaan." +msgstr "Siirrytään Ex-tilaan, kirjoita visual palataksesi normaaliin tilaan." -#: ../ex_docmd.c:428 msgid "E501: At end-of-file" msgstr "E501: Tiedoston lopussa" -#: ../ex_docmd.c:513 msgid "E169: Command too recursive" msgstr "E169: Liian rekursiivinen komento" -#: ../ex_docmd.c:1006 +#, fuzzy +#~ msgid "line %" +#~ msgstr "rivi %ld" + #, c-format msgid "E605: Exception not caught: %s" msgstr "E605: Kiinniottamaton poikkeus: %s" -#: ../ex_docmd.c:1085 msgid "End of sourced file" msgstr "Ladatun tiedoston loppu" -#: ../ex_docmd.c:1086 msgid "End of function" msgstr "Funktion loppu" -#: ../ex_docmd.c:1628 msgid "E464: Ambiguous use of user-defined command" -msgstr "E464: Kyttjn mrittelemn komennon monimerkityksinen kytt" +msgstr "E464: Käyttäjän määrittelemän komennon monimerkityksinen käyttö" -#: ../ex_docmd.c:1638 msgid "E492: Not an editor command" msgstr "E492: Ei ole editorikomento" -#: ../ex_docmd.c:1729 msgid "E493: Backwards range given" msgstr "E493: Takaperoinen arvoalue annettu" -#: ../ex_docmd.c:1733 msgid "Backwards range given, OK to swap" -msgstr "Takaperoinen arvoalue annettu, OK knt" +msgstr "Takaperoinen arvoalue annettu, OK kääntää" #. append #. typed wrong -#: ../ex_docmd.c:1787 msgid "E494: Use w or w>>" -msgstr "E494: Kyt w:t tai w>>:aa" - -#: ../ex_docmd.c:3454 -msgid "E319: The command is not available in this version" -msgstr "E319: Komento ei ole kytettviss tss versiossa" +msgstr "E494: Käytä w:tä tai w>>:aa" -#: ../ex_docmd.c:3752 -msgid "E172: Only one file name allowed" -msgstr "E172: Vain yksi tiedostonimi sallitaan" +#, fuzzy +#~ msgid "E319: The command is not available in this version" +#~ msgstr "E319: Komento ei ole käytettävissä tässä versiossa" -#: ../ex_docmd.c:4238 msgid "1 more file to edit. Quit anyway?" -msgstr "viel 1 tiedosto muokattavana, lopetaanko silti?" +msgstr "vielä 1 tiedosto muokattavana, lopetaanko silti?" -#: ../ex_docmd.c:4242 #, c-format msgid "%d more files to edit. Quit anyway?" -msgstr "viel %d tiedostoa muokattavana, lopetetaanko silti?" +msgstr "vielä %d tiedostoa muokattavana, lopetetaanko silti?" -#: ../ex_docmd.c:4248 msgid "E173: 1 more file to edit" -msgstr "E173: viel 1 tiedosto muokattavana" +msgstr "E173: vielä 1 tiedosto muokattavana" -#: ../ex_docmd.c:4250 -#, c-format -msgid "E173: % more files to edit" -msgstr "E173: viel % tiedostoa muokattavana" +#, fuzzy, c-format +#~ msgid "E173: % more files to edit" +#~ msgstr "E173: vielä %ld tiedostoa muokattavana" -#: ../ex_docmd.c:4320 msgid "E174: Command already exists: add ! to replace it" -msgstr "E174: Komento on jo olemassa, kyt !: korvataksesi" +msgstr "E174: Komento on jo olemassa, käytä !:ä korvataksesi" -#: ../ex_docmd.c:4432 msgid "" "\n" -" Name Args Range Complete Definition" +" Name Args Address Complete Definition" msgstr "" "\n" -" Nimi Arg Arvot Valmis Mritelm" +" Nimi Argumentit Osoite Valmis Määritelmä" -#: ../ex_docmd.c:4516 msgid "No user-defined commands found" -msgstr "Ei kyttjn mrittelemi komentoja" +msgstr "Ei käyttäjän määrittelemiä komentoja" -#: ../ex_docmd.c:4538 msgid "E175: No attribute specified" -msgstr "E175: Ei attribuutteja mriteltyn" +msgstr "E175: Ei attribuutteja määriteltynä" -#: ../ex_docmd.c:4583 msgid "E176: Invalid number of arguments" -msgstr "E176: Vr mr attribuutteja" +msgstr "E176: Väärä määrä attribuutteja" -#: ../ex_docmd.c:4594 msgid "E177: Count cannot be specified twice" -msgstr "E177: Lukumr ei voi mritell kahdesti" +msgstr "E177: Lukumäärää ei voi määritellä kahdesti" -#: ../ex_docmd.c:4603 msgid "E178: Invalid default value for count" -msgstr "E178: Lukumrn oletusarvo on vr" +msgstr "E178: Lukumäärän oletusarvo on väärä" -#: ../ex_docmd.c:4625 msgid "E179: argument required for -complete" msgstr "E179: -complete vaatii argumentin" -#: ../ex_docmd.c:4635 +msgid "E179: argument required for -addr" +msgstr "E179: -addr vaatii argumentin" + #, c-format msgid "E181: Invalid attribute: %s" msgstr "E181: Virheellinen attribuutti: %s" -#: ../ex_docmd.c:4678 msgid "E182: Invalid command name" msgstr "E182: Virheellinen komennon nimi" -#: ../ex_docmd.c:4691 msgid "E183: User defined commands must start with an uppercase letter" -msgstr "E183: Kyttjn mrittelemn komennon pit alkaa suuraakkosella" +msgstr "E183: Käyttäjän määrittelemän komennon pitää alkaa suuraakkosella" -#: ../ex_docmd.c:4696 -#, fuzzy msgid "E841: Reserved name, cannot be used for user defined command" -msgstr "E464: Kyttjn mrittelemn komennon monimerkityksinen kytt" +msgstr "E841: Varattua nimeä ei voi käyttää käyttäjän määrittelemänä komentona" -#: ../ex_docmd.c:4751 #, c-format msgid "E184: No such user-defined command: %s" -msgstr "E184: Kyttjn komentoa ei ole olemassa: %s" +msgstr "E184: Käyttäjän komentoa ei ole olemassa: %s" + +#, c-format +msgid "E180: Invalid address type value: %s" +msgstr "E180: Virheellinen osoitetyyppiarvo: %s" -#: ../ex_docmd.c:5219 #, c-format msgid "E180: Invalid complete value: %s" -msgstr "E180: Virheellinen tydennysarvo: %s" +msgstr "E180: Virheellinen täydennysarvo: %s" -#: ../ex_docmd.c:5225 msgid "E468: Completion argument only allowed for custom completion" -msgstr "E468: Tydennysargumentti sopii vain itse mriteltyyn tydennykseen" +msgstr "E468: Täydennysargumentti sopii vain itse määriteltyyn täydennykseen" -#: ../ex_docmd.c:5231 msgid "E467: Custom completion requires a function argument" -msgstr "E467: Itse mritelty tydennys vaatii funktioargumentin" +msgstr "E467: Itse määritelty täydennys vaatii funktioargumentin" -#: ../ex_docmd.c:5257 -#, fuzzy, c-format +#, c-format msgid "E185: Cannot find color scheme '%s'" -msgstr "E185: Vriteemaa %s ei lydy" +msgstr "E185: Väriteemaa %s ei löydy" -#: ../ex_docmd.c:5263 msgid "Greetings, Vim user!" -msgstr "Tervehdys, Vimin kyttj." +msgstr "Tervehdys, Vimin käyttäjä." -#: ../ex_docmd.c:5431 msgid "E784: Cannot close last tab page" -msgstr "E784: Viimeist vlilehte ei voi sulkea" +msgstr "E784: Viimeistä välilehteä ei voi sulkea" -#: ../ex_docmd.c:5462 msgid "Already only one tab page" -msgstr "Vain yksi vlilehti jljell en" +msgstr "Vain yksi välilehti jäljellä enää" -#: ../ex_docmd.c:6004 #, c-format msgid "Tab page %d" msgstr "Tabisivu %d" -#: ../ex_docmd.c:6295 msgid "No swap file" msgstr "Ei swap-tiedostoa" -#: ../ex_docmd.c:6478 -msgid "E747: Cannot change directory, buffer is modified (add ! to override)" -msgstr "" -"E747: Hakemistoa ei voida muuttaa, puskuria on muokattu (lis komentoon ! " -"ohittaaksesi" - -#: ../ex_docmd.c:6485 msgid "E186: No previous directory" -msgstr "E186: Ei edellist hakemistoa" +msgstr "E186: Ei edellistä hakemistoa" -#: ../ex_docmd.c:6530 msgid "E187: Unknown" msgstr "E187: Tuntematon" -#: ../ex_docmd.c:6610 msgid "E465: :winsize requires two number arguments" msgstr "E465: :winsize vaatii kaksi numeroargumenttia" -#: ../ex_docmd.c:6655 -msgid "E188: Obtaining window position not implemented for this platform" -msgstr "E188: Ikkunan sijainnin selvitys ei toimi tll alustalla" - -#: ../ex_docmd.c:6662 -msgid "E466: :winpos requires two number arguments" -msgstr "E466: :winpos vaatii kaksi lukuargumenttia" - -#: ../ex_docmd.c:7241 -#, c-format -msgid "E739: Cannot create directory: %s" -msgstr "E739: hakemistoa ei voi luoda: %s" - -#: ../ex_docmd.c:7268 #, c-format msgid "E189: \"%s\" exists (add ! to override)" -msgstr "E189: %s on jo olemassa (lis komentoon ! ohittaaksesi)" +msgstr "E189: %s on jo olemassa (lisää komentoon ! ohittaaksesi)" -#: ../ex_docmd.c:7273 #, c-format msgid "E190: Cannot open \"%s\" for writing" msgstr "E190: Tiedostoa %s ei voitu avata kirjoittamista varten" #. set mark -#: ../ex_docmd.c:7294 msgid "E191: Argument must be a letter or forward/backward quote" -msgstr "E191: Argumentin eteen- tai taaksepin lainaukseen pit olla kirjain" +msgstr "E191: Argumentin eteen- tai taaksepäin lainaukseen pitää olla kirjain" -#: ../ex_docmd.c:7333 msgid "E192: Recursive use of :normal too deep" -msgstr "E192: :normalin liian syv rekursio" +msgstr "E192: :normalin liian syvä rekursio" -#: ../ex_docmd.c:7807 msgid "E194: No alternate file name to substitute for '#'" -msgstr "E194: Ei vaihtoehtoista tiedostonime #:lle" +msgstr "E194: Ei vaihtoehtoista tiedostonimeä #:lle" -#: ../ex_docmd.c:7841 msgid "E495: no autocommand file name to substitute for \"\"" msgstr "E495: ei autocommand-tiedostoa kohteelle " -#: ../ex_docmd.c:7850 msgid "E496: no autocommand buffer number to substitute for \"\"" msgstr "E496: ei autocommand-puskurinumeroa kohteelle " -#: ../ex_docmd.c:7861 msgid "E497: no autocommand match name to substitute for \"\"" -msgstr "E497: ei autocommand-tsmysnime kohteella " +msgstr "E497: ei autocommand-täsmäysnimeä kohteella " -#: ../ex_docmd.c:7870 msgid "E498: no :source file name to substitute for \"\"" -msgstr "E498: ei :source-tiedostonime kohteelle " +msgstr "E498: ei :source-tiedostonimeä kohteelle " -#: ../ex_docmd.c:7876 -#, fuzzy msgid "E842: no line number to use for \"\"" -msgstr "E498: ei :source-tiedostonime kohteelle " +msgstr "E842: ei rivinumeroa kohteelle " -#: ../ex_docmd.c:7903 #, fuzzy, c-format -msgid "E499: Empty file name for '%' or '#', only works with \":p:h\"" -msgstr "E499: Tyhj tiedostonimi kohteissa % tai # toimii vain :p:h" +#~ msgid "E499: Empty file name for '%' or '#', only works with \":p:h\"" +#~ msgstr "E499: Tyhjä tiedostonimi kohteissa % tai # toimii vain :p:h" -#: ../ex_docmd.c:7905 msgid "E500: Evaluates to an empty string" -msgstr "E500: Loppuarvo on tyhj merkkijono" +msgstr "E500: Loppuarvo on tyhjä merkkijono" -#: ../ex_docmd.c:8838 -msgid "E195: Cannot open viminfo file for reading" -msgstr "E195: Viminfoa ei voi avata lukemista varten" - -#: ../ex_eval.c:464 msgid "E608: Cannot :throw exceptions with 'Vim' prefix" -msgstr "E608: Vim-alkuisia poikkeuksia ei voi heitt :throw-komennolla" +msgstr "E608: Vim-alkuisia poikkeuksia ei voi heittää :throw-komennolla" #. always scroll up, don't overwrite -#: ../ex_eval.c:496 #, c-format msgid "Exception thrown: %s" msgstr "Poikkeus heitetty: %s" -#: ../ex_eval.c:545 +#. always scroll up, don't overwrite #, c-format msgid "Exception finished: %s" msgstr "Poikkeus lopeteltu: %s" -#: ../ex_eval.c:546 #, c-format msgid "Exception discarded: %s" msgstr "Poikkeus poistettu: %s" -#: ../ex_eval.c:588 ../ex_eval.c:634 -#, c-format -msgid "%s, line %" -msgstr "%s, rivi %" +#, fuzzy, c-format +#~ msgid "%s, line %" +#~ msgstr "%s, rivi %ld" #. always scroll up, don't overwrite -#: ../ex_eval.c:608 #, c-format msgid "Exception caught: %s" msgstr "Poikkeus otettu kiinni: %s" -#: ../ex_eval.c:676 #, c-format msgid "%s made pending" msgstr "%s odotutettu" -#: ../ex_eval.c:679 #, c-format msgid "%s resumed" msgstr "%s palautettu" -#: ../ex_eval.c:683 #, c-format msgid "%s discarded" msgstr "%s poistettu" -#: ../ex_eval.c:708 msgid "Exception" msgstr "Poikkeus" -#: ../ex_eval.c:713 msgid "Error and interrupt" msgstr "Virhe ja keskeytys" -#: ../ex_eval.c:715 msgid "Error" msgstr "Virhe" #. if (pending & CSTP_INTERRUPT) -#: ../ex_eval.c:717 msgid "Interrupt" msgstr "Keskeytys" -#: ../ex_eval.c:795 msgid "E579: :if nesting too deep" msgstr "E579: liian monta kerrosta :if-komennossa" -#: ../ex_eval.c:830 msgid "E580: :endif without :if" msgstr "E580: :endif ilman komentoa :if" -#: ../ex_eval.c:873 msgid "E581: :else without :if" msgstr "E581: :else ilman komentoa :if" -#: ../ex_eval.c:876 msgid "E582: :elseif without :if" msgstr "E582: :elseif ilman komentoa :if" -#: ../ex_eval.c:880 msgid "E583: multiple :else" msgstr "E583: :else monta kertaa" -#: ../ex_eval.c:883 msgid "E584: :elseif after :else" -msgstr "E584: :elseif komennon :else jlkeen" +msgstr "E584: :elseif komennon :else jälkeen" -#: ../ex_eval.c:941 msgid "E585: :while/:for nesting too deep" msgstr "E585: liian monta tasoa :while- tai :for-komennoissa" -#: ../ex_eval.c:1028 msgid "E586: :continue without :while or :for" msgstr "E586: :continue ilman komentoa :while tai :for" -#: ../ex_eval.c:1061 msgid "E587: :break without :while or :for" msgstr "E587: :break ilman komentoa :while tai :for" -#: ../ex_eval.c:1102 msgid "E732: Using :endfor with :while" msgstr "E732: :endfor ilman komentoa :while" -#: ../ex_eval.c:1104 msgid "E733: Using :endwhile with :for" msgstr "E733: :endwhile ilman komentoa :for" -#: ../ex_eval.c:1247 msgid "E601: :try nesting too deep" msgstr "E601: liian monta tasoa :try-komennossa" -#: ../ex_eval.c:1317 msgid "E603: :catch without :try" msgstr "E603: :catch ilman komentoa :try" #. Give up for a ":catch" after ":finally" and ignore it. #. * Just parse. -#: ../ex_eval.c:1332 msgid "E604: :catch after :finally" msgstr "E604: :catch ilman komentoa :finally" -#: ../ex_eval.c:1451 msgid "E606: :finally without :try" msgstr "E606: :finally ilman komentoa :try" #. Give up for a multiple ":finally" and ignore it. -#: ../ex_eval.c:1467 msgid "E607: multiple :finally" msgstr "E607: :finally monta kertaa" -#: ../ex_eval.c:1571 msgid "E602: :endtry without :try" msgstr "E602: :endtry ilman komentoa :try" -#: ../ex_eval.c:2026 msgid "E193: :endfunction not inside a function" msgstr "E193: :endfunction funktion ulkopuolella" -#: ../ex_getln.c:1643 msgid "E788: Not allowed to edit another buffer now" msgstr "E788: Puskuria ei voi muokata nyt" -#: ../ex_getln.c:1656 msgid "E811: Not allowed to change buffer information now" msgstr "E811: Puskuria ei voi vaihtaa nyt" -#: ../ex_getln.c:3178 msgid "tagname" -msgstr "tginimi" +msgstr "täginimi" -#: ../ex_getln.c:3181 msgid " kind file\n" msgstr " -tiedostotyyppi\n" -#: ../ex_getln.c:4799 msgid "'history' option is zero" msgstr "history-asetus on nolla" -#: ../ex_getln.c:5046 -#, c-format -msgid "" -"\n" -"# %s History (newest to oldest):\n" -msgstr "" -"\n" -"# %s Historia (uusimmasta alkaen):\n" - -#: ../ex_getln.c:5047 -msgid "Command Line" -msgstr "Komentorivi" - -#: ../ex_getln.c:5048 -msgid "Search String" -msgstr "Hakujono" - -#: ../ex_getln.c:5049 -msgid "Expression" -msgstr "Ilmaus" - -#: ../ex_getln.c:5050 -msgid "Input Line" -msgstr "Syterivi" - -#: ../ex_getln.c:5117 msgid "E198: cmd_pchar beyond the command length" msgstr "E198: cmd_pchar komennon pituuden ulkopuolella" -#: ../ex_getln.c:5279 msgid "E199: Active window or buffer deleted" msgstr "E199: Aktiivinen ikkuna tai puskuri poistettu" -#: ../file_search.c:203 msgid "E854: path too long for completion" -msgstr "" +msgstr "E854: polku on liian pitkä täydennykseen" -#: ../file_search.c:446 #, c-format msgid "" "E343: Invalid path: '**[number]' must be at the end of the path or be " @@ -2011,376 +2098,296 @@ msgstr "" "E343: Virheellinen polku: '**[numero]' kuuluu polun loppuun tai ennen kohtaa " "%s." -#: ../file_search.c:1505 #, c-format msgid "E344: Can't find directory \"%s\" in cdpath" -msgstr "E344: Hakemistoa %s ei lydy cdpathista" +msgstr "E344: Hakemistoa %s ei löydy cdpathista" -#: ../file_search.c:1508 #, c-format msgid "E345: Can't find file \"%s\" in path" -msgstr "E345: Tiedostoa %s ei lydy polulta" +msgstr "E345: Tiedostoa %s ei löydy polulta" -#: ../file_search.c:1512 #, c-format msgid "E346: No more directory \"%s\" found in cdpath" -msgstr "E346: Hakemisto %s ei ole en cdpathissa" +msgstr "E346: Hakemisto %s ei ole enää cdpathissa" -#: ../file_search.c:1515 #, c-format msgid "E347: No more file \"%s\" found in path" -msgstr "E347: Tiedosto %s ei ole en polulla" +msgstr "E347: Tiedosto %s ei ole enää polulla" -#: ../fileio.c:137 msgid "E812: Autocommands changed buffer or buffer name" msgstr "E812: Autocommands muutti puskurin tai sen nimen" -#: ../fileio.c:368 msgid "Illegal file name" msgstr "Virheellinen tiedostonimi" -#: ../fileio.c:395 ../fileio.c:476 ../fileio.c:2543 ../fileio.c:2578 msgid "is a directory" msgstr "on hakemisto" -#: ../fileio.c:397 msgid "is not a file" msgstr "ei ole tiedosto" -#: ../fileio.c:508 ../fileio.c:3522 msgid "[New File]" msgstr "[Uusi tiedosto]" -#: ../fileio.c:511 msgid "[New DIRECTORY]" msgstr "[uusi HAKEMISTO]" -#: ../fileio.c:529 ../fileio.c:532 +#. libuv only returns -errno in Unix and in Windows open() does not +#. set EOVERFLOW msgid "[File too big]" msgstr "[Liian iso tiedosto]" -#: ../fileio.c:534 msgid "[Permission Denied]" msgstr "[Lupa kielletty]" -#: ../fileio.c:653 msgid "E200: *ReadPre autocommands made the file unreadable" msgstr "" -"E200: *ReadPre-autocommand-komennot tekivt tiedostosta lukukelvottoman" +"E200: *ReadPre-autocommand-komennot tekivät tiedostosta lukukelvottoman" -#: ../fileio.c:655 msgid "E201: *ReadPre autocommands must not change current buffer" -msgstr "E201: *ReadPre-autocommand-komennot eivt saa muuttaa puskuria" - -#: ../fileio.c:672 -msgid "Nvim: Reading from stdin...\n" -msgstr "Vim: Luetaan vakiosytteest...\n" +msgstr "E201: *ReadPre-autocommand-komennot eivät saa muuttaa puskuria" #. Re-opening the original file failed! -#: ../fileio.c:909 msgid "E202: Conversion made file unreadable!" msgstr "E202: Muunnos teki tiedostosta lukukelvottoman." #. fifo or socket -#: ../fileio.c:1782 msgid "[fifo/socket]" msgstr "[fifo t. soketti]" #. fifo -#: ../fileio.c:1788 msgid "[fifo]" msgstr "[fifo]" #. or socket -#: ../fileio.c:1794 msgid "[socket]" msgstr "[soketti]" #. or character special -#: ../fileio.c:1801 msgid "[character special]" msgstr "[merkki erikoinen]" -# Carriage Return elikk rivinvaihtomerkin ers muoto/osa (vrt. LF) -#: ../fileio.c:1815 +# Carriage Return elikkä rivinvaihtomerkin eräs muoto/osa (vrt. LF) msgid "[CR missing]" msgstr "[CR puuttuu]" -#: ../fileio.c:1819 msgid "[long lines split]" -msgstr "[pitkt rivit hajotettu]" +msgstr "[pitkät rivit hajotettu]" -#: ../fileio.c:1823 ../fileio.c:3512 msgid "[NOT converted]" msgstr "[EI muunnettu]" -#: ../fileio.c:1826 ../fileio.c:3515 msgid "[converted]" msgstr "[muunnettu]" -#: ../fileio.c:1831 -#, c-format -msgid "[CONVERSION ERROR in line %]" -msgstr "[MUUNNOSVIRHE rivill %]" +#, fuzzy, c-format +#~ msgid "[CONVERSION ERROR in line %]" +#~ msgstr "[MUUNNOSVIRHE rivillä %ld]" -#: ../fileio.c:1835 -#, c-format -msgid "[ILLEGAL BYTE in line %]" -msgstr "[VIRHEELLINEN OKTETTI rivill %]" +#, fuzzy, c-format +#~ msgid "[ILLEGAL BYTE in line %]" +#~ msgstr "[VIRHEELLINEN OKTETTI rivillä %ld]" -#: ../fileio.c:1838 msgid "[READ ERRORS]" -msgstr "[LUKUVIRHEIT]" +msgstr "[LUKUVIRHEITÄ]" -#: ../fileio.c:2104 msgid "Can't find temp file for conversion" -msgstr "Ei voi lyt vliaikaistiedstoa muuntamiseksi" +msgstr "Ei voi löytää väliaikaistiedstoa muuntamiseksi" -#: ../fileio.c:2110 msgid "Conversion with 'charconvert' failed" -msgstr "Muunnos charconvert eponnistui" +msgstr "Muunnos charconvert epäonnistui" -#: ../fileio.c:2113 msgid "can't read output of 'charconvert'" msgstr "charconvertin tulostetta ei voida lukea" -#: ../fileio.c:2437 msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: Ei autocommand-komentoa acwrite-puskurille" -#: ../fileio.c:2466 msgid "E203: Autocommands deleted or unloaded buffer to be written" msgstr "" "E203: Autocommand-komennot poistivat tai vapauttivat puskurin, johon piti " "kirjoittaa" -#: ../fileio.c:2486 msgid "E204: Autocommand changed number of lines in unexpected way" -msgstr "E204: Autocommand-komento muutti rivien mr odottamatta" +msgstr "E204: Autocommand-komento muutti rivien määrä odottamatta" -#: ../fileio.c:2548 ../fileio.c:2565 msgid "is not a file or writable device" msgstr "ei ole tiedosto tai kirjoitettava laite" -#: ../fileio.c:2601 msgid "is read-only (add ! to override)" -msgstr "on kirjoitussuojattu (lis komentoon ! ohittaaksesi)" +msgstr "on kirjoitussuojattu (lisää komentoon ! ohittaaksesi)" -#: ../fileio.c:2886 msgid "E506: Can't write to backup file (add ! to override)" msgstr "" -"E506: Ei voi kirjoittaa varmuuskopiotiedostoon (lis komentoon ! " +"E506: Ei voi kirjoittaa varmuuskopiotiedostoon (lisää komentoon ! " "ohittaaksesi)" -#: ../fileio.c:2898 -msgid "E507: Close error for backup file (add ! to override)" -msgstr "" -"E507: Varmuuskopiotiedoston sulkeminen ei onnistu (lis komentoon ! " -"ohittaaksesi)" +#, fuzzy, c-format +#~ msgid "E507: Close error for backup file (add ! to override): %s" +#~ msgstr "" +#~ "E507: Varmuuskopiotiedoston sulkeminen ei onnistu (lisää komentoon ! " +#~ "ohittaaksesi)" -#: ../fileio.c:2901 msgid "E508: Can't read file for backup (add ! to override)" msgstr "" -"E508: Varmuuskopiotiedostoa ei voi lukea (lis komentoon ! ohittaaksesi)" +"E508: Varmuuskopiotiedostoa ei voi lukea (lisää komentoon ! ohittaaksesi)" -#: ../fileio.c:2923 msgid "E509: Cannot create backup file (add ! to override)" msgstr "" -"E509: Ei voi luoda varmuuskopiotiedostoa (lis komentoon ! ohittaaksesi)" +"E509: Ei voi luoda varmuuskopiotiedostoa (lisää komentoon ! ohittaaksesi)" -#: ../fileio.c:3008 msgid "E510: Can't make backup file (add ! to override)" msgstr "" -"E510: Ei voi tehd varmuuskopiotiedostoa (lis komentoon ! ohittaaksesi)" +"E510: Ei voi tehdä varmuuskopiotiedostoa (lisää komentoon ! ohittaaksesi)" #. Can't write without a tempfile! -#: ../fileio.c:3121 msgid "E214: Can't find temp file for writing" -msgstr "E214: Ei voi lyt vliaikaistiedostoa kirjoitettavaksi" +msgstr "E214: Ei voi löytää väliaikaistiedostoa kirjoitettavaksi" -#: ../fileio.c:3134 msgid "E213: Cannot convert (add ! to write without conversion)" msgstr "" -"E213: Muunnos ei onnistu (lis komentoon ! kirjoittaaksesi muuntamatta)" +"E213: Muunnos ei onnistu (lisää komentoon ! kirjoittaaksesi muuntamatta)" -#: ../fileio.c:3169 msgid "E166: Can't open linked file for writing" msgstr "E166: Linkitetyn tiedoston avaus kirjoittamista varten ei onnistu" -#: ../fileio.c:3173 -msgid "E212: Can't open file for writing" -msgstr "E212: Tiedoston avaus kirjoittamista varten ei onnistu" +#, fuzzy, c-format +#~ msgid "E212: Can't open file for writing: %s" +#~ msgstr "E212: Tiedoston avaus kirjoittamista varten ei onnistu" -#: ../fileio.c:3363 -msgid "E667: Fsync failed" -msgstr "E667: Fsync ei onnistunut" +#, fuzzy, c-format +#~ msgid "E667: Fsync failed: %s" +#~ msgstr "E667: Fsync ei onnistunut" -#: ../fileio.c:3398 -msgid "E512: Close failed" -msgstr "E512: Sulkeminen ei onnistunut" +#, fuzzy, c-format +#~ msgid "E512: Close failed: %s" +#~ msgstr "E512: Sulkeminen ei onnistunut" -#: ../fileio.c:3436 msgid "E513: write error, conversion failed (make 'fenc' empty to override)" -msgstr "E513: kirjoitusvirhe, muunnos eponnistui (tyhj fenc ohittaaksesi)" +msgstr "E513: kirjoitusvirhe, muunnos epäonnistui (tyhjää fenc ohittaaksesi)" -#: ../fileio.c:3441 -#, c-format -msgid "" -"E513: write error, conversion failed in line % (make 'fenc' empty to " -"override)" -msgstr "" -"E513: kirjoitusvirhe, muunnos eponnistui rivill %(tyhj fenc " -"ohittaaksesi)" +#, fuzzy +#~ msgid "E513: write error, conversion failed in line %" +#~ msgstr "" +#~ "E513: kirjoitusvirhe, muunnos epäonnistui rivillä %ld(tyhjää fenc " +#~ "ohittaaksesi)" -#: ../fileio.c:3448 msgid "E514: write error (file system full?)" -msgstr "E514: kirjoitusvirhe (tiedostojrjestelm tysi)" +msgstr "E514: kirjoitusvirhe (tiedostojärjestelmä täysi)" -#: ../fileio.c:3506 msgid " CONVERSION ERROR" msgstr " MUUNNOSVIRHE" -#: ../fileio.c:3509 -#, c-format -msgid " in line %;" -msgstr " rivill %" +#, fuzzy, c-format +#~ msgid " in line %;" +#~ msgstr " rivillä %ld" -#: ../fileio.c:3519 msgid "[Device]" msgstr "[Laite]" -#: ../fileio.c:3522 msgid "[New]" msgstr "[Uusi]" -#: ../fileio.c:3535 msgid " [a]" msgstr " [a]" -#: ../fileio.c:3535 msgid " appended" -msgstr " listty" +msgstr " lisätty" -#: ../fileio.c:3537 msgid " [w]" msgstr " [w]" -#: ../fileio.c:3537 msgid " written" msgstr " kirjoitettu" -#: ../fileio.c:3579 msgid "E205: Patchmode: can't save original file" -msgstr "E205: Patch-tilassa ei voi tallentaa alkuperistiedostoa" +msgstr "E205: Patch-tilassa ei voi tallentaa alkuperäistiedostoa" -#: ../fileio.c:3602 msgid "E206: patchmode: can't touch empty original file" -msgstr "E206: patch-tilassa ei voi muuttaa tyhj alkuperistiedostoa" +msgstr "E206: patch-tilassa ei voi muuttaa tyhjää alkuperäistiedostoa" -#: ../fileio.c:3616 msgid "E207: Can't delete backup file" msgstr "E207: Ei voi poistaa varmuuskopiota" -#: ../fileio.c:3672 +#. Set highlight for error messages. msgid "" "\n" "WARNING: Original file may be lost or damaged\n" msgstr "" "\n" -"VAROITUS: Alkuperistiedosto voi hvit tai vahingoittua\n" +"VAROITUS: Alkuperäistiedosto voi hävitä tai vahingoittua\n" -#: ../fileio.c:3675 msgid "don't quit the editor until the file is successfully written!" -msgstr "l lopeta editoria kesken tallentamisen." - -#: ../fileio.c:3795 -msgid "[dos]" -msgstr "[dos]" +msgstr "älä lopeta editoria kesken tallentamisen." -#: ../fileio.c:3795 msgid "[dos format]" msgstr "[dos-muoto]" -#: ../fileio.c:3801 -msgid "[mac]" -msgstr "[mac]" +msgid "[dos]" +msgstr "[dos]" -#: ../fileio.c:3801 msgid "[mac format]" msgstr "[mac-muoto]" -#: ../fileio.c:3807 -msgid "[unix]" -msgstr "[unix]" +msgid "[mac]" +msgstr "[mac]" -#: ../fileio.c:3807 msgid "[unix format]" msgstr "[unix-muoto]" -#: ../fileio.c:3831 +msgid "[unix]" +msgstr "[unix]" + msgid "1 line, " msgstr "1 rivi, " -#: ../fileio.c:3833 -#, c-format -msgid "% lines, " -msgstr "% rivi, " +#, fuzzy, c-format +#~ msgid "% lines, " +#~ msgstr "%ld riviä, " -#: ../fileio.c:3836 msgid "1 character" msgstr "1 merkki" -#: ../fileio.c:3838 -#, c-format -msgid "% characters" -msgstr "% merkki" +#, fuzzy, c-format +#~ msgid "% characters" +#~ msgstr "%lld merkkiä" + +msgid "[Incomplete last line]" +msgstr "[Vajaa viimeinen rivi]" # ei rivinvaihtoja -#: ../fileio.c:3849 msgid "[noeol]" msgstr "[eiriviv.]" -#: ../fileio.c:3849 -msgid "[Incomplete last line]" -msgstr "[Vajaa viimeinen rivi]" - -# Jos aukiolevaa tiedostoa srkkii toisella ohjelmalla -#. don't overwrite messages here -#. must give this prompt -#. don't use emsg() here, don't want to flush the buffers -#: ../fileio.c:3865 +# Jos aukiolevaa tiedostoa sörkkii toisella ohjelmalla +#. Don't overwrite messages here. +#. Must give this prompt. +#. Don't use emsg() here, don't want to flush the buffers. msgid "WARNING: The file has been changed since reading it!!!" -msgstr "VAROITUS: tiedosto on muuttunut viime lukukerran jlkeen!" +msgstr "VAROITUS: tiedosto on muuttunut viime lukukerran jälkeen!" -#: ../fileio.c:3867 msgid "Do you really want to write to it" msgstr "Kirjoitetaanko" -#: ../fileio.c:4648 #, c-format msgid "E208: Error writing to \"%s\"" msgstr "E208: Virhe kirjoitettaessa tiedostoon %s" -#: ../fileio.c:4655 #, c-format msgid "E209: Error closing \"%s\"" msgstr "E209: Virhe suljettaessa tiedostoa %s" -#: ../fileio.c:4657 #, c-format msgid "E210: Error reading \"%s\"" msgstr "E210: Virhe luettaessa tiedostoa %s" -#: ../fileio.c:4883 msgid "E246: FileChangedShell autocommand deleted buffer" msgstr "E246: FileChangedShell-autocommand poisti puskurin" -#: ../fileio.c:4894 #, c-format msgid "E211: File \"%s\" no longer available" -msgstr "E211: Tiedostoa %s ei ole en" +msgstr "E211: Tiedostoa %s ei ole enää" -#: ../fileio.c:4906 #, c-format msgid "" "W12: Warning: File \"%s\" has changed and the buffer was changed in Vim as " @@ -2389,41 +2396,33 @@ msgstr "" "W12: Varoitus: Tiedostoa %s on muutettu ja Vimin puskurissa on muutoksia " "tiedostoon" -#: ../fileio.c:4907 msgid "See \":help W12\" for more info." -msgstr ":help W12 kertoo listietoja." +msgstr ":help W12 kertoo lisätietoja." -#: ../fileio.c:4910 #, c-format msgid "W11: Warning: File \"%s\" has changed since editing started" -msgstr "W11: Varoitus: Tiedostoa %s on muutettu muokkauksen aloituksen jlkeen" +msgstr "W11: Varoitus: Tiedostoa %s on muutettu muokkauksen aloituksen jälkeen" -#: ../fileio.c:4911 msgid "See \":help W11\" for more info." -msgstr ":help W11 kertoo listietoja." +msgstr ":help W11 kertoo lisätietoja." -#: ../fileio.c:4914 #, c-format msgid "W16: Warning: Mode of file \"%s\" has changed since editing started" msgstr "" "W16: Varoitus: Tiedoston %s oikeuksia on muutettu muokkauksen aloituksen " -"jlkeen" +"jälkeen" -#: ../fileio.c:4915 msgid "See \":help W16\" for more info." -msgstr ":help W16 kertoo listietoja." +msgstr ":help W16 kertoo lisätietoja." -#: ../fileio.c:4927 #, c-format msgid "W13: Warning: File \"%s\" has been created after editing started" -msgstr "W13: Varoitus: Tiedosto %s on luotu muokkauksen aloituksen jlkeen" +msgstr "W13: Varoitus: Tiedosto %s on luotu muokkauksen aloituksen jälkeen" -#: ../fileio.c:4947 msgid "Warning" msgstr "Varoitus" -# yll olevien varoitusten ratkaisut -#: ../fileio.c:4948 +# yllä olevien varoitusten ratkaisut msgid "" "&OK\n" "&Load File" @@ -2431,48 +2430,46 @@ msgstr "" "&OK\n" "&Avaa tiedosto uudelleen" -#: ../fileio.c:5065 #, c-format msgid "E462: Could not prepare for reloading \"%s\"" msgstr "E462: Ei voitu valmistella uudelleen avausta %s" -#: ../fileio.c:5078 #, c-format msgid "E321: Could not reload \"%s\"" msgstr "E321: Ei voitu uudelleenavata %s" -#: ../fileio.c:5601 msgid "--Deleted--" msgstr "--Poistettu--" -#: ../fileio.c:5732 #, c-format msgid "auto-removing autocommand: %s " msgstr "poistetaan autocommand automaattisesti: %s " #. the group doesn't exist -#: ../fileio.c:5772 #, c-format msgid "E367: No such group: \"%s\"" -msgstr "E367: Ryhm ei ole: %s" +msgstr "E367: Ryhmää ei ole: %s" + +#, fuzzy +#~ msgid "E936: Cannot delete the current group" +#~ msgstr "E351: Taitosta ei voi poistaa tällä foldmethodilla" + +msgid "W19: Deleting augroup that is still in use" +msgstr "W19: käytössä oleva augroup poistetaan" -#: ../fileio.c:5897 #, c-format msgid "E215: Illegal character after *: %s" -msgstr "E215: Virheellinen merkki *:n jlkeen: %s" +msgstr "E215: Virheellinen merkki *:n jälkeen: %s" -#: ../fileio.c:5905 #, c-format msgid "E216: No such event: %s" -msgstr "E216: Eventti ei ole: %s" +msgstr "E216: Eventtiä ei ole: %s" -#: ../fileio.c:5907 #, c-format msgid "E216: No such group or event: %s" -msgstr "E216: Ryhm tai eventti ei ole: %s" +msgstr "E216: Ryhmää tai eventtiä ei ole: %s" #. Highlight title -#: ../fileio.c:6090 msgid "" "\n" "--- Auto-Commands ---" @@ -2480,762 +2477,611 @@ msgstr "" "\n" "--- Autocommandit ---" -#: ../fileio.c:6293 #, c-format msgid "E680: : invalid buffer number " msgstr "E680: : virheellinen puskurinumero" -#: ../fileio.c:6370 msgid "E217: Can't execute autocommands for ALL events" msgstr "E217: Ei voi suorittaa autocommandsia kaikille eventeille" -#: ../fileio.c:6393 msgid "No matching autocommands" -msgstr "Ei tsmvi autocommandsia" +msgstr "Ei täsmääviä autocommandsia" -#: ../fileio.c:6831 msgid "E218: autocommand nesting too deep" msgstr "E218: liian monta tasoa autocommandissa" -#: ../fileio.c:7143 #, c-format msgid "%s Auto commands for \"%s\"" msgstr "%s Autocommands kohteelle %s" -#: ../fileio.c:7149 #, c-format msgid "Executing %s" msgstr "Suoritetaan %s" -#: ../fileio.c:7211 #, c-format msgid "autocommand %s" msgstr "autocommand %s" -#: ../fileio.c:7795 msgid "E219: Missing {." msgstr "E219: { puuttuu." -#: ../fileio.c:7797 msgid "E220: Missing }." msgstr "E220: } puuttuu." -#: ../fold.c:93 msgid "E490: No fold found" msgstr "E490: taitos puuttuu" -#: ../fold.c:544 msgid "E350: Cannot create fold with current 'foldmethod'" -msgstr "E350: Taitoksia ei voi tehd tll foldmethodilla" +msgstr "E350: Taitoksia ei voi tehdä tällä foldmethodilla" -#: ../fold.c:546 msgid "E351: Cannot delete fold with current 'foldmethod'" -msgstr "E351: Taitosta ei voi poistaa tll foldmethodilla" +msgstr "E351: Taitosta ei voi poistaa tällä foldmethodilla" -#: ../fold.c:1784 -#, c-format -msgid "+--%3ld lines folded " -msgstr "+--%3ld rivi taitettu pois " +#, fuzzy, c-format +#~ msgid "+--%3ld lines folded " +#~ msgstr "+--%3ld rivi taitettu pois " #. buffer has already been read -#: ../getchar.c:273 msgid "E222: Add to read buffer" -msgstr "E222: Lis lukupuskuriin" +msgstr "E222: Lisää lukupuskuriin" -#: ../getchar.c:2040 msgid "E223: recursive mapping" msgstr "E223: rekursiivinen kuvaus" -#: ../getchar.c:2849 #, c-format msgid "E224: global abbreviation already exists for %s" -msgstr "E224: globaali lyhenne merkinnlle %s on jo olemassa" +msgstr "E224: globaali lyhenne merkinnälle %s on jo olemassa" -#: ../getchar.c:2852 #, c-format msgid "E225: global mapping already exists for %s" -msgstr "E225: globaali kuvaus merkinnlle %s on jo olemassa" +msgstr "E225: globaali kuvaus merkinnälle %s on jo olemassa" -#: ../getchar.c:2952 #, c-format msgid "E226: abbreviation already exists for %s" msgstr "E226: lyhenne on jo olemassa %s" -#: ../getchar.c:2955 #, c-format msgid "E227: mapping already exists for %s" msgstr "E227: kuvaus on jo olemassa %s" -#: ../getchar.c:3008 msgid "No abbreviation found" -msgstr "Lyhennett ei lydy" +msgstr "Lyhennettä ei löydy" -#: ../getchar.c:3010 msgid "No mapping found" -msgstr "Kuvausta ei lydy" +msgstr "Kuvausta ei löydy" -#: ../getchar.c:3974 msgid "E228: makemap: Illegal mode" msgstr "E228: makemap: Virheellinen tila" #. key value of 'cedit' option #. type of cmdline window or 0 #. result of cmdline window or 0 -#: ../globals.h:924 msgid "--No lines in buffer--" -msgstr "--Ei rivej puskurissa--" +msgstr "--Ei rivejä puskurissa--" #. #. * The error messages that can be shared are included here. #. * Excluded are errors that are only used once and debugging messages. #. -#: ../globals.h:996 msgid "E470: Command aborted" msgstr "E470: Komento peruttu" -#: ../globals.h:997 +#, fuzzy +#~ msgid "E905: Cannot set this option after startup" +#~ msgstr "E529: Termiä ei voi asettaa tyhjäksi merkkijonoksi" + +#, fuzzy +#~ msgid "E903: Could not spawn API job" +#~ msgstr "E623: Cscope-prosessin luonti epäonnistui" + msgid "E471: Argument required" msgstr "E471: Argumentti puuttuu" -#: ../globals.h:998 msgid "E10: \\ should be followed by /, ? or &" -msgstr "E10: \\:n jlkeen pit tulla /, ? tai &" +msgstr "E10: \\:n jälkeen pitää tulla /, ? tai &" -#: ../globals.h:1000 msgid "E11: Invalid in command-line window; executes, CTRL-C quits" msgstr "E11: Virheellinen komentorivi-ikkuna, suorittaa, Ctrl C lopettaa" -#: ../globals.h:1002 msgid "E12: Command not allowed from exrc/vimrc in current dir or tag search" msgstr "" -"E12: Komentoa ei tueta exrc:ss tai vimrc:ss tss hakemistossa tai " -"tgihaussa" +"E12: Komentoa ei tueta exrc:ssä tai vimrc:ssä tässä hakemistossa tai " +"tägihaussa" -#: ../globals.h:1003 msgid "E171: Missing :endif" msgstr "E171: :endif puuttuu" -#: ../globals.h:1004 msgid "E600: Missing :endtry" msgstr "E600: :endtry puuttuu" -#: ../globals.h:1005 msgid "E170: Missing :endwhile" msgstr "E170: :endwhile puuttuu" -#: ../globals.h:1006 msgid "E170: Missing :endfor" msgstr "E170: :endfor puuttuu" -#: ../globals.h:1007 msgid "E588: :endwhile without :while" msgstr "E588: :endwhile ilman komentoa :while" -#: ../globals.h:1008 msgid "E588: :endfor without :for" msgstr "E588: :endfor ilman komentoa :for" -#: ../globals.h:1009 msgid "E13: File exists (add ! to override)" -msgstr "E13: Tiedosto on jo olemassa (lis ! ohittaaksesi)" +msgstr "E13: Tiedosto on jo olemassa (lisää ! ohittaaksesi)" -#: ../globals.h:1010 msgid "E472: Command failed" -msgstr "E472: Komento eponnistui" +msgstr "E472: Komento epäonnistui" -#: ../globals.h:1011 msgid "E473: Internal error" -msgstr "E473: Sisinen virhe" +msgstr "E473: Sisäinen virhe" -#: ../globals.h:1012 msgid "Interrupted" msgstr "Keskeytetty" -#: ../globals.h:1013 msgid "E14: Invalid address" msgstr "E14: Virheellinen osoite" -#: ../globals.h:1014 msgid "E474: Invalid argument" msgstr "E474: Virheellinen argumentti" -#: ../globals.h:1015 #, c-format msgid "E475: Invalid argument: %s" msgstr "E475: Virheellinen argumentti: %s" -#: ../globals.h:1016 #, c-format msgid "E15: Invalid expression: %s" msgstr "E15: Virheellinen ilmaus: %s" -#: ../globals.h:1017 msgid "E16: Invalid range" msgstr "E16: Virheellinen arvoalue" -#: ../globals.h:1018 msgid "E476: Invalid command" msgstr "E476: Virheellinen komento" -#: ../globals.h:1019 #, c-format msgid "E17: \"%s\" is a directory" msgstr "E17: %s on hakemisto" -#: ../globals.h:1020 #, fuzzy -msgid "E900: Invalid job id" -msgstr "E49: Virheellinen vierityskoko" +#~ msgid "E900: Invalid job id" +#~ msgstr "E916: ei ole job" -#: ../globals.h:1021 -msgid "E901: Job table is full" -msgstr "" +#~ msgid "E901: Job table is full" +#~ msgstr "" + +#, fuzzy, c-format +#~ msgid "E903: Process failed to start: %s: \"%s\"" +#~ msgstr "E852: Lapsiprosesi ei voinut käynnistää käyttöliittymää" + +#, fuzzy +#~ msgid "E904: Job is not connected to a pty" +#~ msgstr "E902: Ei voi yhdistää porttiin" -#: ../globals.h:1024 #, c-format msgid "E364: Library call failed for \"%s()\"" -msgstr "E364: Kirjastukutsu %s() eponnistui" +msgstr "E364: Kirjastukutsu %s() epäonnistui" + +#, fuzzy, c-format +#~ msgid "E739: Cannot create directory %s: %s" +#~ msgstr "E739: hakemistoa ei voi luoda: %s" -#: ../globals.h:1026 msgid "E19: Mark has invalid line number" -msgstr "E19: Merkill on virheellinen rivinumero" +msgstr "E19: Merkillä on virheellinen rivinumero" -#: ../globals.h:1027 msgid "E20: Mark not set" -msgstr "E20: Merkki ei asetettu" +msgstr "E20: Merkkiä ei asetettu" -#: ../globals.h:1029 msgid "E21: Cannot make changes, 'modifiable' is off" -msgstr "E21: Ei voi tehd muutoksia, modifiable on pois plt" +msgstr "E21: Ei voi tehdä muutoksia, modifiable on pois päältä" -#: ../globals.h:1030 msgid "E22: Scripts nested too deep" -msgstr "E22: Liian monta tasoa skripteiss" +msgstr "E22: Liian monta tasoa skripteissä" -#: ../globals.h:1031 msgid "E23: No alternate file" msgstr "E23: Eo vaihtoehtoista tiedostoa" -#: ../globals.h:1032 msgid "E24: No such abbreviation" -msgstr "E24: Lyhennett ei ole" +msgstr "E24: Lyhennettä ei ole" -#: ../globals.h:1033 msgid "E477: No ! allowed" msgstr "E477: ! ei sallittu" -#: ../globals.h:1035 -msgid "E25: Nvim does not have a built-in GUI" -msgstr "E25: GUIta ei voi kytt, koska sit ei knnetty mukaan" +#~ msgid "E25: Nvim does not have a built-in GUI" +#~ msgstr "" -#: ../globals.h:1036 #, c-format msgid "E28: No such highlight group name: %s" -msgstr "E28: Korostusryhm ei ole nimell: %s" +msgstr "E28: Korostusryhmää ei ole nimellä: %s" -#: ../globals.h:1037 msgid "E29: No inserted text yet" -msgstr "E29: Teksti ei ole sytetty viel" +msgstr "E29: Tekstiä ei ole syötetty vielä" -#: ../globals.h:1038 msgid "E30: No previous command line" -msgstr "E30: Ei edellist komentorivi" +msgstr "E30: Ei edellistä komentoriviä" -#: ../globals.h:1039 msgid "E31: No such mapping" msgstr "E31: Kuvausta ei ole" -#: ../globals.h:1040 msgid "E479: No match" -msgstr "E479: Ei tsm" +msgstr "E479: Ei täsmää" -#: ../globals.h:1041 #, c-format msgid "E480: No match: %s" -msgstr "E480: Ei tsm: %s" +msgstr "E480: Ei tsämää: %s" -#: ../globals.h:1042 msgid "E32: No file name" -msgstr "E32: Ei tiedostonime" +msgstr "E32: Ei tiedostonimeä" -#: ../globals.h:1044 msgid "E33: No previous substitute regular expression" -msgstr "E33: Ei edellist korvausta snnlliselle ilmaukselle" +msgstr "E33: Ei edellistä korvausta säännölliselle ilmaukselle" -#: ../globals.h:1045 msgid "E34: No previous command" -msgstr "E34: Ei edellist komentoa" +msgstr "E34: Ei edellistä komentoa" -#: ../globals.h:1046 msgid "E35: No previous regular expression" -msgstr "E35: Ei edellist snnllist ilmausta" +msgstr "E35: Ei edellistä säännöllistä ilmausta" -#: ../globals.h:1047 msgid "E481: No range allowed" msgstr "E481: Arvoalue ei sallittu" -#: ../globals.h:1048 msgid "E36: Not enough room" -msgstr "E36: Tila ei riit" - -#: ../globals.h:1049 -#, c-format -msgid "E482: Can't create file %s" -msgstr "E482: Tiedostoa %s ei voi luoda" +msgstr "E36: Tila ei riitä" -#: ../globals.h:1050 msgid "E483: Can't get temp file name" -msgstr "E483: vliaikaistiedoston nime ei saada selville" +msgstr "E483: väliaikaistiedoston nimeä ei saada selville" -#: ../globals.h:1051 #, c-format msgid "E484: Can't open file %s" msgstr "E484: Ei voi avata tiedostoa %s" -#: ../globals.h:1052 #, c-format msgid "E485: Can't read file %s" msgstr "E485: Ei voi lukea tiedostoa %s" -#: ../globals.h:1054 msgid "E37: No write since last change (add ! to override)" msgstr "" -"E37: Viimeisen muutoksen jlkeen ei ole kirjoitettu (lis ! ohittaaksesi)" +"E37: Viimeisen muutoksen jälkeen ei ole kirjoitettu (lisää ! ohittaaksesi)" -#: ../globals.h:1055 -#, fuzzy msgid "E37: No write since last change" -msgstr "[Viimeisint muutosta ei ole kirjoitettu]\n" +msgstr "E37: Viimeisimmän muutoksen jälkeen ei ole kirjoitettu mitään" -#: ../globals.h:1056 msgid "E38: Null argument" msgstr "E38: Null-argumentti" -#: ../globals.h:1057 msgid "E39: Number expected" -msgstr "E39: Pit olla numero" +msgstr "E39: Pitää olla numero" -#: ../globals.h:1058 #, c-format msgid "E40: Can't open errorfile %s" msgstr "E40: virhetiedostoa %s ei voi avata" -#: ../globals.h:1059 msgid "E41: Out of memory!" msgstr "E41: Muisti loppui" -#: ../globals.h:1060 msgid "Pattern not found" -msgstr "Kuviota ei lydy" +msgstr "Kuviota ei löydy" -#: ../globals.h:1061 #, c-format msgid "E486: Pattern not found: %s" -msgstr "E486: Kuviota ei lydy: %s" +msgstr "E486: Kuviota ei löydy: %s" -#: ../globals.h:1062 msgid "E487: Argument must be positive" -msgstr "E487: Argumentin pit olla positiivinen" +msgstr "E487: Argumentin pitää olla positiivinen" -#: ../globals.h:1064 msgid "E459: Cannot go back to previous directory" -msgstr "E459: Ei voi siirty edelliseen hakemistoon" +msgstr "E459: Ei voi siirtyä edelliseen hakemistoon" # ;-) -#: ../globals.h:1066 msgid "E42: No Errors" -msgstr "E42: Ei virheit" +msgstr "E42: Ei virheitä" -#: ../globals.h:1067 msgid "E776: No location list" msgstr "E776: Ei sijaintilistaa" -#: ../globals.h:1068 msgid "E43: Damaged match string" -msgstr "E43: Viallinen tsmysmerkkijono" +msgstr "E43: Viallinen täsmäysmerkkijono" -#: ../globals.h:1069 msgid "E44: Corrupted regexp program" msgstr "E44: Viallinen regexp-ohjelma" -#: ../globals.h:1071 msgid "E45: 'readonly' option is set (add ! to override)" -msgstr "E45: readonly asetettu (lis ! ohittaaksesi)" - -#: ../globals.h:1073 -#, c-format -msgid "E46: Cannot change read-only variable \"%s\"" -msgstr "E46: Kirjoitussuojattua muuttujaa %s ei voi muuttaa" - -#: ../globals.h:1075 -#, c-format -msgid "E794: Cannot set variable in the sandbox: \"%s\"" -msgstr "E794: Muuttujaa ei voi asettaa hiekkalaatikossa: %s" +msgstr "E45: readonly asetettu (lisää ! ohittaaksesi)" -#: ../globals.h:1076 msgid "E47: Error while reading errorfile" msgstr "E47: Virhe virhetiedostoa luettaessa" -#: ../globals.h:1078 msgid "E48: Not allowed in sandbox" msgstr "E48: Ei sallittu hiekkalaatikossa" -#: ../globals.h:1080 msgid "E523: Not allowed here" -msgstr "E523: Ei sallittu tll" +msgstr "E523: Ei sallittu täällä" -#: ../globals.h:1082 msgid "E359: Screen mode setting not supported" -msgstr "E359: Nytttila-asetus ei tuettu" +msgstr "E359: Näyttötila-asetus ei tuettu" -#: ../globals.h:1083 msgid "E49: Invalid scroll size" msgstr "E49: Virheellinen vierityskoko" -#: ../globals.h:1084 msgid "E91: 'shell' option is empty" -msgstr "E91: shell-asetus on tyhj" +msgstr "E91: shell-asetus on tyhjä" -#: ../globals.h:1085 msgid "E255: Couldn't read in sign data!" msgstr "E255: Merkkidatan luku ei onnistu" -#: ../globals.h:1086 msgid "E72: Close error on swap file" msgstr "E72: Swap-tiedoston sulkemisvirhe" -#: ../globals.h:1087 msgid "E73: tag stack empty" -msgstr "E73: tgipino tyhj" +msgstr "E73: tägipino tyhjä" -#: ../globals.h:1088 msgid "E74: Command too complex" msgstr "E74: Liian monimutkainen komento" -#: ../globals.h:1089 msgid "E75: Name too long" -msgstr "E75: Liian pitk nimi" +msgstr "E75: Liian pitkä nimi" -#: ../globals.h:1090 msgid "E76: Too many [" msgstr "E76: Liian monta [:a" -#: ../globals.h:1091 msgid "E77: Too many file names" -msgstr "E77: Liikaa tiedostonimi" +msgstr "E77: Liikaa tiedostonimiä" -#: ../globals.h:1092 msgid "E488: Trailing characters" -msgstr "E488: Ylimrisi merkkej perss" +msgstr "E488: Ylimääräisiä merkkejä perässä" -#: ../globals.h:1093 msgid "E78: Unknown mark" msgstr "E78: Tuntematon merkki" -#: ../globals.h:1094 msgid "E79: Cannot expand wildcards" msgstr "E79: Jokerimerkkien avaus ei onnistu" -#: ../globals.h:1096 msgid "E591: 'winheight' cannot be smaller than 'winminheight'" msgstr "E591: winheight ei voi olla pienempi kuin winminheight" -#: ../globals.h:1098 msgid "E592: 'winwidth' cannot be smaller than 'winminwidth'" msgstr "E592: winwidth ei voi olla pienempi kuin winminwidth" -#: ../globals.h:1099 msgid "E80: Error while writing" msgstr "E80: Kirjoitusvirhe" -#: ../globals.h:1100 msgid "Zero count" msgstr "Nollalaskuri" -#: ../globals.h:1101 msgid "E81: Using not in a script context" msgstr "E81: skriptin ulkopuolella" -#: ../globals.h:1102 #, c-format msgid "E685: Internal error: %s" -msgstr "E685: Sisinen virhe: %s" +msgstr "E685: Sisäinen virhe: %s" -#: ../globals.h:1104 msgid "E363: pattern uses more memory than 'maxmempattern'" -msgstr "E363: kuvio kytt enemmn muistia kuin maxmempattern on" +msgstr "E363: kuvio käyttää enemmän muistia kuin maxmempattern on" -#: ../globals.h:1105 msgid "E749: empty buffer" -msgstr "E749: tyhj puskuri" +msgstr "E749: tyhjä puskuri" + +#, fuzzy, c-format +#~ msgid "E86: Buffer % does not exist" +#~ msgstr "E86: Puskuria %ld ei ole" -#: ../globals.h:1108 msgid "E682: Invalid search pattern or delimiter" msgstr "E682: Virheellinen hakulauseke tai erotin" -#: ../globals.h:1109 msgid "E139: File is loaded in another buffer" msgstr "E139: Tiedosto on ladattu toiseen puskuriin" -#: ../globals.h:1110 #, c-format msgid "E764: Option '%s' is not set" msgstr "E764: Asetus %s on asettamatta" -#: ../globals.h:1111 -#, fuzzy msgid "E850: Invalid register name" -msgstr "E354: Virheellinen rekisterin nimi: %s" +msgstr "E850: Virheellinen rekisterin nimi" + +#, c-format +msgid "E919: Directory not found in '%s': \"%s\"" +msgstr "E919: Hakemisto puuttuu kohteesta %s: %s" + +msgid "E519: Option not supported" +msgstr "E519: Asetusta ei tueta" + +#, fuzzy +#~ msgid "E856: Filename too long" +#~ msgstr "E75: Liian pitkä nimi" + +msgid "E806: using Float as a String" +msgstr "E806: Float ei käy merkkijonosta" -#: ../globals.h:1114 msgid "search hit TOP, continuing at BOTTOM" -msgstr "haku psi ALKUUN, jatketaan LOPUSTA" +msgstr "haku pääsi ALKUUN, jatketaan LOPUSTA" -#: ../globals.h:1115 msgid "search hit BOTTOM, continuing at TOP" -msgstr "haku psi LOPPUUN, jatketaan ALUSTA" +msgstr "haku pääsi LOPPUUN, jatketaan ALUSTA" -#: ../hardcopy.c:240 msgid "E550: Missing colon" msgstr "E550: kaksoispiste puuttuu" -#: ../hardcopy.c:252 msgid "E551: Illegal component" msgstr "E551: Virheellinen komponentti" -#: ../hardcopy.c:259 msgid "E552: digit expected" -msgstr "E552: pitisi olla numero" +msgstr "E552: pitäisi olla numero" -#: ../hardcopy.c:473 #, c-format msgid "Page %d" msgstr "Sivu %d" -#: ../hardcopy.c:597 msgid "No text to be printed" -msgstr "Ei teksti tulostettavaksi" +msgstr "Ei tekstiä tulostettavaksi" -#: ../hardcopy.c:668 -#, c-format -msgid "Printing page %d (%d%%)" -msgstr "Tulostetaan sivua %d (%d %%)" +#, fuzzy, c-format +#~ msgid "Printing page %d (%zu%%)" +#~ msgstr "Tulostetaan sivua %d (%d %%)" -#: ../hardcopy.c:680 #, c-format msgid " Copy %d of %d" msgstr " Kopio %d/%d" -#: ../hardcopy.c:733 #, c-format msgid "Printed: %s" msgstr "Tulostettu: %s" -#: ../hardcopy.c:740 msgid "Printing aborted" msgstr "Tulostus peruttu" -#: ../hardcopy.c:1365 msgid "E455: Error writing to PostScript output file" -msgstr "E455: Virhe kirjoitettaessa PostScripti tiedostoon" +msgstr "E455: Virhe kirjoitettaessa PostScriptiä tiedostoon" -#: ../hardcopy.c:1747 #, c-format msgid "E624: Can't open file \"%s\"" msgstr "E624: Ei voi avata tiedostoa %s" -#: ../hardcopy.c:1756 ../hardcopy.c:2470 #, c-format msgid "E457: Can't read PostScript resource file \"%s\"" msgstr "E457: Ei voi lukea PostScript-resurssitiedostoa %s" -#: ../hardcopy.c:1772 #, c-format msgid "E618: file \"%s\" is not a PostScript resource file" msgstr "E618: tiedosto %s ei ole PostScript-resurssitiedosto" -#: ../hardcopy.c:1788 ../hardcopy.c:1805 ../hardcopy.c:1844 #, c-format msgid "E619: file \"%s\" is not a supported PostScript resource file" msgstr "E619: tiedosto %s ei ole tuettu PostScript-resurssitiedosto" -#: ../hardcopy.c:1856 #, c-format msgid "E621: \"%s\" resource file has wrong version" -msgstr "E621: resurssitiedoston %s versio on vr" +msgstr "E621: resurssitiedoston %s versio on väärä" -#: ../hardcopy.c:2225 msgid "E673: Incompatible multi-byte encoding and character set." -msgstr "E673: Tukematon monitvauinen merkistkoodaus ja merkist." +msgstr "E673: Tukematon monitvauinen merkistökoodaus ja merkistö." -#: ../hardcopy.c:2238 msgid "E674: printmbcharset cannot be empty with multi-byte encoding." -msgstr "E674: printmbcharset ei voi olla tyhj monitavuiselle koodaukselle." +msgstr "E674: printmbcharset ei voi olla tyhjä monitavuiselle koodaukselle." -#: ../hardcopy.c:2254 msgid "E675: No default font specified for multi-byte printing." msgstr "E675: Ei oletusfonttia monitavuiseen tulostukseen" -#: ../hardcopy.c:2426 msgid "E324: Can't open PostScript output file" msgstr "E324: PostScript-tulostetiedoston avaus ei onnistu" -#: ../hardcopy.c:2458 #, c-format msgid "E456: Can't open file \"%s\"" msgstr "E456: Tiedoston %s avaus ei onnistu" -#: ../hardcopy.c:2583 msgid "E456: Can't find PostScript resource file \"prolog.ps\"" -msgstr "E456: PostScript-resurssitiedostoa prolog.ps ei lydy" +msgstr "E456: PostScript-resurssitiedostoa prolog.ps ei löydy" -#: ../hardcopy.c:2593 msgid "E456: Can't find PostScript resource file \"cidfont.ps\"" -msgstr "E456: PostScript-resurssitiedostoa cidfont.ps ei lydy" +msgstr "E456: PostScript-resurssitiedostoa cidfont.ps ei löydy" -#: ../hardcopy.c:2622 ../hardcopy.c:2639 ../hardcopy.c:2665 #, c-format msgid "E456: Can't find PostScript resource file \"%s.ps\"" -msgstr "E456: Postscript-resurssitiedosta %s.ps ei lydy" +msgstr "E456: Postscript-resurssitiedosta %s.ps ei löydy" -#: ../hardcopy.c:2654 #, c-format msgid "E620: Unable to convert to print encoding \"%s\"" msgstr "E620: Tulostuskoodaukseen %s muunto ei onnistu" -#: ../hardcopy.c:2877 msgid "Sending to printer..." -msgstr "Lhetetn tulostimelle..." +msgstr "Lähetetään tulostimelle..." -#: ../hardcopy.c:2881 msgid "E365: Failed to print PostScript file" -msgstr "E365: PostScript-tiedoston tulostus eponnistui" +msgstr "E365: PostScript-tiedoston tulostus epäonnistui" -#: ../hardcopy.c:2883 msgid "Print job sent." -msgstr "Tulostusty lhetetty." +msgstr "Tulostustyö lähetetty." -#: ../if_cscope.c:85 msgid "Add a new database" -msgstr "Lis uusi tietokanta" +msgstr "Lisää uusi tietokanta" -#: ../if_cscope.c:87 msgid "Query for a pattern" msgstr "Hae kuviota" -#: ../if_cscope.c:89 msgid "Show this message" -msgstr "Nyt tm viesti" +msgstr "Näytä tämä viesti" -#: ../if_cscope.c:91 msgid "Kill a connection" msgstr "Tapa yhteys" -#: ../if_cscope.c:93 msgid "Reinit all connections" msgstr "Alusta uudelleen yhteydet" -#: ../if_cscope.c:95 msgid "Show connections" -msgstr "Nyt yhteydet" +msgstr "Näytä yhteydet" -#: ../if_cscope.c:101 #, c-format msgid "E560: Usage: cs[cope] %s" -msgstr "E560: Kytt: cs[cope] %s" +msgstr "E560: Käyttö: cs[cope] %s" -#: ../if_cscope.c:225 msgid "This cscope command does not support splitting the window.\n" -msgstr "Tm cscope-komento ei tue ikkunan jakamista.\n" +msgstr "Tämä cscope-komento ei tue ikkunan jakamista.\n" -#: ../if_cscope.c:266 msgid "E562: Usage: cstag " -msgstr "E562: Kytt: cstag " +msgstr "E562: Käyttö: cstag " -#: ../if_cscope.c:313 msgid "E257: cstag: tag not found" -msgstr "E257: cstag: tgia ei lydy" +msgstr "E257: cstag: tägia ei löydy" -#: ../if_cscope.c:461 #, c-format msgid "E563: stat(%s) error: %d" msgstr "E563: stat(%s)-virhe: %d" -#: ../if_cscope.c:551 #, c-format msgid "E564: %s is not a directory or a valid cscope database" -msgstr "E564: %s ei ole hakemisto eik cscope-tietokanta" +msgstr "E564: %s ei ole hakemisto eikä cscope-tietokanta" -#: ../if_cscope.c:566 #, c-format msgid "Added cscope database %s" -msgstr "Listty cscope-tietokanta %s" +msgstr "Lisätty cscope-tietokanta %s" -#: ../if_cscope.c:616 -#, c-format -msgid "E262: error reading cscope connection %" -msgstr "E262: Virhe luettaessa cscope-yhteytt %" +#, fuzzy, c-format +#~ msgid "E262: error reading cscope connection %" +#~ msgstr "E262: Virhe luettaessa cscope-yhteyttä %ld" -#: ../if_cscope.c:711 msgid "E561: unknown cscope search type" msgstr "E561: tuntematon cscope-hakutyyppi" -#: ../if_cscope.c:752 ../if_cscope.c:789 msgid "E566: Could not create cscope pipes" msgstr "E566: Ei voitu luoda cscope-putkia" -#: ../if_cscope.c:767 msgid "E622: Could not fork for cscope" msgstr "E622: Ei voitu haarauttaa cscopea" -#: ../if_cscope.c:849 -#, fuzzy msgid "cs_create_connection setpgid failed" -msgstr "cs_create_connection eponnistui" +msgstr "cs_create_connection setpgid epäonnistui" -#: ../if_cscope.c:853 ../if_cscope.c:889 msgid "cs_create_connection exec failed" -msgstr "cs_create_connection eponnistui" +msgstr "cs_create_connection epäonnistui" -#: ../if_cscope.c:863 ../if_cscope.c:902 msgid "cs_create_connection: fdopen for to_fp failed" -msgstr "cs_create_connection: fdopen to_fp eponnistui" +msgstr "cs_create_connection: fdopen to_fp epäonnistui" -#: ../if_cscope.c:865 ../if_cscope.c:906 msgid "cs_create_connection: fdopen for fr_fp failed" -msgstr "cs_create_connection: fdopen fr_fp eponnistui" +msgstr "cs_create_connection: fdopen fr_fp epäonnistui" -#: ../if_cscope.c:890 msgid "E623: Could not spawn cscope process" -msgstr "E623: Cscope-prosessin luonti eponnistui" +msgstr "E623: Cscope-prosessin luonti epäonnistui" -#: ../if_cscope.c:932 msgid "E567: no cscope connections" -msgstr "E567: ei cscope-yhteyksi" +msgstr "E567: ei cscope-yhteyksiä" -#: ../if_cscope.c:1009 #, c-format msgid "E469: invalid cscopequickfix flag %c for %c" msgstr "E469: virheellinen cscopequickfix-asetus %c kohteelle %c" -#: ../if_cscope.c:1058 #, c-format msgid "E259: no matches found for cscope query %s of %s" -msgstr "E259: ei tsmyksi cscope-hakuun %s/%s" +msgstr "E259: ei täsmäyksiä cscope-hakuun %s/%s" -#: ../if_cscope.c:1142 msgid "cscope commands:\n" msgstr "cscope-komennot:\n" -#: ../if_cscope.c:1150 #, c-format msgid "%-5s: %s%*s (Usage: %s)" -msgstr "%-5s: %s%*s (Kytt: %s)" +msgstr "%-5s: %s%*s (Käyttö: %s)" -#: ../if_cscope.c:1155 -#, fuzzy msgid "" "\n" +" a: Find assignments to this symbol\n" " c: Find functions calling this function\n" " d: Find functions called by this function\n" " e: Find this egrep pattern\n" @@ -3246,40 +3092,36 @@ msgid "" " t: Find this text string\n" msgstr "" "\n" -" c: Etsi tt funktiota kutsuvat funktiot\n" -" d: Etsi tmn funktion kutsumat funktiot\n" -" e: Etsi tm egrep-lauseke\n" -" f: Find tm tiedosto\n" -" g: Etsi tm mritys\n" -" i: Etsi tiedostoja jotka #inkluudaavat tmn\n" -" s: Etsi tm C-symboli\n" +" a: Etsi sijotukset tähän symboliin\n" +" c: Etsi tätä funktiota kutsuvat funktiot\n" +" d: Etsi tämän funktion kutsumat funktiot\n" +" e: Etsi tämä egrep-lauseke\n" +" f: Etsi tämä tiedosto\n" +" g: Etsi tämä määritys\n" +" i: Etsi tiedostoja jotka #inkluudaavat tämän\n" +" s: Etsi tämä C-symboli\n" " t: Etsi sijoitukset muuttujaan \n" -#: ../if_cscope.c:1226 msgid "E568: duplicate cscope database not added" -msgstr "E568: kaksoiskappaletta cscope-tietokannasta ei listty" +msgstr "E568: kaksoiskappaletta cscope-tietokannasta ei lisätty" -#: ../if_cscope.c:1335 #, c-format msgid "E261: cscope connection %s not found" msgstr "E261: cscope-yhteys %s puuttuu" -#: ../if_cscope.c:1364 #, c-format msgid "cscope connection %s closed" msgstr "cscope-yhteys %s on katkaistu" #. should not reach here -#: ../if_cscope.c:1486 msgid "E570: fatal error in cs_manage_matches" msgstr "E570: kriittinen virhe cs_manage_matches-funktiossa" -#: ../if_cscope.c:1693 #, c-format msgid "Cscope tag: %s" -msgstr "Cscope-tgi: %s" +msgstr "Cscope-tägi: %s" -#: ../if_cscope.c:1711 +#. Column headers for match number, line number and filename. msgid "" "\n" " # line" @@ -3287,326 +3129,272 @@ msgstr "" "\n" " # rivi" -#: ../if_cscope.c:1713 msgid "filename / context / line\n" msgstr "tiedosto / konteksti / rivi\n" -#: ../if_cscope.c:1809 #, c-format msgid "E609: Cscope error: %s" msgstr "E609: Cscope-virhe: %s" -#: ../if_cscope.c:2053 msgid "All cscope databases reset" msgstr "Kaikki cscope-tietokannat nollattu" -#: ../if_cscope.c:2123 msgid "no cscope connections\n" -msgstr "ei cscope-yhteyksi\n" +msgstr "ei cscope-yhteyksiä\n" -#: ../if_cscope.c:2126 msgid " # pid database name prepend path\n" -msgstr " # pid tietokanta lisyspolku\n" +msgstr " # pid tietokanta lisäyspolku\n" + +#. Error messages +msgid "Argument missing after" +msgstr "Argumentti puuttuu kohdasta" + +msgid "Garbage after option argument" +msgstr "Roskaa argumentin perässä" -#: ../main.c:144 msgid "Unknown option argument" msgstr "Tuntematon asetusargumentti" -#: ../main.c:146 msgid "Too many edit arguments" msgstr "Liikaa muokkausargumentteja" -#: ../main.c:148 -msgid "Argument missing after" -msgstr "Argumentti puuttuu kohdasta" - -#: ../main.c:150 -msgid "Garbage after option argument" -msgstr "Roskaa argumentin perss" - -#: ../main.c:152 msgid "Too many \"+command\", \"-c command\" or \"--cmd command\" arguments" msgstr "Liikaa +komentoja, -c-komentoja tai --cmd-komentoja" -#: ../main.c:154 -msgid "Invalid argument for" -msgstr "Vr argumentti valitsimelle" - -#: ../main.c:294 -#, c-format -msgid "%d files to edit\n" -msgstr "%d tiedostoa muokattavana\n" - -#: ../main.c:1342 msgid "Attempt to open script file again: \"" msgstr "Yritettiin avata skriptitiedostoa uudestaan:" -#: ../main.c:1350 msgid "Cannot open for reading: \"" msgstr "Ei voi avata luettavaksi: " -#: ../main.c:1393 msgid "Cannot open for script output: \"" msgstr "Ei voi avata skriptin tulostetta varten: " -#: ../main.c:1622 msgid "Vim: Warning: Output is not to a terminal\n" msgstr "Vim: Varoitus: Tuloste ei mene terminaalille\n" -#: ../main.c:1624 msgid "Vim: Warning: Input is not from a terminal\n" -msgstr "Vim: Varoitus: Syte ei tule terminaalilta\n" +msgstr "Vim: Varoitus: Syöte ei tule terminaalilta\n" #. just in case.. -#: ../main.c:1891 msgid "pre-vimrc command line" msgstr "esi-vimrc-komentorivi" -#: ../main.c:1964 #, c-format msgid "E282: Cannot read from \"%s\"" msgstr "E282: Ei voida lukea kohteesta %s" -#: ../main.c:2149 +#, fuzzy msgid "" "\n" -"More info with: \"vim -h\"\n" +"More info with \"" msgstr "" "\n" -"Listietoja: \"vim -h\"\n" - -#: ../main.c:2178 -msgid "[file ..] edit specified file(s)" -msgstr "[tiedosto ..] muokkaa tiedostoja" - -#: ../main.c:2179 -msgid "- read text from stdin" -msgstr "- lue vakiosytteest" +"Lisätietoja: \"vim -h\"\n" -#: ../main.c:2180 -msgid "-t tag edit file where tag is defined" -msgstr "-t tgi muokkaa tiedostoa tgist" +#. kill us with CTRL-C here, if you like +#, fuzzy +#~ msgid "Usage:\n" +#~ msgstr "" +#~ "\n" +#~ "\n" +#~ "käyttö:" -#: ../main.c:2181 -msgid "-q [errorfile] edit file with first error" -msgstr "-q [virhetiedosto] muokkaa tiedostoa ensimmisest virheest" +#, fuzzy +#~ msgid " nvim [arguments] [file ...] Edit specified file(s)\n" +#~ msgstr "[tiedosto ..] muokkaa tiedostoja" -#: ../main.c:2187 -msgid "" -"\n" -"\n" -"usage:" -msgstr "" -"\n" -"\n" -"kytt:" +#, fuzzy +#~ msgid " nvim [arguments] - Read text from stdin\n" +#~ msgstr "- lue vakiosyötteestä" -#: ../main.c:2189 -msgid " vim [arguments] " -msgstr " vim [argumentit] " +#, fuzzy +#~ msgid " nvim [arguments] -t Edit file where tag is defined\n" +#~ msgstr "-t tägi muokkaa tiedostoa tägistä" -#: ../main.c:2193 -msgid "" -"\n" -" or:" -msgstr "" -"\n" -" tai:" +#, fuzzy +#~ msgid " nvim [arguments] -q [errorfile] Edit file with first error\n" +#~ msgstr "-q [virhetiedosto] muokkaa tiedostoa ensimmäisestä virheestä" -#: ../main.c:2196 +#, fuzzy msgid "" "\n" -"\n" "Arguments:\n" msgstr "" "\n" "\n" "Argumentit:\n" -#: ../main.c:2197 -msgid "--\t\t\tOnly file names after this" -msgstr "--\t\t\tvain tiedostonimi tmn jlkeen" - -#: ../main.c:2199 -msgid "--literal\t\tDon't expand wildcards" -msgstr "--literal\t\tl ksittele jokerimerkkej " - -#: ../main.c:2201 -msgid "-v\t\t\tVi mode (like \"vi\")" -msgstr "-v\t\t\tVi-tila (kuten vill)" +#, fuzzy +#~ msgid " -- Only file names after this\n" +#~ msgstr "--\t\t\tvain tiedostonimiä tämän jälkeen" -#: ../main.c:2202 -msgid "-e\t\t\tEx mode (like \"ex\")" -msgstr "-e\t\t\tEx-tila (kute exill)" +#, fuzzy +#~ msgid " --literal Don't expand wildcards\n" +#~ msgstr "--literal\t\tÄlä käsittele jokerimerkkejä " -#: ../main.c:2203 -msgid "-E\t\t\tImproved Ex mode" -msgstr "" +#, fuzzy +#~ msgid " -e Ex mode\n" +#~ msgstr " kahta tilaa varten " -#: ../main.c:2204 -msgid "-s\t\t\tSilent (batch) mode (only for \"ex\")" -msgstr "-s\t\t\tHiljainen (erajo)tila (vain exill)" +#, fuzzy +#~ msgid " -E Improved Ex mode\n" +#~ msgstr " kahta tilaa varten " -#: ../main.c:2205 -msgid "-d\t\t\tDiff mode (like \"vimdiff\")" -msgstr "-d\t\t\tDiff-tila (kuten vimdiffill)" +#, fuzzy +#~ msgid " -s Silent (batch) mode (only for ex mode)\n" +#~ msgstr "-s\t\t\tHiljainen (eräajo)tila (vain exillä)" -#: ../main.c:2206 -msgid "-y\t\t\tEasy mode (like \"evim\", modeless)" -msgstr "-y\t\t\tHelppokytttila (kuten evimiss, ilman tiloja)" +#, fuzzy +#~ msgid " -d Diff mode\n" +#~ msgstr " kahta tilaa varten " -#: ../main.c:2207 -msgid "-R\t\t\tReadonly mode (like \"view\")" -msgstr "-R\t\t\tKirjoitussuojattu tila (kuten view'lla)" +#, fuzzy +#~ msgid " -R Read-only mode\n" +#~ msgstr " kahta tilaa varten " -#: ../main.c:2208 -msgid "-Z\t\t\tRestricted mode (like \"rvim\")" -msgstr "-Z\t\t\tRajoitettu tila (kuten rvimill)" +#, fuzzy +#~ msgid " -Z Restricted mode\n" +#~ msgstr " kahta tilaa varten " -#: ../main.c:2209 -msgid "-m\t\t\tModifications (writing files) not allowed" -msgstr "-m\t\t\tMuokkaukset (kirjoittaminen tiedostoon) pois kytst" +#, fuzzy +#~ msgid " -m Modifications (writing files) not allowed\n" +#~ msgstr "-m\t\t\tMuokkaukset (kirjoittaminen tiedostoon) pois käytöstä" -#: ../main.c:2210 -msgid "-M\t\t\tModifications in text not allowed" -msgstr "-M\t\t\tTekstin muokkaus pois kytst" +#, fuzzy +#~ msgid " -M Modifications in text not allowed\n" +#~ msgstr "-M\t\t\tTekstin muokkaus pois käytöstä" -#: ../main.c:2211 -msgid "-b\t\t\tBinary mode" -msgstr "-b\t\t\tBinritila" +#, fuzzy +#~ msgid " -b Binary mode\n" +#~ msgstr " kahta tilaa varten " -#: ../main.c:2212 -msgid "-l\t\t\tLisp mode" -msgstr "-l\t\t\tLisp-tila" +#, fuzzy +#~ msgid " -l Lisp mode\n" +#~ msgstr " kahta tilaa varten " -#: ../main.c:2213 -msgid "-C\t\t\tCompatible with Vi: 'compatible'" -msgstr "-C\t\t\tVi-yhteensopivuustila: compatible" +#, fuzzy +#~ msgid " -A Arabic mode\n" +#~ msgstr " kahta tilaa varten " -#: ../main.c:2214 -msgid "-N\t\t\tNot fully Vi compatible: 'nocompatible'" -msgstr "-N\t\t\tEi Vi-yhteensopivuutta: nocompatible" +#, fuzzy +#~ msgid " -F Farsi mode\n" +#~ msgstr " kahta tilaa varten " -#: ../main.c:2215 -msgid "-V[N][fname]\t\tBe verbose [level N] [log messages to fname]" -msgstr "" -"-V[N][tnimi]\t\tMonisanainen tuloste [Taso N] [kirjoita tuloste tnimeen] " +#, fuzzy +#~ msgid " -H Hebrew mode\n" +#~ msgstr " kahta tilaa varten " -#: ../main.c:2216 -msgid "-D\t\t\tDebugging mode" -msgstr "-D\t\t\tVianetsinttila" +#, fuzzy +#~ msgid " -V[N][file] Be verbose [level N][log messages to file]\n" +#~ msgstr "" +#~ "-V[N][tnimi]\t\tMonisanainen tuloste [Taso N] [kirjoita tuloste tnimeen] " -#: ../main.c:2217 -msgid "-n\t\t\tNo swap file, use memory only" -msgstr "-n\t\t\tEi swap-tiedostoja, kyt muistia" +#, fuzzy +#~ msgid " -D Debugging mode\n" +#~ msgstr " kahta tilaa varten " -#: ../main.c:2218 -msgid "-r\t\t\tList swap files and exit" -msgstr "-r\t\t\tLuetteloi swap-tiedostot ja poistu" +#, fuzzy +#~ msgid " -n No swap file, use memory only\n" +#~ msgstr "-n\t\t\tEi swap-tiedostoja, käytä muistia" -#: ../main.c:2219 -msgid "-r (with file name)\tRecover crashed session" -msgstr "-r (tiedostonimi)\tPalauta kaatunut sessio" +#, fuzzy +#~ msgid " -r, -L List swap files and exit\n" +#~ msgstr "-r\t\t\tLuetteloi swap-tiedostot ja poistu" -#: ../main.c:2220 -msgid "-L\t\t\tSame as -r" -msgstr "-L\t\t\tkuten -r" +#, fuzzy +#~ msgid " -r Recover crashed session\n" +#~ msgstr "-r (tiedostonimi)\tPalauta kaatunut sessio" -#: ../main.c:2221 -msgid "-A\t\t\tstart in Arabic mode" -msgstr "-A\t\t\tkynnist arabia-tilassa" +#, fuzzy +#~ msgid " -u Use instead of the default\n" +#~ msgstr "-u \t\tKäytä -tiedostoa .vimrc:iden sijasta" -#: ../main.c:2222 -msgid "-H\t\t\tStart in Hebrew mode" -msgstr "-H\t\t\tkynnist heprea-tilassa" +#~ msgid " -i Use instead of the default\n" +#~ msgstr "" -#: ../main.c:2223 -msgid "-F\t\t\tStart in Farsi mode" -msgstr "-F\t\t\tkynnist farsi-tilassa" +#, fuzzy +#~ msgid " --noplugin Don't load plugin scripts\n" +#~ msgstr "--noplugin\t\tÄlä lataa liitännäisiä" -#: ../main.c:2224 -msgid "-T \tSet terminal type to " -msgstr "-T \tAseta terminaalin tyypiksi " +#, fuzzy +#~ msgid " -o[N] Open N windows (default: one for each file)\n" +#~ msgstr "-o[N]\t\tAvaa N ikkunaa (oletus: yksi per tiedosto)" -#: ../main.c:2225 -msgid "-u \t\tUse instead of any .vimrc" -msgstr "-u \t\tKyt -tiedostoa .vimrc:iden sijasta" +#, fuzzy +#~ msgid " -O[N] Like -o but split vertically\n" +#~ msgstr "-O[N]\t\tKuten -o, mutta jaa pystysuunnassa" -#: ../main.c:2226 -msgid "--noplugin\t\tDon't load plugin scripts" -msgstr "--noplugin\t\tl lataa liitnnisi" +#, fuzzy +#~ msgid " -p[N] Open N tab pages (default: one for each file)\n" +#~ msgstr "-p[N]\t\tAvaa N välilehteä (oletus: yksi per tiedosto)" -#: ../main.c:2227 -msgid "-p[N]\t\tOpen N tab pages (default: one for each file)" -msgstr "-p[N]\t\tAvaa N vlilehte (oletus: yksi per tiedosto)" +#, fuzzy +#~ msgid " + Start at end of file\n" +#~ msgstr " kahta tilaa varten " -#: ../main.c:2228 -msgid "-o[N]\t\tOpen N windows (default: one for each file)" -msgstr "-o[N]\t\tAvaa N ikkunaa (oletus: yksi per tiedosto)" +#, fuzzy +#~ msgid " + Start at line \n" +#~ msgstr "+\t\t\tAloita riviltä " -#: ../main.c:2229 -msgid "-O[N]\t\tLike -o but split vertically" -msgstr "-O[N]\t\tKuten -o, mutta jaa pystysuunnassa" +#~ msgid " +/ Start at first occurrence of \n" +#~ msgstr "" -#: ../main.c:2230 -msgid "+\t\t\tStart at end of file" -msgstr "+\t\t\tAloita tiedoston lopusta" +#, fuzzy +#~ msgid " --cmd Execute before loading any vimrc\n" +#~ msgstr "--cmd \tSuorita ennen vimrc:iden latausta" -#: ../main.c:2231 -msgid "+\t\tStart at line " -msgstr "+\t\t\tAloita rivilt " +#, fuzzy +msgid "" +" -c Execute after loading the first file\n" +msgstr "-c \t\tSuorita ensimmäisen tiedoston latauduttua" -#: ../main.c:2232 -msgid "--cmd \tExecute before loading any vimrc file" -msgstr "--cmd \tSuorita ennen vimrc:iden latausta" +#, fuzzy +#~ msgid " -S Source after loading the first file\n" +#~ msgstr "-S \t\tLataa ensimmäisen tiedoston latauduttua" -#: ../main.c:2233 -msgid "-c \t\tExecute after loading the first file" -msgstr "-c \t\tSuorita ensimmisen tiedoston latauduttua" +#, fuzzy +#~ msgid " -s Read Normal mode commands from \n" +#~ msgstr "-s \tLue normaalitilan komentoja -tiedostosta" -#: ../main.c:2235 -msgid "-S \t\tSource file after loading the first file" -msgstr "-S \t\tLataa ensimmisen tiedoston latauduttua" +#, fuzzy +#~ msgid " -w Append all typed characters to \n" +#~ msgstr "-w \tLisää kirjoitetut komennot -tiedostoon" -#: ../main.c:2236 -msgid "-s \tRead Normal mode commands from file " -msgstr "-s \tLue normaalitilan komentoja -tiedostosta" +#, fuzzy +#~ msgid " -W Write all typed characters to \n" +#~ msgstr "-W \tKirjoita komennot -tiedostoon" -#: ../main.c:2237 -msgid "-w \tAppend all typed commands to file " -msgstr "-w \tLis kirjoitetut komennot -tiedostoon" +#, fuzzy +#~ msgid " --startuptime Write startup timing messages to \n" +#~ msgstr "--startuptime \tKirjoita käynnistysaikaviestit tiedostoon " -#: ../main.c:2238 -msgid "-W \tWrite all typed commands to file " -msgstr "-W \tKirjoita komennot -tiedostoon" +#~ msgid "" +#~ " --api-info Dump API metadata serialized to msgpack and exit\n" +#~ msgstr "" -#: ../main.c:2240 -msgid "--startuptime \tWrite startup timing messages to " -msgstr "--startuptime \tKirjoita kynnistysaikaviestit tiedostoon " +#~ msgid " --embed Use stdin/stdout as a msgpack-rpc channel\n" +#~ msgstr "" -#: ../main.c:2242 -msgid "-i \t\tUse instead of .viminfo" -msgstr "-i \t\tKyt -tiedostoa .viminfon sijaan" +#~ msgid " --headless Don't start a user interface\n" +#~ msgstr "" -#: ../main.c:2243 -msgid "-h or --help\tPrint Help (this message) and exit" -msgstr "-h tai --help\tTulosta ohje (tm viesti) ja lopeta" +#, fuzzy +#~ msgid " -v, --version Print version information and exit\n" +#~ msgstr "--version\t\t\tTulosta versiotiedot ja lopeta" -#: ../main.c:2244 -msgid "--version\t\tPrint version information and exit" -msgstr "--version\t\t\tTulosta versiotiedot ja lopeta" +#, fuzzy +#~ msgid " -h, --help Print this help message and exit\n" +#~ msgstr "-h tai --help\tTulosta ohje (tämä viesti) ja lopeta" -#: ../mark.c:676 msgid "No marks set" -msgstr "Ei asetettuja merkkej" +msgstr "Ei asetettuja merkkejä" -#: ../mark.c:678 #, c-format msgid "E283: No marks matching \"%s\"" -msgstr "E283: Mikn merkki ei tsm ilmaukseen \"%s\"" +msgstr "E283: Mikään merkki ei täsmää ilmaukseen \"%s\"" #. Highlight title -#: ../mark.c:687 msgid "" "\n" "mark line col file/text" @@ -3615,7 +3403,6 @@ msgstr "" "merkki rivi sarake tiedosto/teksti" #. Highlight title -#: ../mark.c:789 msgid "" "\n" " jump line col file/text" @@ -3624,7 +3411,6 @@ msgstr "" "hyppy rivi sarake tiedosto/teksti" #. Highlight title -#: ../mark.c:831 msgid "" "\n" "change line col text" @@ -3632,138 +3418,85 @@ msgstr "" "\n" "muutos rivi sarake teksti" -#: ../mark.c:1238 -msgid "" -"\n" -"# File marks:\n" -msgstr "" -"\n" -"# Tiedoston merkit:\n" - -#. Write the jumplist with -' -#: ../mark.c:1271 -msgid "" -"\n" -"# Jumplist (newest first):\n" -msgstr "" -"\n" -"# Hyppylista (uusin ensiksi):\n" - -#: ../mark.c:1352 -msgid "" -"\n" -"# History of marks within files (newest to oldest):\n" -msgstr "" -"\n" -"# Tiedostojen merkkien historia (uusimmasta vanhimpaan):\n" - -#: ../mark.c:1431 -msgid "Missing '>'" -msgstr "> puuttuu" - -#: ../memfile.c:426 msgid "E293: block was not locked" msgstr "E293: lohkoa ei ole lukittu" -#: ../memfile.c:799 msgid "E294: Seek error in swap file read" msgstr "E294: Hakuvirhe swap-tiedostoa luettaessa" -#: ../memfile.c:803 msgid "E295: Read error in swap file" msgstr "E295: Lukuvirhe swap-tiedostossa" -#: ../memfile.c:849 msgid "E296: Seek error in swap file write" msgstr "E296: Hakuvirhe swap-tiedostoa kirjoitettaessa" -#: ../memfile.c:865 msgid "E297: Write error in swap file" msgstr "E297: Kirjoitusvirhe swap-tiedostossa" -#: ../memfile.c:1036 msgid "E300: Swap file already exists (symlink attack?)" -msgstr "E300: Swaptiedosto on jo olemassa (symlink-hykkys?)" +msgstr "E300: Swaptiedosto on jo olemassa (symlink-hyökkäys?)" -#: ../memline.c:318 msgid "E298: Didn't get block nr 0?" msgstr "E298: Lohko 0:aa ei saatu?" -#: ../memline.c:361 msgid "E298: Didn't get block nr 1?" -msgstr "E298: Lohko 1:t ei saatu?" +msgstr "E298: Lohko 1:tä ei saatu?" -#: ../memline.c:377 msgid "E298: Didn't get block nr 2?" msgstr "E298: Lohko 2:ta ei saatu?" #. could not (re)open the swap file, what can we do???? -#: ../memline.c:465 msgid "E301: Oops, lost the swap file!!!" -msgstr "E301: Hups, swap-tiedosto hvisi!" +msgstr "E301: Hups, swap-tiedosto hävisi!" -#: ../memline.c:477 msgid "E302: Could not rename swap file" msgstr "E302: Swap-tiedoston uudellennimeys ei onnistu" -#: ../memline.c:554 #, c-format msgid "E303: Unable to open swap file for \"%s\", recovery impossible" msgstr "E303: Swap-tiedostoa %s ei voi avata, palautus ei onnistu" -#: ../memline.c:666 msgid "E304: ml_upd_block0(): Didn't get block 0??" msgstr "E304: ml_upd_block0(): Lohko 0:aa ei saatu?" #. no swap files found -#: ../memline.c:830 #, c-format msgid "E305: No swap file found for %s" msgstr "E305: Ei swap-tiedostoa tiedostolle %s" -#: ../memline.c:839 msgid "Enter number of swap file to use (0 to quit): " msgstr "Anna swap-tiedoston numero tai 0 lopettaaksesi: " -#: ../memline.c:879 #, c-format msgid "E306: Cannot open %s" msgstr "E306: Ei voi avata tiedostoa %s" -#: ../memline.c:897 msgid "Unable to read block 0 from " msgstr "Ei voi lukea lohkoa 0 kohteesta " -#: ../memline.c:900 msgid "" "\n" "Maybe no changes were made or Vim did not update the swap file." msgstr "" "\n" -"Muutoksia ei tehty, tai Vim ei pivittnyt swap-tiedostoa." +"Muutoksia ei tehty, tai Vim ei päivittänyt swap-tiedostoa." -#: ../memline.c:909 msgid " cannot be used with this version of Vim.\n" -msgstr " ei toimi tmn version Vimin kanssa.\n" +msgstr " ei toimi tämän version Vimin kanssa.\n" -#: ../memline.c:911 msgid "Use Vim version 3.0.\n" -msgstr "Kyt Vimin versiota 3.0\n" +msgstr "Käytä Vimin versiota 3.0\n" -#: ../memline.c:916 #, c-format msgid "E307: %s does not look like a Vim swap file" msgstr "E307: %s ei ole Vimin swap-tiedosto" -#: ../memline.c:922 msgid " cannot be used on this computer.\n" -msgstr " ei toimi tll koneella.\n" +msgstr " ei toimi tällä koneella.\n" -#: ../memline.c:924 msgid "The file was created on " msgstr "Tiedosto luotiin " -#: ../memline.c:928 msgid "" ",\n" "or the file has been damaged." @@ -3771,100 +3504,78 @@ msgstr "" ",\n" "tai tiedosto on vahingoittunut." -#: ../memline.c:945 msgid " has been damaged (page size is smaller than minimum value).\n" -msgstr " on vioittunut (sivun koko on vhimmisarvoa pienempi).\n" +msgstr " on vioittunut (sivun koko on vähimmäisarvoa pienempi).\n" -#: ../memline.c:974 #, c-format msgid "Using swap file \"%s\"" -msgstr "Kytetn swap-tiedostoa %s" +msgstr "Käytetään swap-tiedostoa %s" -#: ../memline.c:980 #, c-format msgid "Original file \"%s\"" -msgstr "Alkuperinen tiedosto %s" +msgstr "Alkuperäinen tiedosto %s" -#: ../memline.c:995 msgid "E308: Warning: Original file may have been changed" -msgstr "E308: Varoitus: Alkuperist tiedostoa saattaa olla muutettu" +msgstr "E308: Varoitus: Alkuperäistä tiedostoa saattaa olla muutettu" -#: ../memline.c:1061 #, c-format msgid "E309: Unable to read block 1 from %s" msgstr "E309: Ei voitu lukea lohkoa 1 tiedostosta %s" -#: ../memline.c:1065 msgid "???MANY LINES MISSING" -msgstr "???PALJON RIVEJ PUUTTUU" +msgstr "???PALJON RIVEJÄ PUUTTUU" -#: ../memline.c:1076 msgid "???LINE COUNT WRONG" -msgstr "???RIVIMR PIELESS" +msgstr "???RIVIMÄÄRÄ PIELESSÄ" -#: ../memline.c:1082 msgid "???EMPTY BLOCK" -msgstr "???TYHJ LOHKO" +msgstr "???TYHJÄ LOHKO" -#: ../memline.c:1103 msgid "???LINES MISSING" -msgstr "???RIVEJ PUUTTUU" +msgstr "???RIVEJÄ PUUTTUU" -#: ../memline.c:1128 #, c-format msgid "E310: Block 1 ID wrong (%s not a .swp file?)" -msgstr "E310: Lohon 1 tunniste vr (%s ei ole .swp-tiedosto?)" +msgstr "E310: Lohon 1 tunniste väärä (%s ei ole .swp-tiedosto?)" -#: ../memline.c:1133 msgid "???BLOCK MISSING" msgstr "???LOHKO PUUTTUU" -#: ../memline.c:1147 msgid "??? from here until ???END lines may be messed up" -msgstr "??? tst kohtaan ???LOPPU rivej sekaisin" +msgstr "??? tästä kohtaan ???LOPPU rivejä sekaisin" -#: ../memline.c:1164 msgid "??? from here until ???END lines may have been inserted/deleted" -msgstr "??? tst kohtaan ???LOPPU rivej saattaa olla listty tai poistettu" +msgstr "??? tästä kohtaan ???LOPPU rivejä saattaa olla lisätty tai poistettu" -#: ../memline.c:1181 msgid "???END" msgstr "???LOPPU" -#: ../memline.c:1238 msgid "E311: Recovery Interrupted" msgstr "E311: Palautus keskeytetty" -#: ../memline.c:1243 msgid "" "E312: Errors detected while recovering; look for lines starting with ???" -msgstr "E312: Palautuksessa oli virheit, etsi rivej, jotka alkavat ???" +msgstr "E312: Palautuksessa oli virheitä, etsi rivejä, jotka alkavat ???" -#: ../memline.c:1245 msgid "See \":help E312\" for more information." -msgstr ":help E312 kertoo listietoja" +msgstr ":help E312 kertoo lisätietoja" -#: ../memline.c:1249 msgid "Recovery completed. You should check if everything is OK." -msgstr "Palautus onnistui. Tarkista, ett kaikki on kunnossa." +msgstr "Palautus onnistui. Tarkista, että kaikki on kunnossa." -#: ../memline.c:1251 msgid "" "\n" "(You might want to write out this file under another name\n" msgstr "" "\n" -"(Saattaa kannattaa kirjoittaa tm tiedosto toisella nimell\n" +"(Saattaa kannattaa kirjoittaa tämä tiedosto toisella nimellä\n" -#: ../memline.c:1252 msgid "and run diff with the original file to check for changes)" -msgstr "ja katso diffill muutokset alkuperiseen tiedostoon)" +msgstr "ja katso diffillä muutokset alkuperäiseen tiedostoon)" -#: ../memline.c:1254 msgid "Recovery completed. Buffer contents equals file contents." -msgstr "Palautus onnistui. Puskurin ja tiedoston sisllt tsmvt." +msgstr "Palautus onnistui. Puskurin ja tiedoston sisällöt täsmäävät." -#: ../memline.c:1255 msgid "" "\n" "You may want to delete the .swp file now.\n" @@ -3875,51 +3586,42 @@ msgstr "" "\n" #. use msg() to start the scrolling properly -#: ../memline.c:1327 msgid "Swap files found:" -msgstr "Swap-tiedostoja lytyi:" +msgstr "Swap-tiedostoja löytyi:" -#: ../memline.c:1446 msgid " In current directory:\n" -msgstr " Tss hakemistossa:\n" +msgstr " Tässä hakemistossa:\n" -#: ../memline.c:1448 msgid " Using specified name:\n" -msgstr " Mritellyll nimell:\n" +msgstr " Määritellyllä nimellä:\n" -#: ../memline.c:1450 msgid " In directory " msgstr " Hakemistossa " -#: ../memline.c:1465 msgid " -- none --\n" -msgstr " -- ei mitn --\n" +msgstr " -- ei mitään --\n" -#: ../memline.c:1527 msgid " owned by: " msgstr " omistaja: " -#: ../memline.c:1529 msgid " dated: " msgstr " ajalta: " -#: ../memline.c:1532 ../memline.c:3231 msgid " dated: " msgstr " ajalta:" -#: ../memline.c:1548 msgid " [from Vim version 3.0]" msgstr " [Vimin 3.0-versiosta]" -#: ../memline.c:1550 msgid " [does not look like a Vim swap file]" -msgstr " [ei nyt Vimin swap-tiedostolta]" +msgstr " [ei näytä Vimin swap-tiedostolta]" + +#~ msgid " [garbled strings (not nul terminated)]" +#~ msgstr "" -#: ../memline.c:1552 msgid " file name: " msgstr " tiedostonimi: " -#: ../memline.c:1558 msgid "" "\n" " modified: " @@ -3927,27 +3629,22 @@ msgstr "" "\n" " muokattu: " -#: ../memline.c:1559 msgid "YES" -msgstr "KYLL" +msgstr "KYLLÄ" -#: ../memline.c:1559 msgid "no" msgstr "ei" -#: ../memline.c:1562 msgid "" "\n" " user name: " msgstr "" "\n" -" kyttjnimi: " +" käyttäjänimi: " -#: ../memline.c:1568 msgid " host name: " msgstr " laitenimi: " -#: ../memline.c:1570 msgid "" "\n" " host name: " @@ -3955,7 +3652,6 @@ msgstr "" "\n" " laitenimi: " -#: ../memline.c:1575 msgid "" "\n" " process ID: " @@ -3963,190 +3659,143 @@ msgstr "" "\n" " prosessin tunniste: " -#: ../memline.c:1579 msgid " (still running)" -msgstr " (kynniss)" +msgstr " (käynnissä)" -#: ../memline.c:1586 msgid "" "\n" " [not usable on this computer]" msgstr "" "\n" -" [ei toimi tll koneella]" +" [ei toimi tällä koneella]" -#: ../memline.c:1590 msgid " [cannot be read]" msgstr " [ei voi lukea]" -#: ../memline.c:1593 msgid " [cannot be opened]" msgstr " [ei voi avata]" -#: ../memline.c:1698 msgid "E313: Cannot preserve, there is no swap file" -msgstr "E313: Ei voi silytt, swap-tiedostoa ei ole" +msgstr "E313: Ei voi säilyttää, swap-tiedostoa ei ole" -#: ../memline.c:1747 msgid "File preserved" -msgstr "Tiedosto silytetty" +msgstr "Tiedosto säilytetty" -#: ../memline.c:1749 msgid "E314: Preserve failed" -msgstr "E314: Silyttminen eponnistui" +msgstr "E314: Säilyttäminen epäonnistui" -#: ../memline.c:1819 -#, c-format -msgid "E315: ml_get: invalid lnum: %" -msgstr "E315: ml_get: virheellinen lnum: %" +#, fuzzy, c-format +#~ msgid "E315: ml_get: invalid lnum: %" +#~ msgstr "E315: ml_get: virheellinen lnum: %ld" -#: ../memline.c:1851 -#, c-format -msgid "E316: ml_get: cannot find line %" -msgstr "E316: ml_get: rivi % ei lydy" +#, fuzzy, c-format +#~ msgid "E316: ml_get: cannot find line %" +#~ msgstr "E316: ml_get: riviä %ld ei löydy" -#: ../memline.c:2236 msgid "E317: pointer block id wrong 3" -msgstr "E317: osoitinlohkon tunnus vr 3" +msgstr "E317: osoitinlohkon tunnus väärä 3" -#: ../memline.c:2311 msgid "stack_idx should be 0" -msgstr "stack_idx pit olla 0" +msgstr "stack_idx pitää olla 0" -#: ../memline.c:2369 msgid "E318: Updated too many blocks?" -msgstr "E318: Pivitetty liikaa lohkoja" +msgstr "E318: Päivitetty liikaa lohkoja" -#: ../memline.c:2511 msgid "E317: pointer block id wrong 4" -msgstr "E317: osoitinlohkon tunnus vr 4" +msgstr "E317: osoitinlohkon tunnus väärä 4" -#: ../memline.c:2536 msgid "deleted block 1?" msgstr "poistettu lohko 1?" -#: ../memline.c:2707 -#, c-format -msgid "E320: Cannot find line %" -msgstr "E320: Rivi % ei lydy" +#, fuzzy, c-format +#~ msgid "E320: Cannot find line %" +#~ msgstr "E320: Riviä %ld ei löydy" -#: ../memline.c:2916 msgid "E317: pointer block id wrong" -msgstr "E317: osoitinlohkon tunnus vr" +msgstr "E317: osoitinlohkon tunnus väärä" -#: ../memline.c:2930 msgid "pe_line_count is zero" msgstr "pe_line_count on nolla" -#: ../memline.c:2955 -#, c-format -msgid "E322: line number out of range: % past the end" -msgstr "E322: rivinumero arvoalueen ulkopuoleta: % on loppua suurempi" +#, fuzzy, c-format +#~ msgid "E322: line number out of range: % past the end" +#~ msgstr "E322: rivinumero arvoalueen ulkopuoleta: %ld on loppua suurempi" -#: ../memline.c:2959 -#, c-format -msgid "E323: line count wrong in block %" -msgstr "E323: rivimr vrin lohkossa %" +#, fuzzy, c-format +#~ msgid "E323: line count wrong in block %" +#~ msgstr "E323: rivimäärä väärin lohkossa %ld" -#: ../memline.c:2999 msgid "Stack size increases" msgstr "Pinon koko kasvaa" -#: ../memline.c:3038 msgid "E317: pointer block id wrong 2" -msgstr "E317: osoitinlohon tunnus vr 2" +msgstr "E317: osoitinlohon tunnus väärä 2" -#: ../memline.c:3070 #, c-format msgid "E773: Symlink loop for \"%s\"" msgstr "E773: Symlinkkisilmukka kohteelle %s" -#: ../memline.c:3221 msgid "E325: ATTENTION" msgstr "E325: HUOMAA" -#: ../memline.c:3222 msgid "" "\n" "Found a swap file by the name \"" msgstr "" "\n" -"Swap-tiedosto lytyi: \"" +"Swap-tiedosto löytyi: \"" -#: ../memline.c:3226 msgid "While opening file \"" msgstr "Avattaessa tiedostoa " -#: ../memline.c:3239 msgid " NEWER than swap file!\n" msgstr " joka on UUDEMPI kuin swap-tiedosto!\n" -#: ../memline.c:3244 -#, fuzzy +#. Some of these messages are long to allow translation to +#. * other languages. msgid "" "\n" "(1) Another program may be editing the same file. If this is the case,\n" " be careful not to end up with two different instances of the same\n" -" file when making changes." +" file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" -"(1) Toinen ohjelma saattaa kytt samaa tiedostoa.\n" -" Jos nin on, varo, ettet muokkaa saman tiedoston\n" -" kahta instanssia yht aikaa.\n" - -#: ../memline.c:3245 -#, fuzzy -msgid " Quit, or continue with caution.\n" -msgstr " Lopeta, tai jatka.\n" +"(1) Toinen ohjelma saattaa käyttää samaa tiedostoa.\n" +" Jos näin on, varo, ettet muokkaa saman tiedoston\n" +" kahta instanssia yhtä aikaa. Lopeta tai jatka varoen.\n" -#: ../memline.c:3246 -#, fuzzy msgid "(2) An edit session for this file crashed.\n" -msgstr "" -"\n" -"(2) Ohjelma on kaatunut muokatessa tiedostoa.\n" +msgstr "(2) Tiedostonmuokkausistunto on kaatunut.\n" -#: ../memline.c:3247 msgid " If this is the case, use \":recover\" or \"vim -r " -msgstr " Jos nin on, kyt komentoa :recover tai vim -r " +msgstr " Jos näin on, käytä komentoa :recover tai vim -r " -#: ../memline.c:3249 msgid "" "\"\n" " to recover the changes (see \":help recovery\").\n" msgstr "" "\"\n" -" palauttaaksesi muutokset (listietoja: \":help recovery\").\n" +" palauttaaksesi muutokset (lisätietoja: \":help recovery\").\n" -#: ../memline.c:3250 msgid " If you did this already, delete the swap file \"" -msgstr " Jos teit jo nin, poista swap-tiedosto " +msgstr " Jos teit jo näin, poista swap-tiedosto " -#: ../memline.c:3252 msgid "" "\"\n" " to avoid this message.\n" msgstr "" "\"\n" -" vlttksesi tmn viestin.\n" +" välttääksesi tämän viestin.\n" -#: ../memline.c:3450 ../memline.c:3452 msgid "Swap file \"" msgstr "Swap-tiedosto " -#: ../memline.c:3451 ../memline.c:3455 msgid "\" already exists!" msgstr " on jo olemassa" -#: ../memline.c:3457 msgid "VIM - ATTENTION" msgstr "VIM - HUOMAUTUS" -#: ../memline.c:3459 -msgid "Swap file already exists!" -msgstr "Swap-tiedosto on jo olemassa" - -#: ../memline.c:3464 msgid "" "&Open Read-Only\n" "&Edit anyway\n" @@ -4160,7 +3809,6 @@ msgstr "" "&Lopeta\n" "P&eru" -#: ../memline.c:3467 msgid "" "&Open Read-Only\n" "&Edit anyway\n" @@ -4184,48 +3832,48 @@ msgstr "" #. #. ".s?a" #. ".saa": tried enough, give up -#: ../memline.c:3528 msgid "E326: Too many swap files found" msgstr "E326: Liian monta swap-tiedostoa" -#: ../memory.c:227 -#, c-format -msgid "E342: Out of memory! (allocating % bytes)" -msgstr "E342: Muisti loppui! (varattaessa % tavua)" +#, fuzzy, c-format +msgid "" +"E303: Unable to create directory \"%s\" for swap file, recovery impossible: " +"%s" +msgstr "E303: Swap-tiedostoa %s ei voi avata, palautus ei onnistu" + +#, fuzzy +#~ msgid "Vim: Data too large to fit into virtual memory space\n" +#~ msgstr "arvo on liian suuri mahtumaan C:n int-tyyppiin" + +#, fuzzy, c-format +#~ msgid "E342: Out of memory! (allocating % bytes)" +#~ msgstr "E342: Muisti loppui! (varattaessa %lu tavua)" -#: ../menu.c:62 msgid "E327: Part of menu-item path is not sub-menu" msgstr "E327: Valikkokohtapolun osa ei ole alivalikko" -#: ../menu.c:63 msgid "E328: Menu only exists in another mode" msgstr "E328: Valikko on olemassa vain toisessa tilassa" -#: ../menu.c:64 #, c-format msgid "E329: No menu \"%s\"" msgstr "E329: Ei valikkoa %s" #. Only a mnemonic or accelerator is not valid. -#: ../menu.c:329 msgid "E792: Empty menu name" -msgstr "E792: tyhj valikkonimi" +msgstr "E792: tyhjä valikkonimi" -#: ../menu.c:340 msgid "E330: Menu path must not lead to a sub-menu" msgstr "E330: Valikkopolku ei saa johtaa alivalikkoon" -#: ../menu.c:365 msgid "E331: Must not add menu items directly to menu bar" -msgstr "E331: Valikkokohtia ei saa list suoraan valikkopalkkiin" +msgstr "E331: Valikkokohtia ei saa lisätä suoraan valikkopalkkiin" -#: ../menu.c:370 msgid "E332: Separator cannot be part of a menu path" msgstr "E332: Erotin ei voi olla valikkopolun osa" #. Now we have found the matching menu, and we list the mappings #. Highlight title -#: ../menu.c:762 msgid "" "\n" "--- Menus ---" @@ -4233,87 +3881,64 @@ msgstr "" "\n" "--- Valikot ---" -#: ../menu.c:1313 msgid "E333: Menu path must lead to a menu item" msgstr "E333: Valikkopolun on johdettava valikkokohtaan" -#: ../menu.c:1330 #, c-format msgid "E334: Menu not found: %s" -msgstr "E334: Valikkoa ei lydy: %s" +msgstr "E334: Valikkoa ei löydy: %s" -#: ../menu.c:1396 #, c-format msgid "E335: Menu not defined for %s mode" -msgstr "E335: Valikkoa ei ole mritelty %s-tilassa" +msgstr "E335: Valikkoa ei ole määritelty %s-tilassa" -#: ../menu.c:1426 -msgid "E336: Menu path must lead to a sub-menu" -msgstr "E336: Valikkopolun pit johtaa alivalikkoon" - -#: ../menu.c:1447 -msgid "E337: Menu not found - check menu names" -msgstr "E337: Valikkoa ei lytynyt - tarkista valikkojen nimet" - -#: ../message.c:423 #, c-format msgid "Error detected while processing %s:" msgstr "Virhe suoritettaessa komentoja %s:" -#: ../message.c:445 #, c-format msgid "line %4ld:" msgstr "rivi %4ld:" -#: ../message.c:617 #, c-format msgid "E354: Invalid register name: '%s'" msgstr "E354: Virheellinen rekisterin nimi: %s" -#: ../message.c:986 msgid "Interrupt: " msgstr "Keskeytys: " -#: ../message.c:988 msgid "Press ENTER or type command to continue" -msgstr "Paina enteri tai kirjoita komento aloittaaksesi " +msgstr "Paina enteriä tai kirjoita komento aloittaaksesi " -#: ../message.c:1843 -#, c-format -msgid "%s line %" -msgstr "%s rivi %" +#, fuzzy, c-format +#~ msgid "%s line %" +#~ msgstr "%s rivi %ld" -#: ../message.c:2392 msgid "-- More --" -msgstr "-- Lis --" +msgstr "-- Lisää --" -#: ../message.c:2398 msgid " SPACE/d/j: screen/page/line down, b/u/k: up, q: quit " -msgstr " SPACE/d/j: ruutu/sivu/rivi alas, b/u/k: yls, q: lopeta " +msgstr " SPACE/d/j: ruutu/sivu/rivi alas, b/u/k: ylös, q: lopeta " -#: ../message.c:3021 ../message.c:3031 msgid "Question" msgstr "Kysymys" -#: ../message.c:3023 msgid "" "&Yes\n" "&No" msgstr "" -"&Kyll\n" +"&Kyllä\n" "&Ei" -#: ../message.c:3033 msgid "" "&Yes\n" "&No\n" "&Cancel" msgstr "" -"&Kyll\n" +"&Kyllä\n" "&Ei\n" "&Peru" -#: ../message.c:3045 msgid "" "&Yes\n" "&No\n" @@ -4321,180 +3946,165 @@ msgid "" "&Discard All\n" "&Cancel" msgstr "" -"&Kyll\n" +"&Kyllä\n" "&Ei\n" "&Tallenna kaikki\n" "T&uhoa kaikki\n" "&Peru" -#: ../message.c:3058 -msgid "E766: Insufficient arguments for printf()" -msgstr "E766: printf():lle ei annettu tarpeeksi argumentteja" - -#: ../message.c:3119 -msgid "E807: Expected Float argument for printf()" -msgstr "E807: Odotettiin Float-argumenttia printf():lle" - -#: ../message.c:3873 -msgid "E767: Too many arguments to printf()" -msgstr "E767: printf():lle annettiin liikaa argumentteja" - -#: ../misc1.c:2256 msgid "W10: Warning: Changing a readonly file" msgstr "W10: Varoitus: Muutetaan kirjoitussuojattua tiedostoa" -#: ../misc1.c:2537 msgid "Type number and or click with mouse (empty cancels): " -msgstr "Kirjoita numero ja tai valitse hiirell (tyhj peruu): " +msgstr "Kirjoita numero ja tai valitse hiirellä (tyhjä peruu): " -#: ../misc1.c:2539 msgid "Type number and (empty cancels): " -msgstr "Valitse numero ja (tyhj peruu): " +msgstr "Valitse numero ja (tyhjä peruu): " -#: ../misc1.c:2585 msgid "1 more line" -msgstr "1 rivi lis" +msgstr "1 rivi lisää" -#: ../misc1.c:2588 msgid "1 line less" -msgstr "1 rivi vhemmn" +msgstr "1 rivi vähemmän" -#: ../misc1.c:2593 -#, c-format -msgid "% more lines" -msgstr "% rivi lis" +#, fuzzy, c-format +#~ msgid "% more lines" +#~ msgstr "%ld riviä lisää" -#: ../misc1.c:2596 -#, c-format -msgid "% fewer lines" -msgstr "% rivi vhemmn" +#, fuzzy, c-format +#~ msgid "% fewer lines" +#~ msgstr "%ld riviä vähemmän" -#: ../misc1.c:2599 msgid " (Interrupted)" msgstr " (Keskeytetty)" -#: ../misc1.c:2635 msgid "Beep!" msgstr "Piip!" -#: ../misc2.c:738 #, c-format msgid "Calling shell to execute: \"%s\"" msgstr "Kutsutaan kuorta suorittamaan: %s" -#: ../normal.c:183 -msgid "E349: No identifier under cursor" -msgstr "E349: Ei tunnistetta osoittimen alla" +#, c-format +#~ msgid "Invalid channel \"%\"" +#~ msgstr "" -#: ../normal.c:1866 -msgid "E774: 'operatorfunc' is empty" -msgstr "E774: operatorfunc on tyhj" +#~ msgid "Message is not an array" +#~ msgstr "" -#: ../normal.c:2637 -msgid "Warning: terminal cannot highlight" -msgstr "Varoitus: terminaalista puuttuu korostus" +#, fuzzy +#~ msgid "Message is empty" +#~ msgstr "Viesti" -#: ../normal.c:2807 -msgid "E348: No string under cursor" +#~ msgid "Message type must be an integer" +#~ msgstr "" + +#, fuzzy +#~ msgid "Unknown message type" +#~ msgstr "E574: Tuntematon rekisterityyppi %d" + +#~ msgid "Request array size should be 4 (request) or 3 (notification)" +#~ msgstr "" + +#~ msgid "ID must be a positive integer" +#~ msgstr "" + +#~ msgid "Method must be a string" +#~ msgstr "" + +#, fuzzy +#~ msgid "Parameters must be an array" +#~ msgstr "merkin nimen pitää olla yksi merkki" + +#. +#. * nv_*(): functions called to handle Normal and Visual mode commands. +#. * n_*(): functions called to handle Normal mode commands. +#. * v_*(): functions called to handle Visual mode commands. +#. +msgid "E349: No identifier under cursor" +msgstr "E349: Ei tunnistetta osoittimen alla" + +msgid "E774: 'operatorfunc' is empty" +msgstr "E774: operatorfunc on tyhjä" + +msgid "Warning: terminal cannot highlight" +msgstr "Varoitus: terminaalista puuttuu korostus" + +msgid "E348: No string under cursor" msgstr "E348: Ei merkkijonoa kursorin alla" -#: ../normal.c:3937 msgid "E352: Cannot erase folds with current 'foldmethod'" -msgstr "E352: taitoksia ei voi poistaa tll foldmethodilla" +msgstr "E352: taitoksia ei voi poistaa tällä foldmethodilla" -#: ../normal.c:5897 msgid "E664: changelist is empty" -msgstr "E664: muutoslista on tyhj" +msgstr "E664: muutoslista on tyhjä" -#: ../normal.c:5899 msgid "E662: At start of changelist" msgstr "E662: Muutoslistan alussa" -#: ../normal.c:5901 msgid "E663: At end of changelist" msgstr "E663: Muutoslistan lopussa" -#: ../normal.c:7053 -msgid "Type :quit to exit Nvim" -msgstr "Komento :quit lopettaa Vimin" +#, fuzzy +#~ msgid "Type :quit to exit Nvim" +#~ msgstr "Komento :quit lopettaa Vimin" -#: ../ops.c:248 #, c-format msgid "1 line %sed 1 time" -msgstr "1 rivi %s kerran" +msgstr "1 riviä %s kerran" -#: ../ops.c:250 #, c-format msgid "1 line %sed %d times" -msgstr "1 rivi %s %d kertaa" +msgstr "1 riviä %s %d kertaa" -#: ../ops.c:253 -#, c-format -msgid "% lines %sed 1 time" -msgstr "% rivi %s kerran" +#, fuzzy, c-format +#~ msgid "% lines %sed 1 time" +#~ msgstr "%ld riviä %s kerran" -#: ../ops.c:256 -#, c-format -msgid "% lines %sed %d times" -msgstr "% rivi %s %d kertaa" +#, fuzzy, c-format +#~ msgid "% lines %sed %d times" +#~ msgstr "%ld riviä %s %d kertaa" -#: ../ops.c:592 -#, c-format -msgid "% lines to indent... " -msgstr "% rivi sisennettvn..." +#, fuzzy, c-format +#~ msgid "% lines to indent... " +#~ msgstr "%ld riviä sisennettävänä..." -#: ../ops.c:634 msgid "1 line indented " msgstr "1 rivi sisennetty " -#: ../ops.c:636 -#, c-format -msgid "% lines indented " -msgstr "% rivi sisennetty " +#, fuzzy, c-format +#~ msgid "% lines indented " +#~ msgstr "%ld riviä sisennetty " -#: ../ops.c:938 msgid "E748: No previously used register" -msgstr "E748: Ei aiemmin kytettyj rekisterej" +msgstr "E748: Ei aiemmin käytettyjä rekisterejä" -#. must display the prompt -#: ../ops.c:1433 -msgid "cannot yank; delete anyway" -msgstr "Ei voi kopioida; poista joka tapauksessa" - -#: ../ops.c:1929 msgid "1 line changed" msgstr "1 rivi muuttui" -#: ../ops.c:1931 -#, c-format -msgid "% lines changed" -msgstr "% rivi muuttui" +#, fuzzy, c-format +#~ msgid "% lines changed" +#~ msgstr "%ld riviä muuttui" -#: ../ops.c:2521 msgid "block of 1 line yanked" msgstr "1 rivin lohko kopioitu" -#: ../ops.c:2523 msgid "1 line yanked" msgstr "1 rivi kopioitu" -#: ../ops.c:2525 -#, c-format -msgid "block of % lines yanked" -msgstr "lohko % rivilt kopioitu" +#, fuzzy, c-format +#~ msgid "block of % lines yanked" +#~ msgstr "lohko %ld riviltä kopioitu" -#: ../ops.c:2528 -#, c-format -msgid "% lines yanked" -msgstr "% rivi kopioitu" +#, fuzzy, c-format +#~ msgid "% lines yanked" +#~ msgstr "%ld riviä kopioitu" -#: ../ops.c:2710 #, c-format msgid "E353: Nothing in register %s" -msgstr "E353: Rekisteriss %s ei ole mitn" +msgstr "E353: Rekisterissä %s ei ole mitään" #. Highlight title -#: ../ops.c:3185 msgid "" "\n" "--- Registers ---" @@ -4502,207 +4112,142 @@ msgstr "" "\n" "--- Rekisterit ---" -#: ../ops.c:4455 -msgid "Illegal register name" -msgstr "Virheellinen rekisterin nimi" - -#: ../ops.c:4533 msgid "" -"\n" -"# Registers:\n" +"E883: search pattern and expression register may not contain two or more " +"lines" msgstr "" -"\n" -"# Rekisterit:\n" - -#: ../ops.c:4575 -#, c-format -msgid "E574: Unknown register type %d" -msgstr "E574: Tuntematon rekisterityyppi %d" +"E883: hakulauseke- ja -ilmausrekisteri ei voi sisältää kahta tai useampaa " +"riviä" -#: ../ops.c:5089 -#, c-format -msgid "% Cols; " -msgstr "% saraketta, " +#, fuzzy, c-format +#~ msgid "% Cols; " +#~ msgstr "%ld saraketta, " -#: ../ops.c:5097 -#, c-format +#, fuzzy, c-format msgid "" "Selected %s% of % Lines; % of % Words; " "% of % Bytes" -msgstr "" -"Valittu %s%/% rivi, %/% sanaa, %/" -"% tavua" +msgstr "Valittu %s%ld/%ld riviä, %lld/%lld sanaa, %lld/%lld tavua" -#: ../ops.c:5105 -#, c-format +#, fuzzy, c-format msgid "" "Selected %s% of % Lines; % of % Words; " "% of % Chars; % of % Bytes" msgstr "" -"Valittu %s%/% rivi, %/% sanaa, %/" -"% merkki, %/% tavua" +"Valittu %s%ld/%ld riviä, %lld/%lld sanaa, %lld/%lld merkkiä, %lld/%lld tavua" -#: ../ops.c:5123 -#, c-format +#, fuzzy, c-format msgid "" "Col %s of %s; Line % of %; Word % of %; Byte " "% of %" -msgstr "" -"Sarake %s/%s, Rivi %/%, sana %/%, tavu " -"%/%" +msgstr "Sarake %s/%s, Rivi %ld/%ld, sana %lld/%lld, tavu %lld/%lld" -#: ../ops.c:5133 -#, c-format +#, fuzzy, c-format msgid "" "Col %s of %s; Line % of %; Word % of %; Char " "% of %; Byte % of %" msgstr "" -"Sarake %s/%s, rivi %/%, sana %/%, merkki " -"%/%, tavu %/%" +"Sarake %s/%s, rivi %ld/%ld, sana %lld/%lld, merkki %lld/%lld, tavu %lld/%lld" # Unicode Byte Order Mark -#: ../ops.c:5146 -#, c-format -msgid "(+% for BOM)" -msgstr "(+% BOMista)" - -#: ../option.c:1238 -msgid "%<%f%h%m%=Page %N" -msgstr "%<%f%h%m%=Sivu %N" - -#: ../option.c:1574 -msgid "Thanks for flying Vim" -msgstr "Kiitos ett ajoit Vimi" +#, fuzzy, c-format +#~ msgid "(+% for BOM)" +#~ msgstr "(+%ld BOMista)" #. found a mismatch: skip -#: ../option.c:2698 msgid "E518: Unknown option" msgstr "E518: Tuntematon asetus" -#: ../option.c:2709 -msgid "E519: Option not supported" -msgstr "E519: Asetusta ei tueta" - -#: ../option.c:2740 msgid "E520: Not allowed in a modeline" -msgstr "E520: Ei sallitu modeline-rivill" +msgstr "E520: Ei sallitu modeline-rivillä" -#: ../option.c:2815 msgid "E846: Key code not set" -msgstr "" +msgstr "E846: Avainkoodi puuttuu" -#: ../option.c:2924 msgid "E521: Number required after =" -msgstr "E521: =:n jlkeen tarvitaan luku" +msgstr "E521: =:n jälkeen tarvitaan luku" -#: ../option.c:3226 ../option.c:3864 -msgid "E522: Not found in termcap" -msgstr "E522: Puuttuu termcapista" - -#: ../option.c:3335 #, c-format msgid "E539: Illegal character <%s>" msgstr "E539: Virheellinen merkki <%s>" -#: ../option.c:3862 -msgid "E529: Cannot set 'term' to empty string" -msgstr "E529: Termi ei voi asettaa tyhjksi merkkijonoksi" +#, c-format +msgid "For option %s" +msgstr "Asetukselle %s" -#: ../option.c:3885 msgid "E589: 'backupext' and 'patchmode' are equal" msgstr "E589: backupext ja patchmod ovat samat" -#: ../option.c:3964 msgid "E834: Conflicts with value of 'listchars'" msgstr "E834: listcharsin arvoissa on ristiriitoja" -#: ../option.c:3966 msgid "E835: Conflicts with value of 'fillchars'" msgstr "E835: fillcharsin arvossa on ristiriitoja" -#: ../option.c:4163 msgid "E524: Missing colon" msgstr "E524: Kaksoispiste puuttuu" -#: ../option.c:4165 msgid "E525: Zero length string" msgstr "E525: Nollan pituinen merkkijono" -#: ../option.c:4220 #, c-format msgid "E526: Missing number after <%s>" -msgstr "E526: Lukuarvo puuttuu merkkijonon <%s> jlkeen" +msgstr "E526: Lukuarvo puuttuu merkkijonon <%s> jälkeen" -#: ../option.c:4232 msgid "E527: Missing comma" msgstr "E527: Pilkku puuttuu" -#: ../option.c:4239 msgid "E528: Must specify a ' value" -msgstr "E528: '-arvo pit antaa" +msgstr "E528: '-arvo pitää antaa" -#: ../option.c:4271 msgid "E595: contains unprintable or wide character" -msgstr "E595: Sislt tulostumattomia tai leveit merkkej" +msgstr "E595: Sisältää tulostumattomia tai leveitä merkkejä" -#: ../option.c:4469 #, c-format msgid "E535: Illegal character after <%c>" -msgstr "E535: Virheellinen merkki merkin <%c> jlkeen" +msgstr "E535: Virheellinen merkki merkin <%c> jälkeen" -#: ../option.c:4534 msgid "E536: comma required" msgstr "E536: pilkku puuttuu" -#: ../option.c:4543 #, c-format msgid "E537: 'commentstring' must be empty or contain %s" -msgstr "E537: commentstringin pit olla tyhj tai sislt %s" +msgstr "E537: commentstringin pitää olla tyhjä tai sisältää %s" -#: ../option.c:4928 msgid "E540: Unclosed expression sequence" msgstr "E540: Sulkematon lausekesarja" -#: ../option.c:4932 msgid "E541: too many items" msgstr "E541: liikaa kohteita" -#: ../option.c:4934 msgid "E542: unbalanced groups" -msgstr "E542: eptasapainoisia ryhmi" +msgstr "E542: epätasapainoisia ryhmiä" -#: ../option.c:5148 msgid "E590: A preview window already exists" msgstr "E590: Esikatseluikkuna on jo olemassa" -#: ../option.c:5311 msgid "W17: Arabic requires UTF-8, do ':set encoding=utf-8'" -msgstr "W17: Arabialle pit olla UTF-8:aa, aseta :set encoding=utf-8" +msgstr "W17: Arabialle pitää olla UTF-8:aa, aseta :set encoding=utf-8" -#: ../option.c:5623 #, c-format msgid "E593: Need at least %d lines" -msgstr "E593: Tarvitaan ainakin %d rivi" +msgstr "E593: Tarvitaan ainakin %d riviä" -#: ../option.c:5631 #, c-format msgid "E594: Need at least %d columns" msgstr "E594: Tarvitaan ainakin %d saraketta" -#: ../option.c:6011 #, c-format msgid "E355: Unknown option: %s" msgstr "E355: Tuntematon asetus: %s" #. There's another character after zeros or the string -#. * is empty. In both cases, we are trying to set a -#. * num option using a string. -#: ../option.c:6037 +#. is empty. In both cases, we are trying to set a +#. num option using a string. #, c-format msgid "E521: Number required: &%s = '%s'" msgstr "E521: tarvitaan luku: &%s = '%s'" -#: ../option.c:6149 msgid "" "\n" "--- Terminal codes ---" @@ -4710,7 +4255,6 @@ msgstr "" "\n" "--- Terminaalikoodit ---" -#: ../option.c:6151 msgid "" "\n" "--- Global option values ---" @@ -4718,7 +4262,6 @@ msgstr "" "\n" "--- Globaalit asetukset ---" -#: ../option.c:6153 msgid "" "\n" "--- Local option values ---" @@ -4726,7 +4269,6 @@ msgstr "" "\n" "--- Paikalliset asetukset ---" -#: ../option.c:6155 msgid "" "\n" "--- Options ---" @@ -4734,29 +4276,24 @@ msgstr "" "\n" "--- Asetukset ---" -#: ../option.c:6816 msgid "E356: get_varp ERROR" msgstr "E356: get_varp-virhe" -#: ../option.c:7696 #, c-format msgid "E357: 'langmap': Matching character missing for %s" -msgstr "E357: langmap: Merkkiin %s tsmv merkki puuttuu" +msgstr "E357: langmap: Merkkiin %s täsmäävä merkki puuttuu" -#: ../option.c:7715 #, c-format msgid "E358: 'langmap': Extra characters after semicolon: %s" -msgstr "E358: langmap: ylimrisi merkkej puolipisteen jlkeen: %s" +msgstr "E358: langmap: ylimääräisiä merkkejä puolipisteen jälkeen: %s" -#: ../os/shell.c:194 -msgid "" -"\n" -"Cannot execute shell " -msgstr "" -"\n" -"Kuoren suoritus ei onnistu " +#, c-format +msgid "dlerror = \"%s\"" +msgstr "dlerror = %s" + +msgid "Vim: Error reading input, exiting...\n" +msgstr "Vim: Virhe luettaessa syötettä, poistutaan...\n" -#: ../os/shell.c:439 msgid "" "\n" "shell returned " @@ -4764,8 +4301,18 @@ msgstr "" "\n" "kuoren palautusarvo " -# mik security context? -#: ../os_unix.c:465 ../os_unix.c:471 +#~ msgid "" +#~ "\n" +#~ "shell failed to start: " +#~ msgstr "" + +#. Can happen if system() tries to send input to a shell command that was +#. backgrounded (:call system("cat - &", "foo")). #3529 #5241 +#, fuzzy, c-format +#~ msgid "E5677: Error writing input to shell-command: %s" +#~ msgstr "E677: Väliaikaistiedostoon kirjoittaminen ei onnistunut" + +# mikä security context? msgid "" "\n" "Could not get security context for " @@ -4773,7 +4320,6 @@ msgstr "" "\n" "Ei saatu turvallisuuskontekstia kohteelle " -#: ../os_unix.c:479 msgid "" "\n" "Could not set security context for " @@ -4781,947 +4327,897 @@ msgstr "" "\n" "Ei voitu asettaa turvallisuuskontekstia kohteelle " -#: ../os_unix.c:1558 ../os_unix.c:1647 -#, c-format -msgid "dlerror = \"%s\"" -msgstr "dlerror = %s" - -#: ../path.c:1449 #, c-format msgid "E447: Can't find file \"%s\" in path" -msgstr "E447: Tiedosto %s ei lydy polulta" +msgstr "E447: Tiedosto %s ei löydy polulta" -#: ../quickfix.c:359 #, c-format msgid "E372: Too many %%%c in format string" msgstr "E372: Liikaa %%%c-juttuja muotoilumerkkijonossa" -#: ../quickfix.c:371 #, c-format msgid "E373: Unexpected %%%c in format string" msgstr "E373: Odottamaton %%%c muotoilumerkkijonossa" -#: ../quickfix.c:420 msgid "E374: Missing ] in format string" msgstr "E374: ] puuttuu muotoilemerkkijonosta" -#: ../quickfix.c:431 #, c-format msgid "E375: Unsupported %%%c in format string" msgstr "E375: Tukematon %%%c muotoilumerkkijonossa" -#: ../quickfix.c:448 #, c-format msgid "E376: Invalid %%%c in format string prefix" msgstr "E376: Virheellinen %%%c muotoilumerkkijonon alussa" -#: ../quickfix.c:454 #, c-format msgid "E377: Invalid %%%c in format string" msgstr "E377: Virheellinen %%%c muotoilumerkkijonossa" #. nothing found -#: ../quickfix.c:477 msgid "E378: 'errorformat' contains no pattern" msgstr "E378: errorformatissa ei ole kuvioita" -#: ../quickfix.c:695 msgid "E379: Missing or empty directory name" -msgstr "E379: Puuttuva tai tyhj hakemiston nimi" +msgstr "E379: Puuttuva tai tyhjä hakemiston nimi" -#: ../quickfix.c:1305 msgid "E553: No more items" -msgstr "E553: Ei en kohteita" +msgstr "E553: Ei enää kohteita" + +msgid "E924: Current window was closed" +msgstr "E924: Nykyinen ikkuna on suljettu" + +msgid "E925: Current quickfix was changed" +msgstr "E925: Nykyinen quickfix on muuttunut" + +msgid "E926: Current location list was changed" +msgstr "E926: Nykyinen sijaintiluettelo on muuttunut" -#: ../quickfix.c:1674 #, c-format msgid "(%d of %d)%s%s: " msgstr "(%d/%d)%s%s: " -#: ../quickfix.c:1676 msgid " (line deleted)" msgstr " (rivi poistettu)" -#: ../quickfix.c:1863 +#, c-format +msgid "%serror list %d of %d; %d errors " +msgstr "%svirhelista %d/%d, %d virhettä" + msgid "E380: At bottom of quickfix stack" msgstr "E380: quickfix-pinon pohjalla" -#: ../quickfix.c:1869 msgid "E381: At top of quickfix stack" msgstr "E381: quickfix-pinon huipulla" -#: ../quickfix.c:1880 -#, c-format -msgid "error list %d of %d; %d errors" -msgstr "virhelista %d/%d, %d virhett" +msgid "No entries" +msgstr "Ei kenttiä" -#: ../quickfix.c:2427 msgid "E382: Cannot write, 'buftype' option is set" msgstr "E382: Ei voi kirjoittaa, buftype asetettu" -#: ../quickfix.c:2812 msgid "E683: File name missing or invalid pattern" msgstr "E683: Tiedostonimi puuttuu tai kuvio on viallinen" -#: ../quickfix.c:2911 #, c-format msgid "Cannot open file \"%s\"" msgstr "Tiedostoa %s ei voi avata" -#: ../quickfix.c:3429 msgid "E681: Buffer is not loaded" msgstr "E681: Puskuria ei ole ladattu" -#: ../quickfix.c:3487 msgid "E777: String or List expected" -msgstr "E777: Pit olla merkkijono tai lista" +msgstr "E777: Pitää olla merkkijono tai lista" -#: ../regexp.c:359 #, c-format msgid "E369: invalid item in %s%%[]" msgstr "E369: virheellinen olio kohdassa %s%%[]" -#: ../regexp.c:374 #, c-format msgid "E769: Missing ] after %s[" -msgstr "E769: ] puuttuu merkinnn %s[ jljest" +msgstr "E769: ] puuttuu merkinnän %s[ jäljestä" -#: ../regexp.c:375 #, c-format msgid "E53: Unmatched %s%%(" msgstr "E53: Pariton %s%%(" -#: ../regexp.c:376 #, c-format msgid "E54: Unmatched %s(" msgstr "E54: Pariton %s(" -#: ../regexp.c:377 #, c-format msgid "E55: Unmatched %s)" msgstr "E55: Pariton %s)" -#: ../regexp.c:378 msgid "E66: \\z( not allowed here" -msgstr "E66: \\z( ei ole sallittu tss" +msgstr "E66: \\z( ei ole sallittu tässä" -#: ../regexp.c:379 msgid "E67: \\z1 et al. not allowed here" -msgstr "E67: \\z1 jne. ei ole sallittu tss" +msgstr "E67: \\z1 jne. ei ole sallittu tässä" -#: ../regexp.c:380 #, c-format msgid "E69: Missing ] after %s%%[" -msgstr "E69: ] puuttuu merkinnn %s%%[ jljest" +msgstr "E69: ] puuttuu merkinnän %s%%[ jäljestä" -#: ../regexp.c:381 #, c-format msgid "E70: Empty %s%%[]" -msgstr "E70: Tyhj %s%%[]" +msgstr "E70: Tyhjä %s%%[]" -#: ../regexp.c:1209 ../regexp.c:1224 msgid "E339: Pattern too long" -msgstr "E339: Liian pitk kuvio" +msgstr "E339: Liian pitkä kuvio" -#: ../regexp.c:1371 msgid "E50: Too many \\z(" -msgstr "E50: Liikaa merkkej \\z(" +msgstr "E50: Liikaa merkkejä \\z(" -#: ../regexp.c:1378 #, c-format msgid "E51: Too many %s(" -msgstr "E51: Liikaa merkkej %s(" +msgstr "E51: Liikaa merkkejä %s(" -#: ../regexp.c:1427 msgid "E52: Unmatched \\z(" msgstr "E52: Pariton \\z(" -#: ../regexp.c:1637 #, c-format msgid "E59: invalid character after %s@" -msgstr "E59: virheellinen merkki kohdan %s@ jlkeen" +msgstr "E59: virheellinen merkki kohdan %s@ jälkeen" -#: ../regexp.c:1672 #, c-format msgid "E60: Too many complex %s{...}s" msgstr "E60: Liikaa monimutkaisia ilmauksia %s{...}s" -#: ../regexp.c:1687 #, c-format msgid "E61: Nested %s*" -msgstr "E61: Siskkistetty %s*" +msgstr "E61: Sisäkkäistetty %s*" -#: ../regexp.c:1690 #, c-format msgid "E62: Nested %s%c" -msgstr "E62: Siskkistetty %s%c" +msgstr "E62: Sisäkkäistetty %s%c" -#: ../regexp.c:1800 msgid "E63: invalid use of \\_" -msgstr "E63: vrinkytetty \\_" +msgstr "E63: väärinkäytetty \\_" -#: ../regexp.c:1850 #, c-format msgid "E64: %s%c follows nothing" -msgstr "E64: %s%c jlkeen ei minkn" +msgstr "E64: %s%c jälkeen ei minkään" -#: ../regexp.c:1902 msgid "E65: Illegal back reference" -msgstr "E65: Virheellinen tsmysviittaus" +msgstr "E65: Virheellinen täsmäysviittaus" -#: ../regexp.c:1943 msgid "E68: Invalid character after \\z" -msgstr "E68: Virheellinen merkki ilmauksen \\z jlkeen" +msgstr "E68: Virheellinen merkki ilmauksen \\z jälkeen" -#: ../regexp.c:2049 ../regexp_nfa.c:1296 #, c-format msgid "E678: Invalid character after %s%%[dxouU]" -msgstr "E678: Virheellinen merkki merkinnn %s%%[dxouU] jljess" +msgstr "E678: Virheellinen merkki merkinnän %s%%[dxouU] jäljessä" -#: ../regexp.c:2107 #, c-format msgid "E71: Invalid character after %s%%" -msgstr "E71: Virheellinen merkki merkinnn %s%% jljess" +msgstr "E71: Virheellinen merkki merkinnän %s%% jäljessä" + +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA-säänn. ilmaus) ei voi toistaa kohdetta %s" -#: ../regexp.c:3017 #, c-format msgid "E554: Syntax error in %s{...}" msgstr "E554: Syntaksivirhe ilmauksessa %s{...}" -#: ../regexp.c:3805 msgid "External submatches:\n" -msgstr "Ulkoisia alitsmyksi:\n" +msgstr "Ulkoisia alitäsmäyksiä:\n" -#: ../regexp.c:7022 msgid "" "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " "used " msgstr "" +"E864: \\%#=-merkkien perään voi tulla vain 0, 1 tai 2. Käytetään " +"automaattista engineä " -#: ../regexp_nfa.c:239 -msgid "E865: (NFA) Regexp end encountered prematurely" -msgstr "" - -#: ../regexp_nfa.c:240 -#, c-format -msgid "E866: (NFA regexp) Misplaced %c" -msgstr "" - -#: ../regexp_nfa.c:242 -#, c-format -msgid "E877: (NFA regexp) Invalid character class: %" -msgstr "" - -#: ../regexp_nfa.c:1261 -#, c-format -msgid "E867: (NFA) Unknown operator '\\z%c'" -msgstr "" - -#: ../regexp_nfa.c:1387 -#, c-format -msgid "E867: (NFA) Unknown operator '\\%%%c'" -msgstr "" - -#: ../regexp_nfa.c:1802 -#, c-format -msgid "E869: (NFA) Unknown operator '\\@%c'" -msgstr "" - -#: ../regexp_nfa.c:1831 -msgid "E870: (NFA regexp) Error reading repetition limits" -msgstr "" - -#. Can't have a multi follow a multi. -#: ../regexp_nfa.c:1895 -msgid "E871: (NFA regexp) Can't have a multi follow a multi !" -msgstr "" - -#. Too many `(' -#: ../regexp_nfa.c:2037 -msgid "E872: (NFA regexp) Too many '('" -msgstr "" - -#: ../regexp_nfa.c:2042 -#, fuzzy -msgid "E879: (NFA regexp) Too many \\z(" -msgstr "E50: Liikaa merkkej \\z(" - -#: ../regexp_nfa.c:2066 -msgid "E873: (NFA regexp) proper termination error" -msgstr "" - -#: ../regexp_nfa.c:2599 -msgid "E874: (NFA) Could not pop the stack !" -msgstr "" - -#: ../regexp_nfa.c:3298 -msgid "" -"E875: (NFA regexp) (While converting from postfix to NFA), too many states " -"left on stack" -msgstr "" - -#: ../regexp_nfa.c:3302 -msgid "E876: (NFA regexp) Not enough space to store the whole NFA " -msgstr "" - -#: ../regexp_nfa.c:4571 ../regexp_nfa.c:4869 -msgid "" -"Could not open temporary log file for writing, displaying on stderr ... " -msgstr "" - -#: ../regexp_nfa.c:4840 -#, c-format -msgid "(NFA) COULD NOT OPEN %s !" -msgstr "" +msgid "Switching to backtracking RE engine for pattern: " +msgstr "Vaihdetaan käyttämään backtrackkaavaa RE-engineä ilmaukselle: " -#: ../regexp_nfa.c:6049 -#, fuzzy -msgid "Could not open temporary log file for writing " -msgstr "E828: Kumoustiedoston avaus kirjoittamista varten ei onnistu: %s" +#~ msgid " TERMINAL" +#~ msgstr "" # tiloja -#: ../screen.c:7435 msgid " VREPLACE" msgstr " VKORVAUS" -#: ../screen.c:7437 msgid " REPLACE" msgstr " KORVAUS" -#: ../screen.c:7440 msgid " REVERSE" -msgstr " KNTEIS" +msgstr " KÄÄNTEIS" -#: ../screen.c:7441 msgid " INSERT" -msgstr " SYTT" +msgstr " SYÖTTÖ" -#: ../screen.c:7443 msgid " (insert)" -msgstr " (sytt)" +msgstr " (syöttö)" -#: ../screen.c:7445 msgid " (replace)" msgstr " (korvaus)" -#: ../screen.c:7447 msgid " (vreplace)" msgstr " (vkorvaus)" -#: ../screen.c:7449 msgid " Hebrew" msgstr " Heprea" -#: ../screen.c:7454 msgid " Arabic" msgstr " Arabia" -#: ../screen.c:7456 -msgid " (lang)" -msgstr " (kieli)" - -#: ../screen.c:7459 msgid " (paste)" msgstr " (liitos)" -#: ../screen.c:7469 msgid " VISUAL" msgstr " VALINTA" -#: ../screen.c:7470 msgid " VISUAL LINE" msgstr " VALINTARIVI" -#: ../screen.c:7471 msgid " VISUAL BLOCK" msgstr " VALINTALOHKO" -#: ../screen.c:7472 msgid " SELECT" msgstr " WALINTA" -#: ../screen.c:7473 msgid " SELECT LINE" msgstr " WALINTARIVI" -#: ../screen.c:7474 msgid " SELECT BLOCK" msgstr " WALINTALOHKO" -#: ../screen.c:7486 ../screen.c:7541 msgid "recording" msgstr "tallennetaan" -#: ../search.c:487 #, c-format msgid "E383: Invalid search string: %s" msgstr "E383: Viallinen hakujono: %s" -#: ../search.c:832 #, c-format msgid "E384: search hit TOP without match for: %s" -msgstr "E384: Haku psi alkuun lytmtt jonoa: %s" +msgstr "E384: Haku pääsi alkuun löytämättä jonoa: %s" -#: ../search.c:835 #, c-format msgid "E385: search hit BOTTOM without match for: %s" -msgstr "E385: Haku psi loppuun lytmtt jonoa: %s" +msgstr "E385: Haku pääsi loppuun löytämättä jonoa: %s" -#: ../search.c:1200 msgid "E386: Expected '?' or '/' after ';'" -msgstr "E386: ;:n jlkeen pit olla ? tai /" +msgstr "E386: ;:n jälkeen pitää olla ? tai /" -#: ../search.c:4085 msgid " (includes previously listed match)" -msgstr " (sislt viimeksi luetellun tsmyksen)" +msgstr " (sisältää viimeksi luetellun täsmäyksen)" #. cursor at status line -#: ../search.c:4104 msgid "--- Included files " -msgstr "--- Sisllytetyt tiedostot " +msgstr "--- Sisällytetyt tiedostot " -#: ../search.c:4106 msgid "not found " -msgstr "ei lytynyt " +msgstr "ei löytynyt " -#: ../search.c:4107 msgid "in path ---\n" msgstr "polusta ---\n" -#: ../search.c:4168 msgid " (Already listed)" msgstr " (Jo lueteltu)" -#: ../search.c:4170 msgid " NOT FOUND" -msgstr " EI LYTYNYT" +msgstr " EI LÖYTYNYT" -#: ../search.c:4211 #, c-format msgid "Scanning included file: %s" -msgstr "Haku sislsi tiedoston: %s" +msgstr "Haku sisälsi tiedoston: %s" -#: ../search.c:4216 #, c-format msgid "Searching included file %s" -msgstr "Haku sislsi tiedoston %s" +msgstr "Haku sisälsi tiedoston %s" -#: ../search.c:4405 msgid "E387: Match is on current line" -msgstr "E387: Tsmys tll rivill" +msgstr "E387: Täsmäys tällä rivillä" -#: ../search.c:4517 msgid "All included files were found" -msgstr "Kaikki sisllytetyt rivit lytyivt" +msgstr "Kaikki sisällytetyt rivit löytyivät" -#: ../search.c:4519 msgid "No included files" -msgstr "Ei sisllytettyj tiedostoja" +msgstr "Ei sisällytettyjä tiedostoja" -#: ../search.c:4527 msgid "E388: Couldn't find definition" -msgstr "E388: Mritelm ei lydy" +msgstr "E388: Määritelmä ei löydy" -#: ../search.c:4529 msgid "E389: Couldn't find pattern" -msgstr "E389: kuvio ei lydy" +msgstr "E389: kuvio ei löydy" -#: ../search.c:4668 -msgid "Substitute " -msgstr "Korvaa " - -#: ../search.c:4681 -#, c-format -msgid "" -"\n" -"# Last %sSearch Pattern:\n" -"~" -msgstr "" -"\n" -"# Edellinen %sHakulauseke:\n" -"~" - -#: ../spell.c:951 -msgid "E759: Format error in spell file" -msgstr "E759: Muotoiluvirhe oikolukutiedostossa" +#~ msgid "too few bytes read" +#~ msgstr "" -#: ../spell.c:952 -msgid "E758: Truncated spell file" -msgstr "E758: Oikolukutiedosto katkaistu" +#, fuzzy, c-format +#~ msgid "System error while skipping in ShaDa file: %s" +#~ msgstr "E782: virhe luettaessa .sug-tiedostoa: %s" -#: ../spell.c:953 #, c-format -msgid "Trailing text in %s line %d: %s" -msgstr "Teksti rivin perss tiedostossa %s rivill %d: %s" +#~ msgid "" +#~ "Error while reading ShaDa file: last entry specified that it occupies " +#~ "% bytes, but file ended earlier" +#~ msgstr "" -#: ../spell.c:954 -#, c-format -msgid "Affix name too long in %s line %d: %s" -msgstr "Affiksin nimi on liian pitk tiedostossa %s rivill %d: %s" +#, fuzzy, c-format +#~ msgid "System error while closing ShaDa file: %s" +#~ msgstr "E782: virhe luettaessa .sug-tiedostoa: %s" -#: ../spell.c:955 -msgid "E761: Format error in affix file FOL, LOW or UPP" -msgstr "E761: Affiksitiedoston FOL-, LOW- tai UPP-muotovirhe " +#, fuzzy, c-format +#~ msgid "System error while writing ShaDa file: %s" +#~ msgstr "E782: virhe luettaessa .sug-tiedostoa: %s" -#: ../spell.c:957 -msgid "E762: Character in FOL, LOW or UPP is out of range" -msgstr "E762: Merkki FOL:ss, LOW:ss tai UPP:ss ei kuulu arvoalueeseen" +#, fuzzy, c-format +#~ msgid "Reading ShaDa file \"%s\"%s%s%s" +#~ msgstr "Luetaan viminfo-tiedostoa \"%s\"%s%s%s" -#: ../spell.c:958 -msgid "Compressing word tree..." -msgstr "Tiivistetn sanapuuta..." +msgid " info" +msgstr " info" -#: ../spell.c:1951 -msgid "E756: Spell checking is not enabled" -msgstr "E756: Oikaisuluku ei ole pll" +msgid " marks" +msgstr " merkit" -#: ../spell.c:2249 -#, c-format -msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" -msgstr "Varoitus: Ei lydetty sanalistaa %s.%s.spl tai %s.ascii.spl" +msgid " oldfiles" +msgstr " vanhaatiedostoa" -#: ../spell.c:2473 -#, c-format -msgid "Reading spell file \"%s\"" -msgstr "Luetaan oikaisulukutiedosta %s" +msgid " FAILED" +msgstr " EPÄONNISTUI" -#: ../spell.c:2496 -msgid "E757: This does not look like a spell file" -msgstr "E757: Ei vaikuta oikaisulukutiedostolta" +#, c-format +#~ msgid "System error while opening ShaDa file %s for reading: %s" +#~ msgstr "" -#: ../spell.c:2501 -msgid "E771: Old spell file, needs to be updated" -msgstr "E771: Vanha oikaisulukutiedosto vaatii pivittmist" +#~ msgid "additional elements of ShaDa " +#~ msgstr "" -#: ../spell.c:2504 -msgid "E772: Spell file is for newer version of Vim" -msgstr "E772: Oikaisulukutiedosto on uudemmalle Vimille" +#~ msgid "additional data of ShaDa " +#~ msgstr "" -#: ../spell.c:2602 -msgid "E770: Unsupported section in spell file" -msgstr "E770: Tukematon osio oikaisulukutiedostossa" +#, fuzzy, c-format +#~ msgid "Failed to write variable %s" +#~ msgstr "ei voitu vaihtaa puskuriin %d" -#: ../spell.c:3762 #, c-format -msgid "Warning: region %s not supported" -msgstr "Varoitus: osaa %s ei tueta" +#~ msgid "" +#~ "Failed to parse ShaDa file due to a msgpack parser error at position " +#~ "%" +#~ msgstr "" -#: ../spell.c:4550 #, c-format -msgid "Reading affix file %s ..." -msgstr "Luetaan affiksitiedostoa %s..." +#~ msgid "" +#~ "Failed to parse ShaDa file: incomplete msgpack string at position %" +#~ msgstr "" -#: ../spell.c:4589 ../spell.c:5635 ../spell.c:6140 #, c-format -msgid "Conversion failure for word in %s line %d: %s" -msgstr "Muunnosvirhe sanalle %s rivill %d: %s" +#~ msgid "" +#~ "Failed to parse ShaDa file: extra bytes in msgpack string at position " +#~ "%" +#~ msgstr "" -#: ../spell.c:4630 ../spell.c:6170 #, c-format -msgid "Conversion in %s not supported: from %s to %s" -msgstr "Muunnosta kohteessa %s ei tueta: kohteesta %s kohteeseen %s" +#~ msgid "" +#~ "System error while opening ShaDa file %s for reading to merge before writing " +#~ "it: %s" +#~ msgstr "" -#: ../spell.c:4642 +#. Tried names from .tmp.a to .tmp.z, all failed. Something must be +#. wrong then. #, c-format -msgid "Invalid value for FLAG in %s line %d: %s" -msgstr "Tuntematon FLAG kohteessa %s rivill %d: %s" +#~ msgid "E138: All %s.tmp.X files exist, cannot write ShaDa file!" +#~ msgstr "" -#: ../spell.c:4655 -#, c-format -msgid "FLAG after using flags in %s line %d: %s" -msgstr "FLAG kohteessa %s lippujen jlkeen rivill %d: %s" +#, fuzzy, c-format +#~ msgid "System error while opening temporary ShaDa file %s for writing: %s" +#~ msgstr "Väliaikaislokitiedoston avaus kirjoittamista varten ei onnistu" -#: ../spell.c:4723 #, c-format -msgid "" -"Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line " -"%d" -msgstr "" -"COMPOUNDFORBIDFLAG PFX:n jlkeen voi antaa vri tuloksia kohteessa %s " -"rivill %d" +#~ msgid "Failed to create directory %s for writing ShaDa file: %s" +#~ msgstr "" -#: ../spell.c:4731 #, c-format -msgid "" -"Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line " -"%d" -msgstr "" -"COMPOUNDPERMITFLAG PFX:n jlkeen voi antaa vri tuloksia kohteessa %s " -"rivill %d" +#~ msgid "System error while opening ShaDa file %s for writing: %s" +#~ msgstr "" -#: ../spell.c:4747 -#, c-format -msgid "Wrong COMPOUNDRULES value in %s line %d: %s" -msgstr "Vr COMPOUNDRULES-arvo kohteessa %s rivill %d: %s" +#, fuzzy, c-format +#~ msgid "Writing ShaDa file \"%s\"" +#~ msgstr "Kirjoitetaan viminfo-tiedostoa %s" -#: ../spell.c:4771 -#, c-format -msgid "Wrong COMPOUNDWORDMAX value in %s line %d: %s" -msgstr "Vr COMPOUNDWORDMAX-arvo kohteessa %s rivill %d: %s" +#, fuzzy, c-format +#~ msgid "Failed setting uid and gid for file %s: %s" +#~ msgstr "Ladattu kumoustiedoto %s" -#: ../spell.c:4777 -#, c-format -msgid "Wrong COMPOUNDMIN value in %s line %d: %s" -msgstr "Vr COMPOUNDMIN-arvo kohteessa %s rivill %d: %s" +#, fuzzy, c-format +#~ msgid "E137: ShaDa file is not writable: %s" +#~ msgstr "E137: Viminfo-tiedostoon ei voitu kirjoittaa: %s" -#: ../spell.c:4783 -#, c-format -msgid "Wrong COMPOUNDSYLMAX value in %s line %d: %s" -msgstr "Vr COMPOUNDSYLMAX-arvo kohteessa %s rivill %d: %s" +#, fuzzy, c-format +#~ msgid "Can't rename ShaDa file from %s to %s!" +#~ msgstr "E886: Viminfo-tiedostoa ei voit uudelleennimetä nimelle %s" -#: ../spell.c:4795 -#, c-format -msgid "Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s" -msgstr "Vr CHECKCOMPOUNDPATTERN-arvo kohteessa %s rivill %d: %s" +#, fuzzy, c-format +#~ msgid "Did not rename %s because %s does not looks like a ShaDa file" +#~ msgstr " [ei näytä Vimin swap-tiedostolta]" -#: ../spell.c:4847 #, c-format -msgid "Different combining flag in continued affix block in %s line %d: %s" -msgstr "" -"Eri yhdistelmlippu jatketussa affiksilohkossa kohteessa %s rivill %d: %s" +#~ msgid "Did not rename %s to %s because there were errors during writing it" +#~ msgstr "" -#: ../spell.c:4850 #, c-format -msgid "Duplicate affix in %s line %d: %s" -msgstr "Kaksoiskappale affiksista kohteessa %s rivill %d: %s" +#~ msgid "Do not forget to remove %s or rename it manually to %s." +#~ msgstr "" -#: ../spell.c:4871 -#, c-format -msgid "" -"Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in %s " -"line %d: %s" -msgstr "" -"Affiksia kytetty mys BAD-, RARE-, KEEPCASE-, NEEDAFFIX-, NEEDCOMPOUND- tai " -"NOSUGGEST-arvossa kohteessa %s rivill %d: %s" +#, fuzzy, c-format +#~ msgid "System error while reading ShaDa file: %s" +#~ msgstr "E782: virhe luettaessa .sug-tiedostoa: %s" + +#, fuzzy, c-format +#~ msgid "System error while reading integer from ShaDa file: %s" +#~ msgstr "E782: virhe luettaessa .sug-tiedostoa: %s" -#: ../spell.c:4893 #, c-format -msgid "Expected Y or N in %s line %d: %s" -msgstr "Odotettiin Y:t tai N: kohteessa %s rivill %d: %s" +#~ msgid "" +#~ "Error while reading ShaDa file: expected positive integer at position " +#~ "%, but got nothing" +#~ msgstr "" -#: ../spell.c:4968 #, c-format -msgid "Broken condition in %s line %d: %s" -msgstr "Viallinen ehto kohteessa %s rivill %d: %s" +#~ msgid "" +#~ "Error while reading ShaDa file: expected positive integer at position " +#~ "%" +#~ msgstr "" -#: ../spell.c:5091 +#. kSDItemUnknown cannot possibly pass that far because it is -1 and that +#. will fail in msgpack_read_uint64. But kSDItemMissing may and it will +#. otherwise be skipped because (1 << 0) will never appear in flags. #, c-format -msgid "Expected REP(SAL) count in %s line %d" -msgstr "Odotettiin REP(SAL)-arvoa kohteessa %s rivill %d" +#~ msgid "" +#~ "Error while reading ShaDa file: there is an item at position % that " +#~ "must not be there: Missing items are for internal uses only" +#~ msgstr "" -#: ../spell.c:5120 #, c-format -msgid "Expected MAP count in %s line %d" -msgstr "Odotettiin MAP-arvoa kohteessa %s rivill %d" +#~ msgid "" +#~ "Error while reading ShaDa file: buffer list at position % contains " +#~ "entry that is not a dictionary" +#~ msgstr "" -#: ../spell.c:5132 #, c-format -msgid "Duplicate character in MAP in %s line %d" -msgstr "Kaksoiskappale merkist MAP:ss kohteessa %s rivill %d" +#~ msgid "" +#~ "Error while reading ShaDa file: buffer list at position % contains " +#~ "entry with invalid line number" +#~ msgstr "" + +#, c-format +#~ msgid "" +#~ "Error while reading ShaDa file: buffer list at position % contains " +#~ "entry with invalid column number" +#~ msgstr "" + +#, c-format +#~ msgid "" +#~ "Error while reading ShaDa file: buffer list at position % contains " +#~ "entry that does not have a file name" +#~ msgstr "" + +#. values for ts_isdiff +#. no different byte (yet) +#. different byte found +#. inserting character +#. values for ts_flags +#. already checked that prefix is OK +#. tried split at this point +#. did a delete, "ts_delidx" has index +#. special values ts_prefixdepth +#. not using prefixes +#. walking through the prefix tree +#. highest value that's not special +#. mode values for find_word +#. find word case-folded +#. find keep-case word +#. find word after prefix +#. find case-folded compound word +#. find keep-case compound word +#, fuzzy +#~ msgid "E759: Format error in spell file" +#~ msgstr "E297: Kirjoitusvirhe swap-tiedostossa" + +msgid "E756: Spell checking is not enabled" +msgstr "E756: Oikaisuluku ei ole päällä" + +#, c-format +msgid "Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\"" +msgstr "Varoitus: Ei löydetty sanalistaa %s.%s.spl tai %s.ascii.spl" + +#. This is probably an error. Give a warning and +#. accept the words anyway. +#, c-format +msgid "Warning: region %s not supported" +msgstr "Varoitus: osaa %s ei tueta" + +msgid "Sorry, no suggestions" +msgstr "ei ehdotuksia" + +#, fuzzy, c-format +#~ msgid "Sorry, only % suggestions" +#~ msgstr "vain %ld ehdotusta" + +#. for when 'cmdheight' > 1 +#. avoid more prompt +#, c-format +msgid "Change \"%.*s\" to:" +msgstr "Muuta %.*s:" + +#, c-format +msgid " < \"%.*s\"" +msgstr " < %.*s" + +msgid "E752: No previous spell replacement" +msgstr "E752: Ei edellistä oikaisulukukorjausta" + +#, c-format +msgid "E753: Not found: %s" +msgstr "E753: Ei löytynyt: %s" + +msgid "E758: Truncated spell file" +msgstr "E758: Oikolukutiedosto katkaistu" + +#, c-format +msgid "Trailing text in %s line %d: %s" +msgstr "Tekstiä rivin perässä tiedostossa %s rivillä %d: %s" + +#, c-format +msgid "Affix name too long in %s line %d: %s" +msgstr "Affiksin nimi on liian pitkä tiedostossa %s rivillä %d: %s" + +msgid "E761: Format error in affix file FOL, LOW or UPP" +msgstr "E761: Affiksitiedoston FOL-, LOW- tai UPP-muotovirhe " + +msgid "E762: Character in FOL, LOW or UPP is out of range" +msgstr "E762: Merkki FOL:ssä, LOW:ssä tai UPP:ssä ei kuulu arvoalueeseen" + +msgid "Compressing word tree..." +msgstr "Tiivistetään sanapuuta..." + +#, c-format +msgid "Reading spell file \"%s\"" +msgstr "Luetaan oikaisulukutiedosta %s" + +msgid "E757: This does not look like a spell file" +msgstr "E757: Ei vaikuta oikaisulukutiedostolta" + +#, fuzzy, c-format +#~ msgid "E5042: Failed to read spell file %s: %s" +#~ msgstr "E482: Tiedostoa %s ei voi luoda" + +msgid "E771: Old spell file, needs to be updated" +msgstr "E771: Vanha oikaisulukutiedosto vaatii päivittämistä" + +msgid "E772: Spell file is for newer version of Vim" +msgstr "E772: Oikaisulukutiedosto on uudemmalle Vimille" + +msgid "E770: Unsupported section in spell file" +msgstr "E770: Tukematon osio oikaisulukutiedostossa" + +#, c-format +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: Ei vaikuta .sug-tiedostolta: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: Vanha .sug-tiedosto pitää päivittää: %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: .sug-tiedosto on uudemmalle Vimille: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: .sug-tiedosto ei täsmää .spl-tiedostoon: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: virhe luettaessa .sug-tiedostoa: %s" + +#, c-format +msgid "Reading affix file %s ..." +msgstr "Luetaan affiksitiedostoa %s..." + +#, c-format +msgid "Conversion failure for word in %s line %d: %s" +msgstr "Muunnosvirhe sanalle %s rivillä %d: %s" + +#, c-format +msgid "Conversion in %s not supported: from %s to %s" +msgstr "Muunnosta kohteessa %s ei tueta: kohteesta %s kohteeseen %s" + +#, c-format +msgid "Invalid value for FLAG in %s line %d: %s" +msgstr "Tuntematon FLAG kohteessa %s rivillä %d: %s" + +#, c-format +msgid "FLAG after using flags in %s line %d: %s" +msgstr "FLAG kohteessa %s lippujen jälkeen rivillä %d: %s" + +#, c-format +msgid "" +"Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line " +"%d" +msgstr "" +"COMPOUNDFORBIDFLAG PFX:n jälkeen voi antaa vääriä tuloksia kohteessa %s " +"rivillä %d" + +#, c-format +msgid "" +"Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line " +"%d" +msgstr "" +"COMPOUNDPERMITFLAG PFX:n jälkeen voi antaa vääriä tuloksia kohteessa %s " +"rivillä %d" + +#, c-format +msgid "Wrong COMPOUNDRULES value in %s line %d: %s" +msgstr "Väärä COMPOUNDRULES-arvo kohteessa %s rivillä %d: %s" + +#, c-format +msgid "Wrong COMPOUNDWORDMAX value in %s line %d: %s" +msgstr "Väärä COMPOUNDWORDMAX-arvo kohteessa %s rivillä %d: %s" + +#, c-format +msgid "Wrong COMPOUNDMIN value in %s line %d: %s" +msgstr "Väärä COMPOUNDMIN-arvo kohteessa %s rivillä %d: %s" + +#, c-format +msgid "Wrong COMPOUNDSYLMAX value in %s line %d: %s" +msgstr "Väärä COMPOUNDSYLMAX-arvo kohteessa %s rivillä %d: %s" + +#, c-format +msgid "Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s" +msgstr "Väärä CHECKCOMPOUNDPATTERN-arvo kohteessa %s rivillä %d: %s" + +#, c-format +msgid "Different combining flag in continued affix block in %s line %d: %s" +msgstr "" +"Eri yhdistelmälippu jatketussa affiksilohkossa kohteessa %s rivillä %d: %s" + +#, c-format +msgid "Duplicate affix in %s line %d: %s" +msgstr "Kaksoiskappale affiksista kohteessa %s rivillä %d: %s" + +#, fuzzy, c-format +msgid "" +"Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGESTin %s " +"line %d: %s" +msgstr "" +"Affiksia käytetty myös BAD-, RARE-, KEEPCASE-, NEEDAFFIX-, NEEDCOMPOUND- tai " +"NOSUGGEST-arvossa kohteessa %s rivillä %d: %s" + +#, c-format +msgid "Expected Y or N in %s line %d: %s" +msgstr "Odotettiin Y:tä tai N:ää kohteessa %s rivillä %d: %s" + +#, c-format +msgid "Broken condition in %s line %d: %s" +msgstr "Viallinen ehto kohteessa %s rivillä %d: %s" + +#, c-format +msgid "Expected REP(SAL) count in %s line %d" +msgstr "Odotettiin REP(SAL)-arvoa kohteessa %s rivillä %d" + +#, c-format +msgid "Expected MAP count in %s line %d" +msgstr "Odotettiin MAP-arvoa kohteessa %s rivillä %d" + +#, c-format +msgid "Duplicate character in MAP in %s line %d" +msgstr "Kaksoiskappale merkistä MAP:ssä kohteessa %s rivillä %d" -#: ../spell.c:5176 #, c-format msgid "Unrecognized or duplicate item in %s line %d: %s" -msgstr "Tunnistamaton tai kaksoiskappale arvosta kohteessa %s rivill %d: %s" +msgstr "Tunnistamaton tai kaksoiskappale arvosta kohteessa %s rivillä %d: %s" -#: ../spell.c:5197 #, c-format msgid "Missing FOL/LOW/UPP line in %s" msgstr "Puuttuva FOL, LOW tai UPP rivi kohteessa %s" -#: ../spell.c:5220 msgid "COMPOUNDSYLMAX used without SYLLABLE" msgstr "COMPOUNDSYLMAX ilman SYLLABLEa" -#: ../spell.c:5236 msgid "Too many postponed prefixes" -msgstr "Liikaa jlkikteistettyj prefiksej" +msgstr "Liikaa jälkikäteistettyjä prefiksejä" -#: ../spell.c:5238 msgid "Too many compound flags" msgstr "Liikaa yhdyssanalippuja" -#: ../spell.c:5240 msgid "Too many postponed prefixes and/or compound flags" -msgstr "Liikaa jlkikteistettyj prefiksej tai yhdyssanalippuja" +msgstr "Liikaa jälkikäteistettyjä prefiksejä tai yhdyssanalippuja" -#: ../spell.c:5250 #, c-format msgid "Missing SOFO%s line in %s" msgstr "Puuttuva SOFO%s-rivi kohteessa %s" -#: ../spell.c:5253 #, c-format msgid "Both SAL and SOFO lines in %s" msgstr "SAL- ja SOFO-rivit kohteessa %s" -#: ../spell.c:5331 #, c-format msgid "Flag is not a number in %s line %d: %s" -msgstr "Lippu ei ole lukuarvo kohteessa %s rivill %d: %s" +msgstr "Lippu ei ole lukuarvo kohteessa %s rivillä %d: %s" -#: ../spell.c:5334 #, c-format msgid "Illegal flag in %s line %d: %s" -msgstr "Tuntematon lippu kohteessa %s rivill %d: %s" +msgstr "Tuntematon lippu kohteessa %s rivillä %d: %s" -#: ../spell.c:5493 ../spell.c:5501 #, c-format msgid "%s value differs from what is used in another .aff file" msgstr "%s-arvo eroaa toisessa .aff-tiedostossa olevasta" -#: ../spell.c:5602 #, c-format msgid "Reading dictionary file %s ..." msgstr "Luetaan sanakirjatiedostoa %s" -#: ../spell.c:5611 #, c-format msgid "E760: No word count in %s" msgstr "E760: Ei sanalaskuria kohteessa %s" -#: ../spell.c:5669 #, c-format msgid "line %6d, word %6d - %s" msgstr "rivi %6d, sana %6d - %s" -#: ../spell.c:5691 #, c-format msgid "Duplicate word in %s line %d: %s" -msgstr "Toistettu sana kohteessa %s rivill %d: %s" +msgstr "Toistettu sana kohteessa %s rivillä %d: %s" -#: ../spell.c:5694 #, c-format msgid "First duplicate word in %s line %d: %s" -msgstr "Ensimminen kappale kohteessa %s rivill %d: %s" +msgstr "Ensimmäinen kappale kohteessa %s rivillä %d: %s" -#: ../spell.c:5746 #, c-format msgid "%d duplicate word(s) in %s" msgstr "toistettuja sanoja %d kohteessa %s" -#: ../spell.c:5748 #, c-format msgid "Ignored %d word(s) with non-ASCII characters in %s" msgstr "Ei-ASCII-merkkien takia ohitettuja sanoja %d kohteessa %s" -#: ../spell.c:6115 #, c-format msgid "Reading word file %s ..." msgstr "Luetaan sanatiedostoa %s..." -#: ../spell.c:6155 #, c-format msgid "Duplicate /encoding= line ignored in %s line %d: %s" -msgstr "Toistettu /encoding= ohitettu kohteessa %s rivill %d: %s" +msgstr "Toistettu /encoding= ohitettu kohteessa %s rivillä %d: %s" -#: ../spell.c:6159 #, c-format msgid "/encoding= line after word ignored in %s line %d: %s" -msgstr "/encoding= sanojen jlkeen ohitettu kohteessa %s rivill %d: %s" +msgstr "/encoding= sanojen jälkeen ohitettu kohteessa %s rivillä %d: %s" -#: ../spell.c:6180 #, c-format msgid "Duplicate /regions= line ignored in %s line %d: %s" -msgstr "Toistettu /regions= ohitettu kohteessa %s rivill %d: %s" +msgstr "Toistettu /regions= ohitettu kohteessa %s rivillä %d: %s" -#: ../spell.c:6185 #, c-format msgid "Too many regions in %s line %d: %s" -msgstr "Liikaa regionseja kohteessa %s rivill %d: %s" +msgstr "Liikaa regionseja kohteessa %s rivillä %d: %s" -#: ../spell.c:6198 #, c-format msgid "/ line ignored in %s line %d: %s" -msgstr "/ ohitettu kohteessa %s rivill %d: %s" +msgstr "/ ohitettu kohteessa %s rivillä %d: %s" -#: ../spell.c:6224 #, c-format msgid "Invalid region nr in %s line %d: %s" -msgstr "Virheellinen region-luku kohteessa %s rivill %d: %s" +msgstr "Virheellinen region-luku kohteessa %s rivillä %d: %s" -#: ../spell.c:6230 #, c-format msgid "Unrecognized flags in %s line %d: %s" -msgstr "Tunnistamaton lippu kohteessa %s rivill %d: %s" +msgstr "Tunnistamaton lippu kohteessa %s rivillä %d: %s" -#: ../spell.c:6257 #, c-format msgid "Ignored %d words with non-ASCII characters" msgstr "Ei-ASCIIn takia ohitettuja sanoja %d" -#: ../spell.c:6656 #, c-format msgid "Compressed %d of %d nodes; %d (%d%%) remaining" -msgstr "Tiivistetty %d/%d noodia. %d (%d %%) jljell" +msgstr "Tiivistetty %d/%d noodia. %d (%d %%) jäljellä" -#: ../spell.c:7340 msgid "Reading back spell file..." msgstr "Luetaan taas oikaisulukutiedostoa..." #. Go through the trie of good words, soundfold each word and add it to #. the soundfold trie. -#: ../spell.c:7357 msgid "Performing soundfolding..." -msgstr "ntmyksen mukaan yhdistelln..." +msgstr "Ääntämyksen mukaan yhdistellään..." -#: ../spell.c:7368 -#, c-format -msgid "Number of words after soundfolding: %" -msgstr "Sanoja ntmysyhdistelyn jlkeen: %" +#, fuzzy, c-format +#~ msgid "Number of words after soundfolding: %" +#~ msgstr "Sanoja ääntämysyhdistelyn jälkeen: %ld" -#: ../spell.c:7476 #, c-format msgid "Total number of words: %d" -msgstr "Sanoja yhteens: %d" +msgstr "Sanoja yhteensä: %d" -#: ../spell.c:7655 #, c-format msgid "Writing suggestion file %s ..." msgstr "Kirjoitetaan ehdotustiedostoa %s..." -#: ../spell.c:7707 ../spell.c:7927 #, c-format msgid "Estimated runtime memory use: %d bytes" -msgstr "Arvioitu kyttmuisti: %d tavua" +msgstr "Arvioitu käyttömuisti: %d tavua" -#: ../spell.c:7820 msgid "E751: Output file name must not have region name" -msgstr "E751: Tulostetiedostonimess ei saa olla alueen nime" +msgstr "E751: Tulostetiedostonimessä ei saa olla alueen nimeä" -#: ../spell.c:7822 msgid "E754: Only up to 8 regions supported" -msgstr "E754: Enintn 8 aluetta tuetaan" +msgstr "E754: Enintään 8 aluetta tuetaan" -#: ../spell.c:7846 #, c-format msgid "E755: Invalid region in %s" msgstr "E755: Virheellinen alue kohteelle %s" -#: ../spell.c:7907 msgid "Warning: both compounding and NOBREAK specified" -msgstr "Varoitus: sek yhdyssanamuodostus ett NOBREAK kytss" +msgstr "Varoitus: sekä yhdyssanamuodostus että NOBREAK käytössä" -#: ../spell.c:7920 #, c-format msgid "Writing spell file %s ..." msgstr "Kirjoitetaan oikaisulukutiedostoa %s..." -#: ../spell.c:7925 msgid "Done!" msgstr "Valmista." -#: ../spell.c:8034 -#, c-format -msgid "E765: 'spellfile' does not have % entries" -msgstr "E765: spellfile ei sisll % kohtaa" - -#: ../spell.c:8074 #, fuzzy, c-format -msgid "Word '%.*s' removed from %s" -msgstr "Sana poistettu kohteesta %s" - -#: ../spell.c:8117 -#, fuzzy, c-format -msgid "Word '%.*s' added to %s" -msgstr "Sana listty kohteeseen %s" - -#: ../spell.c:8381 -msgid "E763: Word characters differ between spell files" -msgstr "E763: Sanan merkit muuttuvat oikaisulukutiedostojen vlill" - -#: ../spell.c:8684 -msgid "Sorry, no suggestions" -msgstr "Sori, ei ehdotuksia" - -#: ../spell.c:8687 -#, c-format -msgid "Sorry, only % suggestions" -msgstr "Sori, vain % ehdotusta" - -#. for when 'cmdheight' > 1 -#. avoid more prompt -#: ../spell.c:8704 -#, c-format -msgid "Change \"%.*s\" to:" -msgstr "Muuta %.*s:" - -#: ../spell.c:8737 -#, c-format -msgid " < \"%.*s\"" -msgstr " < %.*s" - -#: ../spell.c:8882 -msgid "E752: No previous spell replacement" -msgstr "E752: Ei edellist oikaisulukukorjausta" - -#: ../spell.c:8925 -#, c-format -msgid "E753: Not found: %s" -msgstr "E753: Ei lytynyt: %s" - -#: ../spell.c:9276 -#, c-format -msgid "E778: This does not look like a .sug file: %s" -msgstr "E778: Ei vaikuta .sug-tiedostolta: %s" - -#: ../spell.c:9282 -#, c-format -msgid "E779: Old .sug file, needs to be updated: %s" -msgstr "E779: Vanha .sug-tiedosto pit pivitt: %s" +#~ msgid "E765: 'spellfile' does not have % entries" +#~ msgstr "E765: spellfile ei sisällä %ld kohtaa" -#: ../spell.c:9286 #, c-format -msgid "E780: .sug file is for newer version of Vim: %s" -msgstr "E780: .sug-tiedosto on uudemmalle Vimille: %s" +msgid "Word '%.*s' removed from %s" +msgstr "Sana %.*s poistettu kohteesta %s" -#: ../spell.c:9295 #, c-format -msgid "E781: .sug file doesn't match .spl file: %s" -msgstr "E781: .sug-tiedosto ei tsm .spl-tiedostoon: %s" +msgid "Word '%.*s' added to %s" +msgstr "Sana %.*s lisätty kohteeseen %s" -#: ../spell.c:9305 -#, c-format -msgid "E782: error while reading .sug file: %s" -msgstr "E782: virhe luettaessa .sug-tiedostoa: %s" +msgid "E763: Word characters differ between spell files" +msgstr "E763: Sanan merkit muuttuvat oikaisulukutiedostojen välillä" #. This should have been checked when generating the .spl #. file. -#: ../spell.c:11575 msgid "E783: duplicate char in MAP entry" -msgstr "E783: kaksoiskappale merkist MAP-kohdassa" +msgstr "E783: kaksoiskappale merkistä MAP-kohdassa" + +msgid "E766: Insufficient arguments for printf()" +msgstr "E766: printf():lle ei annettu tarpeeksi argumentteja" + +msgid "E807: Expected Float argument for printf()" +msgstr "E807: Odotettiin Float-argumenttia printf():lle" + +msgid "E767: Too many arguments to printf()" +msgstr "E767: printf():lle annettiin liikaa argumentteja" -#: ../syntax.c:266 msgid "No Syntax items defined for this buffer" -msgstr "Ei syntaksikohteita tlle puskurille" +msgstr "Ei syntaksikohteita tälle puskurille" -#: ../syntax.c:3083 ../syntax.c:3104 ../syntax.c:3127 #, c-format msgid "E390: Illegal argument: %s" msgstr "E390: Virheellinen argumentti: %s" -#: ../syntax.c:3299 +msgid "syntax iskeyword " +msgstr "syntax iskeyword " + #, c-format msgid "E391: No such syntax cluster: %s" msgstr "E391: Syntaksiklusteri puuttuu: %s" -#: ../syntax.c:3433 msgid "syncing on C-style comments" msgstr "synkkaa C-tyylin kommentteihin" -#: ../syntax.c:3439 msgid "no syncing" msgstr "ei synkkausta" -#: ../syntax.c:3441 msgid "syncing starts " msgstr "synkkaus aloitettu " -#: ../syntax.c:3443 ../syntax.c:3506 msgid " lines before top line" -msgstr " rivi ennen alkua" +msgstr " riviä ennen alkua" -#: ../syntax.c:3448 msgid "" "\n" "--- Syntax sync items ---" @@ -5729,7 +5225,6 @@ msgstr "" "\n" "--- Syntax sync -kohteet ---" -#: ../syntax.c:3452 msgid "" "\n" "syncing on items" @@ -5737,7 +5232,6 @@ msgstr "" "\n" "synkataan kohteisiin" -#: ../syntax.c:3457 msgid "" "\n" "--- Syntax items ---" @@ -5745,2314 +5239,2499 @@ msgstr "" "\n" "--- Syntax-kohteet ---" -#: ../syntax.c:3475 #, c-format msgid "E392: No such syntax cluster: %s" msgstr "E392: syntaksiklusteria ei ole: %s" -#: ../syntax.c:3497 msgid "minimal " -msgstr "vhintn " +msgstr "vähintään " -#: ../syntax.c:3503 msgid "maximal " -msgstr "enitntn " +msgstr "enitntään " -#: ../syntax.c:3513 msgid "; match " -msgstr "; tsm " +msgstr "; täsmää " -#: ../syntax.c:3515 msgid " line breaks" msgstr " rivinvaihdot" -#: ../syntax.c:4076 msgid "E395: contains argument not accepted here" -msgstr "E395: contains ei sovi thn" +msgstr "E395: contains ei sovi tähän" -#: ../syntax.c:4096 -#, fuzzy msgid "E844: invalid cchar value" -msgstr "E474: Virheellinen argumentti" +msgstr "E844: Virheellinen cchar-arvo" -#: ../syntax.c:4107 msgid "E393: group[t]here not accepted here" -msgstr "E393: group[t]here ei sovi thn" +msgstr "E393: group[t]here ei sovi tähän" -#: ../syntax.c:4126 #, c-format msgid "E394: Didn't find region item for %s" -msgstr "E394: Aluetta nimelle %s ei lydy" +msgstr "E394: Aluetta nimelle %s ei löydy" -#: ../syntax.c:4188 msgid "E397: Filename required" msgstr "E397: Tiedostonimi puuttuu" -#: ../syntax.c:4221 -#, fuzzy msgid "E847: Too many syntax includes" -msgstr "E77: Liikaa tiedostonimi" +msgstr "E847: Liikaa syntax includeja" -#: ../syntax.c:4303 #, c-format msgid "E789: Missing ']': %s" msgstr "E789: ] puuttuu: %s" -#: ../syntax.c:4531 +#, c-format +msgid "E890: trailing char after ']': %s]%s" +msgstr "E890: Ylimääräisiä merkkejä merkin ] perässä: %s]%s" + #, c-format msgid "E398: Missing '=': %s" msgstr "E398: = puuttuu: %s" -#: ../syntax.c:4666 #, c-format msgid "E399: Not enough arguments: syntax region %s" msgstr "E399: Argumentteja puuttuu: syntaksialue %s" -#: ../syntax.c:4870 -#, fuzzy msgid "E848: Too many syntax clusters" -msgstr "E391: Syntaksiklusteri puuttuu: %s" +msgstr "E848: Liikaa syntaksiklustereita" -#: ../syntax.c:4954 msgid "E400: No cluster specified" -msgstr "E400: klusteri mrittelemtt" +msgstr "E400: klusteri määrittelemättä" #. end delimiter not found -#: ../syntax.c:4986 #, c-format msgid "E401: Pattern delimiter not found: %s" msgstr "E401: Kuvoin erotin puuttuu: %s" -#: ../syntax.c:5049 #, c-format msgid "E402: Garbage after pattern: %s" -msgstr "E402: Roskia kuvion jljess: %s" +msgstr "E402: Roskia kuvion jäljessä: %s" -#: ../syntax.c:5120 msgid "E403: syntax sync: line continuations pattern specified twice" -msgstr "E403: syntax sync: rivinjatkamiskuvio mritelty kahdesti" +msgstr "E403: syntax sync: rivinjatkamiskuvio määritelty kahdesti" -#: ../syntax.c:5169 #, c-format msgid "E404: Illegal arguments: %s" msgstr "E404: Virheelliset argumentit: %s" -#: ../syntax.c:5217 #, c-format msgid "E405: Missing equal sign: %s" msgstr "E405: = puuttuu: %s" -#: ../syntax.c:5222 #, c-format msgid "E406: Empty argument: %s" -msgstr "E406: Tyhj argumentti: %s" +msgstr "E406: Tyhjä argumentti: %s" -#: ../syntax.c:5240 #, c-format msgid "E407: %s not allowed here" -msgstr "E407: %s ei sovi thn" +msgstr "E407: %s ei sovi tähän" -#: ../syntax.c:5246 #, c-format msgid "E408: %s must be first in contains list" msgstr "E408: %s kuuluu contains-listan alkuun" -#: ../syntax.c:5304 #, c-format msgid "E409: Unknown group name: %s" -msgstr "E409: Tuntematon ryhmn nimi: %s" +msgstr "E409: Tuntematon ryhmän nimi: %s" -#: ../syntax.c:5512 #, c-format msgid "E410: Invalid :syntax subcommand: %s" msgstr "E410: Virheelluinen :syntax-osakomento: %s" -#: ../syntax.c:5854 msgid "" " TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN" msgstr "" +" KAIKKI MÄÄRÄ TÄSMÄYS HITAIN KEKSIARVO NIMI ILMAUS" -#: ../syntax.c:6146 msgid "E679: recursive loop loading syncolor.vim" -msgstr "E679: rekursiivinen silmukka syncolor.vimiss" +msgstr "E679: rekursiivinen silmukka syncolor.vimissä" -#: ../syntax.c:6256 #, c-format msgid "E411: highlight group not found: %s" -msgstr "E411: korostusryhm ei lytynyt: %s" +msgstr "E411: korostusryhmää ei löytynyt: %s" -#: ../syntax.c:6278 #, c-format msgid "E412: Not enough arguments: \":highlight link %s\"" msgstr "E412: Argumentteja puuttuu: :highlight link %s" -#: ../syntax.c:6284 #, c-format msgid "E413: Too many arguments: \":highlight link %s\"" msgstr "E413: Liikaa argumentteja: :highlight link %s" -#: ../syntax.c:6302 msgid "E414: group has settings, highlight link ignored" -msgstr "E414: ryhmll on asetuksia, highlight link -komento ohitetaan" +msgstr "E414: ryhmällä on asetuksia, highlight link -komento ohitetaan" -#: ../syntax.c:6367 #, c-format msgid "E415: unexpected equal sign: %s" msgstr "E415: odotuksenvastainen =-merkki: %s" -#: ../syntax.c:6395 #, c-format msgid "E416: missing equal sign: %s" msgstr "E416: puuttuva =-merkki: %s" -#: ../syntax.c:6418 #, c-format msgid "E417: missing argument: %s" msgstr "E417: puuttuva argumentti: %s" -#: ../syntax.c:6446 #, c-format msgid "E418: Illegal value: %s" msgstr "E418: Viallinen arvo: %s" -#: ../syntax.c:6496 msgid "E419: FG color unknown" -msgstr "E419: edustavri tuntematon" +msgstr "E419: edustaväri tuntematon" -#: ../syntax.c:6504 msgid "E420: BG color unknown" -msgstr "E420: taustavri tuntematon" +msgstr "E420: taustaväri tuntematon" -#: ../syntax.c:6564 #, c-format msgid "E421: Color name or number not recognized: %s" -msgstr "E421: Vrin nimi tai numero tuntematon: %s" - -#: ../syntax.c:6714 -#, c-format -msgid "E422: terminal code too long: %s" -msgstr "E422: terminaalikoodi liian pitk: %s" +msgstr "E421: Värin nimi tai numero tuntematon: %s" -#: ../syntax.c:6753 #, c-format msgid "E423: Illegal argument: %s" msgstr "E423: Virheellinen argumentti: %s" -#: ../syntax.c:6925 msgid "E424: Too many different highlighting attributes in use" msgstr "E424: Liikaa eri korostusattribuutteja" -#: ../syntax.c:7427 msgid "E669: Unprintable character in group name" -msgstr "E669: Tulostuskelvoton merkki ryhmn nimess" +msgstr "E669: Tulostuskelvoton merkki ryhmän nimessä" -#: ../syntax.c:7434 msgid "W18: Invalid character in group name" -msgstr "W18: Virheellinen merkki ryhmn nimess" +msgstr "W18: Virheellinen merkki ryhmän nimessä" -#: ../syntax.c:7448 msgid "E849: Too many highlight and syntax groups" -msgstr "" +msgstr "E849: Liikaa korostuksia ja syntaksiryhmiä" -#: ../tag.c:104 msgid "E555: at bottom of tag stack" -msgstr "E555: tgipinon pohja" +msgstr "E555: tägipinon pohja" -#: ../tag.c:105 msgid "E556: at top of tag stack" -msgstr "E556: tgipinon huippu" +msgstr "E556: tägipinon huippu" -#: ../tag.c:380 msgid "E425: Cannot go before first matching tag" -msgstr "E425: Ei voida menn ensimmist tsmv tgi alummaksi" +msgstr "E425: Ei voida mennä ensimmäistä täsmäävää tägiä alummaksi" -#: ../tag.c:504 #, c-format msgid "E426: tag not found: %s" -msgstr "E426: tgi puuttuu: %s" +msgstr "E426: tägi puuttuu: %s" -#: ../tag.c:528 msgid " # pri kind tag" -msgstr " # arvo tyyppi tgi" +msgstr " # arvo tyyppi tägi" -#: ../tag.c:531 msgid "file\n" msgstr "tiedosto\n" -#: ../tag.c:829 msgid "E427: There is only one matching tag" -msgstr "E427: Vain yksi tgi tsm" +msgstr "E427: Vain yksi tägi täsmää" -#: ../tag.c:831 msgid "E428: Cannot go beyond last matching tag" -msgstr "E428: Ei voida edet viimeisen tsmvn tgin ohi" +msgstr "E428: Ei voida edetä viimeisen täsmäävän tägin ohi" -#: ../tag.c:850 #, c-format msgid "File \"%s\" does not exist" msgstr "Tiedostoa %s ei ole" #. Give an indication of the number of matching tags -#: ../tag.c:859 #, c-format msgid "tag %d of %d%s" -msgstr "tgi %d/%d%s" +msgstr "tägi %d/%d%s" -#: ../tag.c:862 msgid " or more" msgstr " tai useammasta" -#: ../tag.c:864 msgid " Using tag with different case!" -msgstr " Tgiss eri kirjaintaso" +msgstr " Tägissä eri kirjaintaso" -#: ../tag.c:909 #, c-format msgid "E429: File \"%s\" does not exist" msgstr "E429: Tiedostoa %s ei ole" #. Highlight title -#: ../tag.c:960 msgid "" "\n" " # TO tag FROM line in file/text" msgstr "" "\n" -" # TILL tagg FRN LINJE i fil/text" +" # TILL tagg FRÅN LINJE i fil/text" -#: ../tag.c:1303 #, c-format msgid "Searching tags file %s" -msgstr "Etsitn tgitiedostoa %s" +msgstr "Etsitään tägitiedostoa %s" -#: ../tag.c:1545 msgid "Ignoring long line in tags file" -msgstr "Ohitetaan pitk rivi tgitiedostossa" +msgstr "Ohitetaan pitkä rivi tägitiedostossa" -#: ../tag.c:1915 #, c-format msgid "E431: Format error in tags file \"%s\"" -msgstr "E431: Muotovirh tgitiedostossa %s" +msgstr "E431: Muotovirh tägitiedostossa %s" -#: ../tag.c:1917 -#, c-format -msgid "Before byte %" -msgstr "Ennen tavua %" +#, fuzzy, c-format +#~ msgid "Before byte %" +#~ msgstr "Ennen tavua %ld" -#: ../tag.c:1929 #, c-format msgid "E432: Tags file not sorted: %s" -msgstr "E432: Tgitiedosto ei ole jrjestetty: %s" +msgstr "E432: Tägitiedosto ei ole järjestetty: %s" #. never opened any tags file -#: ../tag.c:1960 msgid "E433: No tags file" -msgstr "E433: Ei tgitiedostoja" +msgstr "E433: Ei tägitiedostoja" -#: ../tag.c:2536 msgid "E434: Can't find tag pattern" -msgstr "E434: Tgikuviota ei lydy" +msgstr "E434: Tägikuviota ei löydy" -#: ../tag.c:2544 msgid "E435: Couldn't find tag, just guessing!" -msgstr "E435: Tgi ei lydy, arvataan." +msgstr "E435: Tägiä ei löydy, arvataan." -#: ../tag.c:2797 #, c-format msgid "Duplicate field name: %s" -msgstr "Kaksoiskappale kentn nimest: %s" - -#: ../term.c:1442 -msgid "' not known. Available builtin terminals are:" -msgstr " ei tunnettu. Tuetut terminaalit:" - -#: ../term.c:1463 -msgid "defaulting to '" -msgstr "oletusarvona " - -#: ../term.c:1731 -msgid "E557: Cannot open termcap file" -msgstr "E557: Ei voi avata termcap-tiedostoa" - -#: ../term.c:1735 -msgid "E558: Terminal entry not found in terminfo" -msgstr "E558: Terminaalia ei lytynyt terminfosta" - -#: ../term.c:1737 -msgid "E559: Terminal entry not found in termcap" -msgstr "E559: Terminaalia ei lytynyt termcapista" - -#: ../term.c:1878 -#, c-format -msgid "E436: No \"%s\" entry in termcap" -msgstr "E436: %s ei lytynyt termcapista" - -#: ../term.c:2249 -msgid "E437: terminal capability \"cm\" required" -msgstr "E437: terminaalilla pit olla cm kyvyissn" - -#. Highlight title -#: ../term.c:4376 -msgid "" -"\n" -"--- Terminal keys ---" -msgstr "" -"\n" -"--- Terminaalinppimet ---" - -#: ../ui.c:481 -msgid "Vim: Error reading input, exiting...\n" -msgstr "Vim: Virhe luettaessa sytett, poistutaan...\n" +msgstr "Kaksoiskappale kentän nimestä: %s" #. This happens when the FileChangedRO autocommand changes the #. * file in a way it becomes shorter. -#: ../undo.c:379 -#, fuzzy msgid "E881: Line count changed unexpectedly" -msgstr "E834: Rivimr vaihtui odottamatta" +msgstr "E881: Rivimäärä vaihtui odottamatta" -#: ../undo.c:627 #, c-format msgid "E828: Cannot open undo file for writing: %s" msgstr "E828: Kumoustiedoston avaus kirjoittamista varten ei onnistu: %s" -#: ../undo.c:717 +#, fuzzy, c-format +#~ msgid "E5003: Unable to create directory \"%s\" for undo file: %s" +#~ msgstr "E346: Hakemisto %s ei ole enää cdpathissa" + #, c-format msgid "E825: Corrupted undo file (%s): %s" msgstr "E825: Pilaanntunut kumoustiedosto (%s): %s" -#: ../undo.c:1039 msgid "Cannot write undo file in any directory in 'undodir'" -msgstr "Ei voitu lukea kumoustiedostoa mistn undodir-muuttujan hakemistosta" +msgstr "Ei voitu lukea kumoustiedostoa mistään undodir-muuttujan hakemistosta" -#: ../undo.c:1074 #, c-format msgid "Will not overwrite with undo file, cannot read: %s" msgstr "Ei ylikirjoitetat kumoustiedostolla, koska ei voida lukea: %s" -#: ../undo.c:1092 #, c-format msgid "Will not overwrite, this is not an undo file: %s" -msgstr "Ei ylikirjoiteta, koska tm ei ole kumoustiedosto: %s" +msgstr "Ei ylikirjoiteta, koska tämä ei ole kumoustiedosto: %s" -#: ../undo.c:1108 msgid "Skipping undo file write, nothing to undo" msgstr "Ohitetaan kumoustiedoston kirjoitus, koska ei ole peruutettavia" -#: ../undo.c:1121 #, c-format msgid "Writing undo file: %s" msgstr "Kirjoitetaan kumoustiedostoa: %s" -#: ../undo.c:1213 #, c-format msgid "E829: write error in undo file: %s" msgstr "E829: Kirjoitusvirhe kumoustiedostossa: %s" -#: ../undo.c:1280 #, c-format msgid "Not reading undo file, owner differs: %s" msgstr "Ei lueta kumoustiedosto jonka omistaja on eri: %s" -#: ../undo.c:1292 #, c-format msgid "Reading undo file: %s" msgstr "Luetaan kumoustiedostoa: %s" -#: ../undo.c:1299 #, c-format msgid "E822: Cannot open undo file for reading: %s" msgstr "E822: Kumoustiedostoa ei voi avata lukemista varten: %s" -#: ../undo.c:1308 #, c-format msgid "E823: Not an undo file: %s" msgstr "E823: Ei ole kumoustiedosto: %s" -#: ../undo.c:1313 #, c-format msgid "E824: Incompatible undo file: %s" -msgstr "E824: Epyhteensopiva kumoustiedosto: %s" +msgstr "E824: Epäyhteensopiva kumoustiedosto: %s" -#: ../undo.c:1328 msgid "File contents changed, cannot use undo info" msgstr "" -"Tiedoston sislt on muuttunut, joen kumoustiedot ovat kyttkelvottomia" +"Tiedoston sisältö on muuttunut, joen kumoustiedot ovat käyttökelvottomia" -#: ../undo.c:1497 #, c-format msgid "Finished reading undo file %s" msgstr "Ladattu kumoustiedoto %s" -#: ../undo.c:1586 ../undo.c:1812 msgid "Already at oldest change" msgstr "Vanhimmassa muutoksessa" -#: ../undo.c:1597 ../undo.c:1814 msgid "Already at newest change" msgstr "Nuorimmassa muutoksessa" -#: ../undo.c:1806 -#, c-format -msgid "E830: Undo number % not found" -msgstr "E830: Kumouslukua % ei lydy" +#, fuzzy, c-format +#~ msgid "E830: Undo number % not found" +#~ msgstr "E830: Kumouslukua %ld ei löydy" -#: ../undo.c:1979 msgid "E438: u_undo: line numbers wrong" -msgstr "E438: u_undo: vrt rivinumerot" +msgstr "E438: u_undo: väärät rivinumerot" -#: ../undo.c:2183 msgid "more line" -msgstr "rivi lis" +msgstr "rivi lisää" -#: ../undo.c:2185 msgid "more lines" -msgstr "rivi lis" +msgstr "riviä lisää" -#: ../undo.c:2187 msgid "line less" -msgstr "rivi vhemmn" +msgstr "rivi vähemmän" -#: ../undo.c:2189 msgid "fewer lines" -msgstr "rivi vhemmn" +msgstr "riviä vähemmän" -#: ../undo.c:2193 msgid "change" msgstr "muutos" -#: ../undo.c:2195 msgid "changes" msgstr "muutosta" -# eka %s ylpuolelta, toka %s alapuolelta, kolmas %s aika -#: ../undo.c:2225 -#, c-format -msgid "% %s; %s #% %s" -msgstr "% %s, %s #% %s" +# eka %s yläpuolelta, toka %s alapuolelta, kolmas %s aika +#, fuzzy, c-format +#~ msgid "% %s; %s #% %s" +#~ msgstr "%ld %s, %s #%ld %s" + +msgid "after" +msgstr "jälkeen muutoksen" -#: ../undo.c:2228 msgid "before" msgstr "ennen muutosta" -#: ../undo.c:2228 -msgid "after" -msgstr "jlkeen muutoksen" - -#: ../undo.c:2325 msgid "Nothing to undo" msgstr "Ei kumottavaa" -#: ../undo.c:2330 -#, fuzzy msgid "number changes when saved" -msgstr "muutoksia aika tallennettu" +msgstr "numero muutoksia aika tallennettu" -#: ../undo.c:2360 -#, c-format -msgid "% seconds ago" -msgstr "% sekuntia sitten" +#, fuzzy, c-format +#~ msgid "% seconds ago" +#~ msgstr "%ld sekuntia sitten" -#: ../undo.c:2372 msgid "E790: undojoin is not allowed after undo" -msgstr "E790: undojoin ei toimi undon jlkeen" +msgstr "E790: undojoin ei toimi undon jälkeen" -#: ../undo.c:2466 msgid "E439: undo list corrupt" msgstr "E439: kumouslista rikki" -#: ../undo.c:2495 msgid "E440: undo line missing" msgstr "E440: kumousrivi puuttuu" -#: ../version.c:600 -msgid "" -"\n" -"Included patches: " -msgstr "" -"\n" -"Ptsit: " - -#: ../version.c:627 msgid "" "\n" "Extra patches: " msgstr "" "\n" -"Muita ptsej: " +"Muita pätsejä: " -#: ../version.c:639 ../version.c:864 -msgid "Modified by " -msgstr "Muokannut " - -#: ../version.c:646 msgid "" "\n" "Compiled " msgstr "" "\n" -"Kntnyt " +"Kääntänyt " -#: ../version.c:649 msgid "by " msgstr ": " -#: ../version.c:660 +#, fuzzy msgid "" "\n" -"Huge version " -msgstr "" "\n" -"Huge-versio " - -#: ../version.c:661 -msgid "without GUI." -msgstr "ilman GUIta." - -#: ../version.c:662 -msgid " Features included (+) or not (-):\n" +"Optional features included (+) or not (-): " msgstr " Ominaisuudet mukana (+) ja poissa (-):\n" -#: ../version.c:667 msgid " system vimrc file: \"" -msgstr " jrjestelmn vimrc: \"" - -#: ../version.c:672 -msgid " user vimrc file: \"" -msgstr " kyttjn vimrc: \"" - -#: ../version.c:677 -msgid " 2nd user vimrc file: \"" -msgstr " 2. kyttjn vimrc: \"" - -#: ../version.c:682 -msgid " 3rd user vimrc file: \"" -msgstr " 3. kyttjn vimrc: \"" - -#: ../version.c:687 -msgid " user exrc file: \"" -msgstr " kyttjn exrc: \"" - -#: ../version.c:692 -msgid " 2nd user exrc file: \"" -msgstr " 2. kyttjn exrc: \"" +msgstr " järjestelmän vimrc: \"" -#: ../version.c:699 msgid " fall-back for $VIM: \"" msgstr " $VIMin fallback: \"" -#: ../version.c:705 msgid " f-b for $VIMRUNTIME: \"" msgstr " $VIMRUNTIMEn f-b: \"" -#: ../version.c:709 -msgid "Compilation: " -msgstr "Knns: " - -#: ../version.c:712 -msgid "Linking: " -msgstr "Linkitys: " - -#: ../version.c:717 -msgid " DEBUG BUILD" -msgstr " DEBUG-versio" - -#: ../version.c:767 -msgid "VIM - Vi IMproved" -msgstr "VIM - Vi IMproved" - -#: ../version.c:769 -msgid "version " -msgstr "versio " - -#: ../version.c:770 msgid "by Bram Moolenaar et al." -msgstr "tekijt Bram Moolenaar et al." +msgstr "tekijät Bram Moolenaar et al." -#: ../version.c:774 -msgid "Vim is open source and freely distributable" -msgstr "Vim on avointa lhdekoodia ja vapaasti jaossa" +#, fuzzy +#~ msgid "Nvim is open source and freely distributable" +#~ msgstr "Vim on avointa lähdekoodia ja vapaasti jaossa" -#: ../version.c:776 -msgid "Help poor children in Uganda!" -msgstr "Auta Ugandan kyhi lapsia" +#~ msgid "https://neovim.io/community" +#~ msgstr "" -#: ../version.c:777 -msgid "type :help iccf for information " -msgstr "kirjoita :help iccf listietoa varten " +#, fuzzy +#~ msgid "type :help nvim if you are new! " +#~ msgstr "kirjoita :help iccf lisätietoa varten " + +#, fuzzy +#~ msgid "type :CheckHealth to optimize Nvim" +#~ msgstr "kirjoita :help iccf lisätietoa varten " -#: ../version.c:779 msgid "type :q to exit " msgstr "kirjoita :q lopettaaksesi " -#: ../version.c:780 -msgid "type :help or for on-line help" -msgstr "kirjoita :help tai ohjetta varten " - -#: ../version.c:781 -msgid "type :help version7 for version info" -msgstr "kirjoita :help version7 versiotietoja varten " - -#: ../version.c:784 -msgid "Running in Vi compatible mode" -msgstr "Suoritetaan Vi-yhteensopivuustilaa" +#, fuzzy +#~ msgid "type :help for help " +#~ msgstr "kirjoita :q lopettaaksesi " -#: ../version.c:785 -msgid "type :set nocp for Vim defaults" -msgstr "kirjoita :set nocp Vimin oletuksiin " +msgid "Help poor children in Uganda!" +msgstr "Auta Ugandan köyhiä lapsia" -#: ../version.c:786 -msgid "type :help cp-default for info on this" -msgstr "kirjoita :help cp-default ohjetta oletuksista varten" +msgid "type :help iccf for information " +msgstr "kirjoita :help iccf lisätietoa varten " -#: ../version.c:827 msgid "Sponsor Vim development!" -msgstr "Tue Vimin kehityst" +msgstr "Tue Vimin kehitystä" -#: ../version.c:828 msgid "Become a registered Vim user!" -msgstr "Rekisteridy Vim-kyttjksi." +msgstr "Rekisteröidy Vim-käyttäjäksi." -#: ../version.c:831 msgid "type :help sponsor for information " -msgstr "kirjoita :help sponsor listietoja varten" +msgstr "kirjoita :help sponsor lisätietoja varten" -#: ../version.c:832 msgid "type :help register for information " -msgstr "kirjoita :help register listietoja varten" +msgstr "kirjoita :help register lisätietoja varten" -#: ../version.c:834 msgid "menu Help->Sponsor/Register for information " -msgstr "valikko Ohje->Sponsoroi/Rekisteri listietoja varten" +msgstr "valikko Ohje->Sponsoroi/Rekisteröi lisätietoja varten" -#: ../window.c:119 msgid "Already only one window" -msgstr "En yksi ikkuna jljell" +msgstr "Enää yksi ikkuna jäljellä" -#: ../window.c:224 msgid "E441: There is no preview window" msgstr "E441: Ei esikatseluikkunaa" -#: ../window.c:559 msgid "E442: Can't split topleft and botright at the same time" -msgstr "E442: Ei voi jakaa vasenta ylnurkkaa ja oikeaa alanurkkaa yhtaikaa" +msgstr "E442: Ei voi jakaa vasenta ylänurkkaa ja oikeaa alanurkkaa yhtäaikaa" -#: ../window.c:1228 msgid "E443: Cannot rotate when another window is split" -msgstr "E443: Ei voi kiert kun toinen ikkuna on jaettu" +msgstr "E443: Ei voi kiertää kun toinen ikkuna on jaettu" -#: ../window.c:1803 msgid "E444: Cannot close last window" -msgstr "E444: Ei voi sulkea viimeist ikkunaa" +msgstr "E444: Ei voi sulkea viimeistä ikkunaa" -#: ../window.c:1810 msgid "E813: Cannot close autocmd window" msgstr "E813: Ei voi sulkea autocmd-ikkunaa" -#: ../window.c:1814 msgid "E814: Cannot close window, only autocmd window would remain" -msgstr "E814: Ei voi sulkea viimeist ikkunaa, joka ei ole autocmd-ikkuna" +msgstr "E814: Ei voi sulkea viimeistä ikkunaa, joka ei ole autocmd-ikkuna" -#: ../window.c:2717 msgid "E445: Other window contains changes" -msgstr "E445: Toinen ikkuna sislt muutoksia" +msgstr "E445: Toinen ikkuna sisältää muutoksia" -#: ../window.c:4805 msgid "E446: No file name under cursor" -msgstr "E446: Ei tiedostonime kursorin alla" +msgstr "E446: Ei tiedostonimeä kursorin alla" -#~ msgid "E831: bf_key_init() called with empty password" -#~ msgstr "E831: bf_key_init() tyhjll salasanalla" +msgid "List or number required" +msgstr "Lista tai luku tarvitaan" -#~ msgid "E820: sizeof(uint32_t) != 4" -#~ msgstr "E820: sizeof(uint32_t) != 4" +#~ msgid "" +#~ "Failed to set path: sys.path is not a list\n" +#~ "You should now append vim.VIM_SPECIAL_PATH to sys.path" +#~ msgstr "" +#~ "Ei onnistuttu asettaman polkua: sys.path ei ole list\n" +#~ "Lisää vim.VIM_SPECIAL_PATH muuttujaan sys.path" -#~ msgid "E817: Blowfish big/little endian use wrong" -#~ msgstr "E817: Blowfishin tavujrjestys vr" +#~ msgid "" +#~ "Failed to set path hook: sys.path_hooks is not a list\n" +#~ "You should now do the following:\n" +#~ "- append vim.path_hook to sys.path_hooks\n" +#~ "- append vim.VIM_SPECIAL_PATH to sys.path\n" +#~ msgstr "" +#~ "Ei voitu asettaa polkukoukkua: sys.path_hooks ei ole lista\n" +#~ "Koeta seuraavaa:\n" +#~ "- lisää vim.path_hook muuttujaan sys.path_hooks\n" +#~ "- lisää vim.VIM_SPECIAL_PATH muuttujaan sys.path\n" -#~ msgid "E818: sha256 test failed" -#~ msgstr "E818: sha256-testi eponnistui failed" +#~ msgid "internal error: invalid value type" +#~ msgstr "sisäinen virhe: huono arvotyyppi" -#~ msgid "E819: Blowfish test failed" -#~ msgstr "E819: Blowfish-testi eponnistui" +#~ msgid "internal error: NULL reference passed" +#~ msgstr "sisäinen virhe: NULL-viite annettu" -#~ msgid "Patch file" -#~ msgstr "Patch-tiedosto" +#~ msgid "unable to convert %s to vim structure" +#~ msgstr "ei voi konvertoida oliota %s vim-tietorakenteeksi" -#~ msgid "" -#~ "&OK\n" -#~ "&Cancel" -#~ msgstr "" -#~ "&OK\n" -#~ "&Peru" +#~ msgid "unable to convert %s to vim dictionary" +#~ msgstr "ei voitu konvertoida oliota %s vim-sanakirjaksi" -#~ msgid "E240: No connection to Vim server" -#~ msgstr "E240: Ei yhteytt vim-palvelimeen" +#~ msgid "E859: Failed to convert returned python object to vim value" +#~ msgstr "E859: Ei voitu konvertoida python-oliota vim-arvoksi" -#~ msgid "E241: Unable to send to %s" -#~ msgstr "E241: Kohteeseen %s lhettminen ei onnistunut" +#~ msgid "E858: Eval did not return a valid python object" +#~ msgstr "E858: Eval ei palauttanut python-oliota" -#~ msgid "E277: Unable to read a server reply" -#~ msgstr "E277: Palvelimen vastauksen lukeminen ei onnistunut" +#~ msgid "failed to run the code" +#~ msgstr "ei voitu suorittaa koodia" -#~ msgid "E258: Unable to send to client" -#~ msgstr "E258: Asiakkaalle lhetys ei onnistunut" +#~ msgid "did not switch to the specified tab page" +#~ msgstr "ei voitu vaihtaa annetulle välilehtisivulle" -#~ msgid "Save As" -#~ msgstr "Tallenna nimell" +#~ msgid "expected vim.TabPage object, but got %s" +#~ msgstr "odotettiin vim.TabPage-oliota, saatiin %s" -#~ msgid "Source Vim script" -#~ msgstr "Lataa vim-skripti" +#~ msgid "did not switch to the specified window" +#~ msgstr "ei vaihdettu annettuun ikkunaan" -#~ msgid "Edit File" -#~ msgstr "Muokkaa tiedostoa" +#~ msgid "failed to find window in the current tab page" +#~ msgstr "ei voitu löytää ikkunaa nykyiselle välilehtisivulle" -#~ msgid " (NOT FOUND)" -#~ msgstr " (EI LYTYNYT)" +#~ msgid "expected vim.Window object, but got %s" +#~ msgstr "odotettiin vim.Window-oliota, saatiin %s" -#~ msgid "unknown" -#~ msgstr "tuntematon" +#~ msgid "expected vim.Buffer object, but got %s" +#~ msgstr "odotettiin vim.Buffer-oliota, ei %s" -#~ msgid "Edit File in new window" -#~ msgstr "Muokkaa uudessa ikkunassa" +#~ msgid "attempt to refer to deleted buffer" +#~ msgstr "yritettiin viitata poistettuun puskuriin" -#~ msgid "Append File" -#~ msgstr "Lis tiedostoon" +#~ msgid "no such window" +#~ msgstr "ikkunaa ei ole" -#~ msgid "Window position: X %d, Y %d" -#~ msgstr "Ikkunan sijainti: X %d, Y %d" +#~ msgid "readonly attribute: buffer" +#~ msgstr "kirjoitussuojausattribuutti: puskuri" -#~ msgid "Save Redirection" -#~ msgstr "Tallenna uudelleenosoitus" +#~ msgid "attempt to refer to deleted window" +#~ msgstr "yritettiin viitata poistettuun ikkunaan" -#~ msgid "Save View" -#~ msgstr "Tallenna nkym" +#~ msgid "no such tab page" +#~ msgstr "välilehteä ei ole" -#~ msgid "Save Session" -#~ msgstr "Tallenna sessio" +#~ msgid "attempt to refer to deleted tab page" +#~ msgstr "yritettiin viitata poistettuun välilehteen" -#~ msgid "Save Setup" -#~ msgstr "Tallenna asetukset" +#~ msgid "internal error: unknown option type" +#~ msgstr "sisäinen virhe: tuntematon asetustyyppi" -#~ msgid "E809: #< is not available without the +eval feature" -#~ msgstr "E809: #< ei ole kytss jollei +eval ole pll" +#~ msgid "unable to get option value" +#~ msgstr "ei voitu hakea asetuksen arvoa" -#~ msgid "E196: No digraphs in this version" -#~ msgstr "E196: Digraafeja ei ole tss versiossa" +#~ msgid "failed to run function %s" +#~ msgstr "ei voitu suorittaa funktiota %s" -#~ msgid "is a device (disabled with 'opendevice' option)" -#~ msgstr "on laite (ei kytss opendevice-asetuksen takia)" +#~ msgid "function %s does not exist" +#~ msgstr "funktiota %s ei ole" -#~ msgid "Reading from stdin..." -#~ msgstr "Luetaan vakiosytteest" +#~ msgid "unnamed function %s does not exist" +#~ msgstr "nimetöntä funktiota %s ei ole" -#~ msgid "[crypted]" -#~ msgstr "[salattu]" +#~ msgid "cannot modify fixed list" +#~ msgstr "ei voida muokata kiinitettyä listaa" -#~ msgid "E821: File is encrypted with unknown method" -#~ msgstr "E821: Tiedoston salaus on tuntematon" +#~ msgid "cannot delete vim.List attributes" +#~ msgstr "ei voi poistaa vim.List-attribuutteja" -#~ msgid "NetBeans disallows writes of unmodified buffers" -#~ msgstr "NetBeans ei salli kirjoittaa muokkaamattomiin puskureihin" +#~ msgid "failed to add item to list" +#~ msgstr "ei voitu lisätä kohtaa listaan" -#~ msgid "Partial writes disallowed for NetBeans buffers" -#~ msgstr "Osittaiset kirjoitukset kielletty NetBeans-puskureissa" +#~ msgid "attempt to assign sequence of size %d to extended slice of size %d" +#~ msgstr "" +#~ "yritettiin asettaa sekvenssiä jonka koko on %d sliceen jonka koko on %d" -#~ msgid "writing to device disabled with 'opendevice' option" -#~ msgstr "laitteeseen kirjoittaminen pois kytst opendevice-asetuksella" +#~ msgid "internal error: failed to add item to list" +#~ msgstr "sisäinen virhe: ei voitu lisätä kohtaa listaan" -# tietkseni resurssiforkki on applen tiedostojrjestelmn tunnistejuttujuttu -#~ msgid "E460: The resource fork would be lost (add ! to override)" -#~ msgstr "E460: resurssiosa hviisi (lis komentoon ! ohittaaksesi)" +#~ msgid "internal error: not enough list items" +#~ msgstr "sisäinen virhe: ei tarpeeksi listan kohtia" -#~ msgid " " -#~ msgstr " " +#~ msgid "internal error: no vim list item %d" +#~ msgstr "sisäinen virhe: ei vim-listan indeksiä %d" -#~ msgid "E616: vim_SelFile: can't get font %s" -#~ msgstr "E616: vim_SelFile: ei saada fonttia %s" +#~ msgid "attempt to assign sequence of size greater than %d to extended slice" +#~ msgstr "" +#~ "yritettiin sijoittaa sekvenssiä jonka koko on enemmän kuin %d sliceen" -#~ msgid "E614: vim_SelFile: can't return to current directory" -#~ msgstr "E614: vim_SelFile: nykyiseen hakemistoon ei voi palata" +#~ msgid "slice step cannot be zero" +#~ msgstr "slicen askel ei voi olla nolla" -#~ msgid "Pathname:" -#~ msgstr "Polku:" +#~ msgid "internal error: failed to get vim list item %d" +#~ msgstr "sisäinen virhe: ei pystytty hakea vimin listan indeksiä %d" -#~ msgid "E615: vim_SelFile: can't get current directory" -#~ msgstr "E615: vim_SelFile: nykyist hakemistoa ei saada selville" +#~ msgid "list index out of range" +#~ msgstr "listaindeksi arvoalueen ulkopuolelta" -#~ msgid "OK" -#~ msgstr "OK" +#~ msgid "list constructor does not accept keyword arguments" +#~ msgstr "listakonstruktori ei tue avainsanaparametrejä" -#~ msgid "Cancel" -#~ msgstr "Peru" +#~ msgid "expected sequence element of size 2, but got sequence of size %d" +#~ msgstr "sekvenssin elementin koon pitäisi olla 2, ei %d" -#~ msgid "Vim dialog" -#~ msgstr "Vim-ikkuna" +#~ msgid "hashtab changed during iteration" +#~ msgstr "hashtab muuttui kesken iteraation" -#~ msgid "Scrollbar Widget: Could not get geometry of thumb pixmap." -#~ msgstr "Vierityspalkki: Pixmapin geometria ei selvi" +#~ msgid "cannot set attribute %s" +#~ msgstr "ei voi asettaa attribuuttia %s" -#~ msgid "E232: Cannot create BalloonEval with both message and callback" -#~ msgstr "E232: Ei voi luoda BalloonEvalia viestille ja callbackille" +#~ msgid "cannot delete vim.Dictionary attributes" +#~ msgstr "ei voi poistaa vim.Dictionary-attribuutteja" -#~ msgid "E229: Cannot start the GUI" -#~ msgstr "E229: GUIn kynnistys ei onnistu" +#~ msgid "internal error: imp.find_module returned tuple with NULL" +#~ msgstr "" +#~ "sisäinen virhe: imp.find_module palautti tuplen joka sisältää nullin" -#~ msgid "E230: Cannot read from \"%s\"" -#~ msgstr "E230: Ei voi lukea kohteesta %s" +#~ msgid "" +#~ "expected 3-tuple as imp.find_module() result, but got tuple of size %d" +#~ msgstr "" +#~ "odotettiin 3-tuple tuloksnea imp.find_module()-kutsulle, mutta tuplen " +#~ "koko onkin %d" -#~ msgid "E665: Cannot start GUI, no valid font found" -#~ msgstr "E665: Ei voi avata GUIta, sopivaa fonttia ei lydy" +#~ msgid "expected 3-tuple as imp.find_module() result, but got %s" +#~ msgstr "odotettiin 3-tuplea tuloksena imp.find_module()-kutsulle, ei %s" -#~ msgid "E231: 'guifontwide' invalid" -#~ msgstr "E231: guifontwide virheellinen" +#~ msgid "E264: Python: Error initialising I/O objects" +#~ msgstr "E264: Python: Virhe IO-olioiden alustuksessa" -#~ msgid "E599: Value of 'imactivatekey' is invalid" -#~ msgstr "E599: imactivatekeyn arvo on virheellinen" +#~ msgid "invalid attribute: %s" +#~ msgstr "virheellinen attribuutti: %s" -#~ msgid "E254: Cannot allocate color %s" -#~ msgstr "E254: Vri %s ei voi mritell" +#~ msgid "can't delete OutputObject attributes" +#~ msgstr "ei voi poistaa OutputObject-attribuutteja" -#~ msgid "No match at cursor, finding next" -#~ msgstr "Ei tsmyst kursorin alla, etsitn seuraava" +#~ msgid "number must be greater or equal to zero" +#~ msgstr "luvun on oltava yhtä suuri tai suurempi kuin nolla" -#~ msgid "Input _Methods" -#~ msgstr "Syte_menetelmt" +#~ msgid "value is too small to fit into C int type" +#~ msgstr "arvo on liian pieni mahtumaan C:n int-tyyppiin" -#~ msgid "VIM - Search and Replace..." -#~ msgstr "VIM - Etsi ja korvaa..." +#~ msgid "expected int() or something supporting coercing to int(), but got %s" +#~ msgstr "" +#~ "odotettiin tyyppiä int() tai jotain joka muuntuu tyyppiin int(), ei %s" -#~ msgid "VIM - Search..." -#~ msgstr "VIM - Etsi..." +#~ msgid "" +#~ "expected int(), long() or something supporting coercing to long(), but " +#~ "got %s" +#~ msgstr "" +#~ "odotettiin instanssia tyypeistä int(), long() tai mitä tahansa joka " +#~ "muuntuisi tyyppiin long(), ei %s" -#~ msgid "Find what:" -#~ msgstr "Etsi:" +#~ msgid "expected bytes() or str() instance, but got %s" +#~ msgstr "odotettiin instanssia tyypeistä bytes() tai str(), ei %s" -#~ msgid "Replace with:" -#~ msgstr "Korvaa:" +#~ msgid "expected str() or unicode() instance, but got %s" +#~ msgstr "odottettiin insanssia tyypeistä str() tai unicode(), ei %s" -#~ msgid "Match whole word only" -#~ msgstr "Korvaa kokonaisia sanoja" +#~ msgid "index must be int or slice, not %s" +#~ msgstr "indeksin pitää olla int tai slice, ei %s" -#~ msgid "Match case" -#~ msgstr "Kirjaintaso" +#~ msgid "failed to add key '%s' to dictionary" +#~ msgstr "avaimen %s lisääminen sanakirjaan ei onnistu" -#~ msgid "Direction" -#~ msgstr "Suunta" +#~ msgid "list is locked" +#~ msgstr "luettelo on lukittu" -#~ msgid "Up" -#~ msgstr "Yls" +#~ msgid "Need encryption key for \"%s\"" +#~ msgstr "Tarvitaan salausavain kohteelle %s " -#~ msgid "Down" -#~ msgstr "Alas" +#~ msgid "E744: NetBeans does not allow changes in read-only files" +#~ msgstr "E744: NetBeans ei tue muutoksia kirjoitussuojattuihin tiedostoihin" -#~ msgid "Find Next" -#~ msgstr "Etsi seuraava" +#~ msgid "E463: Region is guarded, cannot modify" +#~ msgstr "E463: Alue on suojattu, muuttaminen ei onnistu" -#~ msgid "Replace" -#~ msgstr "Korvaa" +#~ msgid "E449: Invalid expression received" +#~ msgstr "E449: Virheellinen ilmaus saatu" -#~ msgid "Replace All" -#~ msgstr "Korvaa kaikki" +#~ msgid "E233: cannot open display" +#~ msgstr "E233: näyttöä ei voi avata" -#~ msgid "Vim: Received \"die\" request from session manager\n" -#~ msgstr "Vim: sessiomanageri lhetti die-pyynnn\n" +#~ msgid "E247: no registered server named \"%s\"" +#~ msgstr "E247: palvelinta %s ei ole rekisteröitynä" -#~ msgid "Close" -#~ msgstr "Sulje" +#~ msgid "E800: Arabic cannot be used: Not enabled at compile time\n" +#~ msgstr "E800: Arabiaa ei voi käyttää, koska sitä ei käännetty mukaan\n" -#~ msgid "New tab" -#~ msgstr "Uusi vlilehti" +#~ msgid "E27: Farsi cannot be used: Not enabled at compile time\n" +#~ msgstr "E27: Farsia ei voi käyttää, koska sitä ei käännetty mukaan\n" -#~ msgid "Open Tab..." -#~ msgstr "Avaa vlilehti..." +#~ msgid "E26: Hebrew cannot be used: Not enabled at compile time\n" +#~ msgstr "E26: Hepreaa ei voi käyttää, koska sitä ei käännetty mukaan\n" -#~ msgid "Vim: Main window unexpectedly destroyed\n" -#~ msgstr "Vim: Pikkuna tuhoutui odottamatta\n" +#~ msgid "E25: GUI cannot be used: Not enabled at compile time" +#~ msgstr "E25: GUIta ei voi käyttää, koska sitä ei käännetty mukaan" -#~ msgid "&Filter" -#~ msgstr "&Suodata" +#~ msgid "E448: Could not load library function %s" +#~ msgstr "E448: Ei voitu ladta kirjastofunktiota %s" -#~ msgid "&Cancel" -#~ msgstr "&Peru" +#~ msgid "E236: Font \"%s\" is not fixed-width" +#~ msgstr "E236: Fontti %s ei ole tasavälinen" -#~ msgid "Directories" -#~ msgstr "Hakemistot" +#~ msgid "E234: Unknown fontset: %s" +#~ msgstr "E234: Tuntematon fontset: %s" -#~ msgid "Filter" -#~ msgstr "Suodatus" +#~ msgid "gvimext.dll error" +#~ msgstr "gvimext.dll-virhe" -#~ msgid "&Help" -#~ msgstr "O&hje" +#~ msgid "Error creating process: Check if gvim is in your path!" +#~ msgstr "Virhe prosessin käynnistämisessä, varmista että gvim on polulla" -#~ msgid "Files" -#~ msgstr "Tiedostot" +#~ msgid "Edits the selected file(s) with Vim" +#~ msgstr "Muokkaa valittuja tiedostoja Vimillä" -#~ msgid "&OK" -#~ msgstr "&Ok" +#~ msgid "Edit with existing Vim - " +#~ msgstr "Muokkaa olemassaolevalla Vimillä - " -#~ msgid "Selection" -#~ msgstr "Valinta" +#~ msgid "Edit with &Vim" +#~ msgstr "Muokkaa &Vimillä" -#~ msgid "Find &Next" -#~ msgstr "Hae &seuraava" +#~ msgid "Diff with Vim" +#~ msgstr "Diffi Vimillä" -#~ msgid "&Replace" -#~ msgstr "Ko&rvaa" +#~ msgid "Edit with single &Vim" +#~ msgstr "Muokkaa yhdellä &Vimillä" -#~ msgid "Replace &All" -#~ msgstr "Korvaa k&aikki" +#~ msgid "Edit with &multiple Vims" +#~ msgstr "&Muokkaa usealla Vimillä" -#~ msgid "&Undo" -#~ msgstr "&Kumoa" +#~ msgid "E299: Perl evaluation forbidden in sandbox without the Safe module" +#~ msgstr "E299: Perl-suoritus kielletty hiekkalaatikossa ilman Safe-moduulia" -#~ msgid "E671: Cannot find window title \"%s\"" -#~ msgstr "E671: Ikkunan otsikkoa ei lydy %s" +#~ msgid "" +#~ "Sorry, this command is disabled: the Perl library could not be loaded." +#~ msgstr "komento ei toimi, Perl kirjastoa ei voinut ladata." -# OLE on object linking and embedding p windowska -#~ msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." -#~ msgstr "E243: Argumenttia ei tueta: -%s, kyt OLE-versiota" +#~ msgid "E370: Could not load library %s" +#~ msgstr "E370: Kirjaston %s lataaminen ei onnistu" -# MDI eli windowsin moni-ikkunasovellus -#~ msgid "E672: Unable to open window inside MDI application" -#~ msgstr "E672: Ikkunaa ei voitu avata MDI-sovellukseen" +#~ msgid "type :help windows95 for info on this" +#~ msgstr "kirjoita :help windows95 lisätietoja varten" -#~ msgid "Close tab" -#~ msgstr "Sulje vlilehti" +#~ msgid "WARNING: Windows 95/98/ME detected" +#~ msgstr "VAROITUS: Window 95/98/ME havaittu" -#~ msgid "Open tab..." -#~ msgstr "Avaa vlilehti..." +#~ msgid " for Vim defaults " +#~ msgstr " Vim-oletuksia varten" -#~ msgid "Find string (use '\\\\' to find a '\\')" -#~ msgstr "Etsi merkkijonoa (\\\\:ll lyt \\:t)" +#~ msgid "menu Edit->Global Settings->Toggle Vi Compatible" +#~ msgstr "valikko Muokkaa->Yleiset asetukset->Vaihda Vi-yhteensopivuutta" -#~ msgid "Find & Replace (use '\\\\' to find a '\\')" -#~ msgstr "Etsi ja korvaa (\\\\:ll lyt \\:t)" +#~ msgid "menu Edit->Global Settings->Toggle Insert Mode " +#~ msgstr "valikko Muokkaa->Yleiset asetukset->Vaihda syötetilaa" -#~ msgid "Not Used" -#~ msgstr "Ei kytss" +#~ msgid "Running modeless, typed text is inserted" +#~ msgstr "Suoritetaan tilattomana, kirjoitettu teksti syötetään" -#~ msgid "Directory\t*.nothing\n" -#~ msgstr "Hakemisto\t*.nothing\n" +#~ msgid "menu Help->Orphans for information " +#~ msgstr "valikko Ohje->Orvot lisätietoja varten " -#~ msgid "" -#~ "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" -#~ msgstr "" -#~ "Vim E458: Ei voi varata vrikartan alkiota, vrit voivat menn vrin" +#~ msgid "type :help cp-default for info on this" +#~ msgstr "kirjoita :help cp-default ohjetta oletuksista varten" -#~ msgid "E250: Fonts for the following charsets are missing in fontset %s:" -#~ msgstr "E250: Seuraavien merkistjoukkojen fontit puuttuvat fontsetist %s:" +#~ msgid "type :set nocp for Vim defaults" +#~ msgstr "kirjoita :set nocp Vimin oletuksiin " -#~ msgid "E252: Fontset name: %s" -#~ msgstr "E252: Fontsetin nimi: %s" +#~ msgid "Running in Vi compatible mode" +#~ msgstr "Suoritetaan Vi-yhteensopivuustilaa" -#~ msgid "Font '%s' is not fixed-width" -#~ msgstr "Fontti %s ei ole tasavlinen" +#~ msgid "type :help version8 for version info" +#~ msgstr "kirjoita :help version8 versiotietoja varten " -#~ msgid "E253: Fontset name: %s\n" -#~ msgstr "E253: Fontsetin nimi: %s\n" +#~ msgid "type :help or for on-line help" +#~ msgstr "kirjoita :help tai ohjetta varten " -#~ msgid "Font0: %s\n" -#~ msgstr "Fontti0: %s\n" +#~ msgid "version " +#~ msgstr "versio " -#~ msgid "Font1: %s\n" -#~ msgstr "Fontti1: %s\n" +#~ msgid "VIM - Vi IMproved" +#~ msgstr "VIM - Vi IMproved" -#~ msgid "Font% width is not twice that of font0\n" -#~ msgstr "Fontti%:n leveys ei ole kaksi kertaa fontti0:n\n" +#~ msgid " DEBUG BUILD" +#~ msgstr " DEBUG-versio" -#~ msgid "Font0 width: %\n" -#~ msgstr "Fontti0:n leveys: %\n" +#~ msgid "Linking: " +#~ msgstr "Linkitys: " -#~ msgid "" -#~ "Font1 width: %\n" -#~ "\n" -#~ msgstr "" -#~ "Fontti1:n leveys: %\n" -#~ "\n" +#~ msgid "Compiler: " +#~ msgstr "Käännin: " -#~ msgid "Invalid font specification" -#~ msgstr "Virheellinen fonttimritys" +#~ msgid "Compilation: " +#~ msgstr "Käännös: " -#~ msgid "&Dismiss" -#~ msgstr "&Ohita" +#~ msgid " system menu file: \"" +#~ msgstr " järjestelmävalikko: \"" -#~ msgid "no specific match" -#~ msgstr "ei tarkkaa tsmyst" - -#~ msgid "Vim - Font Selector" -#~ msgstr "Vim - fonttivalitsin" +#~ msgid " defaults file: \"" +#~ msgstr " defaults-tiedosto: \"" -#~ msgid "Name:" -#~ msgstr "Nimi:" +#~ msgid "3rd user gvimrc file: \"" +#~ msgstr "3. käyttäjän gvimrc: \"" -#~ msgid "Show size in Points" -#~ msgstr "Nyt koko pistein" +#~ msgid "2nd user gvimrc file: \"" +#~ msgstr "2. käyttäjän gvimrc: \"" -#~ msgid "Encoding:" -#~ msgstr "Koodaus:" +#~ msgid " user gvimrc file: \"" +#~ msgstr " käyttäjän gvimrc: \"" -#~ msgid "Font:" -#~ msgstr "Fontti:" +#~ msgid " system gvimrc file: \"" +#~ msgstr " järjestelmän gvimrc: \"" -#~ msgid "Style:" -#~ msgstr "Tyyli:" +#~ msgid " 2nd user exrc file: \"" +#~ msgstr " 2. käyttäjän exrc: \"" -#~ msgid "Size:" -#~ msgstr "Koko:" +#~ msgid " user exrc file: \"" +#~ msgstr " käyttäjän exrc: \"" -#~ msgid "E256: Hangul automata ERROR" -#~ msgstr "E256: Hangu-automaattivirhe" +#~ msgid " 3rd user vimrc file: \"" +#~ msgstr " 3. käyttäjän vimrc: \"" -#~ msgid "E563: stat error" -#~ msgstr "E563: stat-virhe" +#~ msgid " 2nd user vimrc file: \"" +#~ msgstr " 2. käyttäjän vimrc: \"" -#~ msgid "E625: cannot open cscope database: %s" -#~ msgstr "E625: ei voi avata cscope-tietokantaa: %s" +#~ msgid " user vimrc file: \"" +#~ msgstr " käyttäjän vimrc: \"" -#~ msgid "E626: cannot get cscope database information" -#~ msgstr "E626: ei voi hakea cscope-tietokannan tietoja" +#~ msgid "with (classic) GUI." +#~ msgstr "perinteisellä GUIlla." -#~ msgid "Lua library cannot be loaded." -#~ msgstr "Luan kirjastoa ei voitu ladata." +#~ msgid "with Cocoa GUI." +#~ msgstr "Cocoa-GUIlla." -#~ msgid "cannot save undo information" -#~ msgstr "ei voitu tallentaa kumoustietoja" +#~ msgid "with Carbon GUI." +#~ msgstr "Carbon-GUIlla." -#~ msgid "" -#~ "E815: Sorry, this command is disabled, the MzScheme libraries could not " -#~ "be loaded." -#~ msgstr "E815: Sori, komento ei toimi, MzScheme-kirjastoa ei voitu ladata." +#~ msgid "with GUI." +#~ msgstr "GUIlla." -#~ msgid "invalid expression" -#~ msgstr "virheellinen ilmaus" +#~ msgid "with Photon GUI." +#~ msgstr "Photon-GUIlla." -#~ msgid "expressions disabled at compile time" -#~ msgstr "ilmaukset poistettu kytst knnsaikana" +#~ msgid "with X11-Athena GUI." +#~ msgstr "X11-Athena-GUIlla." -#~ msgid "hidden option" -#~ msgstr "piilotettu asetus" +#~ msgid "with X11-neXtaw GUI." +#~ msgstr "X11-neXtaw-GUIlla." -#~ msgid "unknown option" -#~ msgstr "tuntematon asetus" +#~ msgid "with X11-Motif GUI." +#~ msgstr "X11-Motif-GUIlla." -#~ msgid "window index is out of range" -#~ msgstr "ikkunan indeksi alueen ulkopuolella" +#~ msgid "with GTK2 GUI." +#~ msgstr "GTK2-GUIlla." -#~ msgid "couldn't open buffer" -#~ msgstr "ei voitu avata puskuria" +#~ msgid "with GTK2-GNOME GUI." +#~ msgstr "GTK2-Gnome-GUIlla." -#~ msgid "cannot delete line" -#~ msgstr "ei voitu poistaa rivi" +#~ msgid "with GTK3 GUI." +#~ msgstr "GTK3-GUIlla." -#~ msgid "cannot replace line" -#~ msgstr "ei voitu korvata rivi" +#~ msgid "without GUI." +#~ msgstr "ilman GUIta." -#~ msgid "cannot insert line" -#~ msgstr "ei voitu list rivi" +#~ msgid "" +#~ "\n" +#~ "Tiny version " +#~ msgstr "" +#~ "\n" +#~ "Tiny-versio " -#~ msgid "string cannot contain newlines" -#~ msgstr "merkkijono ei saa sislt rivinvaihtoja" +#~ msgid "" +#~ "\n" +#~ "Small version " +#~ msgstr "" +#~ "\n" +#~ "Small-versio " -#~ msgid "Vim error: ~a" -#~ msgstr "Vim-virhe: ~a" +#~ msgid "" +#~ "\n" +#~ "Normal version " +#~ msgstr "" +#~ "\n" +#~ "Normal-versio " -#~ msgid "Vim error" -#~ msgstr "Vim-virhe" +#~ msgid "" +#~ "\n" +#~ "Big version " +#~ msgstr "" +#~ "\n" +#~ "Big-version " -#~ msgid "buffer is invalid" -#~ msgstr "puskuri on virheellinen" +#~ msgid "" +#~ "\n" +#~ "Huge version " +#~ msgstr "" +#~ "\n" +#~ "Huge-versio " -#~ msgid "window is invalid" -#~ msgstr "ikkuna on virheellinen" +#~ msgid "Modified by " +#~ msgstr "Muokannut " -#~ msgid "linenr out of range" -#~ msgstr "rivinumero arvoalueen ulkopuolelta" +#~ msgid "" +#~ "\n" +#~ "Included patches: " +#~ msgstr "" +#~ "\n" +#~ "Pätsit: " -#~ msgid "not allowed in the Vim sandbox" -#~ msgstr "ei sallittu Vimin hiekkalaatikossa" +#~ msgid "" +#~ "\n" +#~ "OpenVMS version" +#~ msgstr "" +#~ "\n" +#~ "OpenVMS-version" -#~ msgid "E836: This Vim cannot execute :python after using :py3" +#~ msgid "" +#~ "\n" +#~ "MacOS version" #~ msgstr "" -#~ "E836: Python: Ei voi kytt komentoja :py ja :py3 samassa istunnossa" +#~ "\n" +#~ "MacOS-version" -#~ msgid "E837: This Vim cannot execute :py3 after using :python" +#~ msgid "" +#~ "\n" +#~ "MacOS X version" #~ msgstr "" -#~ "E837: Python: Ei voi kytt komentoja :py ja :py3 samassa istunnossa" +#~ "\n" +#~ "MacOS X-version" #~ msgid "" -#~ "E263: Sorry, this command is disabled, the Python library could not be " -#~ "loaded." +#~ "\n" +#~ "MacOS X (unix) version" #~ msgstr "" -#~ "E263: Sori, komento ei toimi, Python-kirjaston lataaminen ei onnistunut." +#~ "\n" +#~ "MacOS X-version (unix)" -#~ msgid "can't delete OutputObject attributes" -#~ msgstr "ei voi poistaa OutputObject-attribuutteja" +#~ msgid "" +#~ "\n" +#~ "MS-Windows 32-bit console version" +#~ msgstr "" +#~ "\n" +#~ "MS-Windows 32-bittinen konsoliversio" -#~ msgid "softspace must be an integer" -#~ msgstr "softspacen pit olla kokonaisluku" +#~ msgid "" +#~ "\n" +#~ "MS-Windows 64-bit console version" +#~ msgstr "" +#~ "\n" +#~ "MS-Windows 32-bittinen konsoliversio" -#~ msgid "invalid attribute" -#~ msgstr "virheellinen attribuutti" +#~ msgid " with OLE support" +#~ msgstr " OLE-tuella" -#~ msgid "" -#~ msgstr "" +#~ msgid " in Win32s mode" +#~ msgstr " Win32s-tilassa" -#~ msgid "E659: Cannot invoke Python recursively" -#~ msgstr "E659: Pythonia ei voi kutsua rekursiivisesti" +#~ msgid "" +#~ "\n" +#~ "MS-Windows 32-bit GUI version" +#~ msgstr "" +#~ "\n" +#~ "MS-Windows 32-bittinen GUI-version" -#~ msgid "E265: $_ must be an instance of String" -#~ msgstr "E265: muuttujan $_ pit olla Stringin instanssi" +#~ msgid "" +#~ "\n" +#~ "MS-Windows 64-bit GUI version" +#~ msgstr "" +#~ "\n" +#~ "MS-Windows 64-bittinen GUI-versio" #~ msgid "" -#~ "E266: Sorry, this command is disabled, the Ruby library could not be " -#~ "loaded." -#~ msgstr "E266: Sori, komento ei toimi, Ruby-kirjastoa ei voitu ladata." +#~ "\n" +#~ "MS-Windows 16/32-bit GUI version" +#~ msgstr "" +#~ "\n" +#~ "MS-Windows 16- t. 32-bittinen GUI-versio" -#~ msgid "E267: unexpected return" -#~ msgstr "E267: odotuksenvastainen return" +#~ msgid "E827: Undo file is encrypted: %s" +#~ msgstr "E827: Kumoustiedosto on salattu: %s" -#~ msgid "E268: unexpected next" -#~ msgstr "E268: Odotuksenvastainen next" +#~ msgid "E826: Undo file decryption failed: %s" +#~ msgstr "E826: Kumoustiedoston purku epäonnistui: %s" -#~ msgid "E269: unexpected break" -#~ msgstr "E269: Odotuksenvastainen break" +#~ msgid "E832: Non-encrypted file has encrypted undo file: %s" +#~ msgstr "E832: Salaamattomalla tiedostolla on salattu kumoustiedosto: %s" -#~ msgid "E270: unexpected redo" -#~ msgstr "E270: odotuksenvastainen redo" +#~ msgid "No undo possible; continue anyway" +#~ msgstr "Ei voi kumota, jatketaan silti" -#~ msgid "E271: retry outside of rescue clause" -#~ msgstr "E271: retry rescuen ulkopuolella" +#~ msgid "Used CUT_BUFFER0 instead of empty selection" +#~ msgstr "Käytettiin CUT_BUFFER0:aa tyhjän valinnan sijaan" -#~ msgid "E272: unhandled exception" -#~ msgstr "E272: ksittelemtn poikkeus" +#~ msgid "new shell started\n" +#~ msgstr "uusi kuori avattu\n" -#~ msgid "E273: unknown longjmp status %d" -#~ msgstr "E273: tuntematon longjmp-tila %d" +#~ msgid "Cannot open $VIMRUNTIME/rgb.txt" +#~ msgstr "Ei voida avata tiedostoa $VIMRUNTIME/rgb.txt" -#~ msgid "Toggle implementation/definition" -#~ msgstr "Vaihda toteutuksen ja mritelmn vlill" +#~ msgid "" +#~ "\n" +#~ "--- Terminal keys ---" +#~ msgstr "" +#~ "\n" +#~ "--- Terminaalinäppäimet ---" -#~ msgid "Show base class of" -#~ msgstr "Nyt kantaluokka kohteelle" +#~ msgid "E437: terminal capability \"cm\" required" +#~ msgstr "E437: terminaalilla pitää olla cm kyvyissään" -#~ msgid "Show overridden member function" -#~ msgstr "Nyt korvattu jsenfunktio" +#~ msgid "E436: No \"%s\" entry in termcap" +#~ msgstr "E436: %s ei löytynyt termcapista" -#~ msgid "Retrieve from file" -#~ msgstr "Jljit tiedostosta" +#~ msgid "E559: Terminal entry not found in termcap" +#~ msgstr "E559: Terminaalia ei löytynyt termcapista" -#~ msgid "Retrieve from project" -#~ msgstr "Jljit projektista" +#~ msgid "E558: Terminal entry not found in terminfo" +#~ msgstr "E558: Terminaalia ei löytynyt terminfosta" -#~ msgid "Retrieve from all projects" -#~ msgstr "Jljit kaikista projekteista" +#~ msgid "E557: Cannot open termcap file" +#~ msgstr "E557: Ei voi avata termcap-tiedostoa" -#~ msgid "Retrieve" -#~ msgstr "Jljit" +#~ msgid "defaulting to '" +#~ msgstr "oletusarvona " -#~ msgid "Show source of" -#~ msgstr "Nyt lhdekoodi kohteelle" +#~ msgid "' not known. Available builtin terminals are:" +#~ msgstr " ei tunnettu. Tuetut terminaalit:" -#~ msgid "Find symbol" -#~ msgstr "Etsi symboli" +#~ msgid "E430: Tag file path truncated for %s\n" +#~ msgstr "E430: Tägitiedoston polku katkaistu kohdassa %s\n" + +#~ msgid "E422: terminal code too long: %s" +#~ msgstr "E422: terminaalikoodi liian pitkä: %s" -#~ msgid "Browse class" -#~ msgstr "Selaa luokkaa" +#~ msgid "E845: Insufficient memory, word list will be incomplete" +#~ msgstr "E845: Muisti ei riitä, sanalista jää keskeneräiseksi" -#~ msgid "Show class in hierarchy" -#~ msgstr "Nyt luokka hierarkiassa" +#~ msgid "Conversion in %s not supported" +#~ msgstr "Muutosta kohteessa %s ei tueta" -#~ msgid "Show class in restricted hierarchy" -#~ msgstr "Nyt luokka rajoitetussa hierarkiassa" +#~ msgid "Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\"" +#~ msgstr "Varoitus: Ei löydetty sanalistaa %s_%s.spl tai %s_ascii.spl" -#~ msgid "Xref refers to" -#~ msgstr "Xref viittaa kohteeseen" +#~ msgid "" +#~ "\n" +#~ "# Last %sSearch Pattern:\n" +#~ "~" +#~ msgstr "" +#~ "\n" +#~ "# Edellinen %sHakulauseke:\n" +#~ "~" -#~ msgid "Xref referred by" -#~ msgstr "Xref viitattu kohteesta" +#~ msgid "Substitute " +#~ msgstr "Korvaa " -#~ msgid "Xref has a" -#~ msgstr "Xref sislt kohteen" +#~ msgid "(NFA) COULD NOT OPEN %s !" +#~ msgstr "(NFA) EI VOI AVATA KOHDETTA %s" -#~ msgid "Xref used by" -#~ msgstr "Xrefi kytt" +#~ msgid "" +#~ "Could not open temporary log file for writing, displaying on stderr ... " +#~ msgstr "" +#~ "Ei voitu avata väliaikaislokitiedosta kirjoittamista varten, joten " +#~ "virheet näytetään vakiovirhevirrassa. " -#~ msgid "Show docu of" -#~ msgstr "Nyt dokumentti kohteelle" +#~ msgid "E878: (NFA) Could not allocate memory for branch traversal!" +#~ msgstr "E878: (NFA) Ei voitu allokoida muistia polkujen läpikäyntiin" -#~ msgid "Generate docu for" -#~ msgstr "Luo dokumentti kohteelle" +#~ msgid "E876: (NFA regexp) Not enough space to store the whole NFA " +#~ msgstr "E876: (NFA regexp) Tila ei riitä NFA:n tallentamiseen" #~ msgid "" -#~ "Cannot connect to SNiFF+. Check environment (sniffemacs must be found in " -#~ "$PATH).\n" +#~ "E875: (NFA regexp) (While converting from postfix to NFA), too many " +#~ "states left on stack" #~ msgstr "" -#~ "Ei voida yhdist SNiFF+:aan. Tarkista ympristmuuttujat (sniffemacsin " -#~ "lyty polkumuuttujasta $PATH).\n" +#~ "E875: (NFA regexp) (Muunnettaessa postfixistä NFA:ksi), liikaa tiloja " +#~ "jäljellä pinossa" -#~ msgid "E274: Sniff: Error during read. Disconnected" -#~ msgstr "E274: Sniff: Virhe luettaessa, yhteys katkaistu" +#~ msgid "E874: (NFA) Could not pop the stack !" +#~ msgstr "E874: (NFA) Ei voida poistaa pinosta" -#~ msgid "SNiFF+ is currently " -#~ msgstr "SNiFF+ " +#~ msgid "E873: (NFA regexp) proper termination error" +#~ msgstr "E873: (NFA regexp) oikea lopetusvirhe" -#~ msgid "not " -#~ msgstr "ei ole " +#~ msgid "E879: (NFA regexp) Too many \\z(" +#~ msgstr "E879: (NFA regexp) Liikaa merkkejä \\z(" -#~ msgid "connected" -#~ msgstr "yhdistetty" +#~ msgid "E872: (NFA regexp) Too many '('" +#~ msgstr "E872: (NFA regexp) Liian monta suljetta '('" -#~ msgid "E275: Unknown SNiFF+ request: %s" -#~ msgstr "E275: Tuntematon SNiFF+-pyynt: %s" +#~ msgid "E871: (NFA regexp) Can't have a multi follow a multi !" +#~ msgstr "E871: (NFA regexp) Multi ei voi seurata multia" -#~ msgid "E276: Error connecting to SNiFF+" -#~ msgstr "E276: Virhe yhdistettess SNiFF+:aan" +#~ msgid "E870: (NFA regexp) Error reading repetition limits" +#~ msgstr "E870: (NFA regexp) Virhe luettaessa toiston määriä" -#~ msgid "E278: SNiFF+ not connected" -#~ msgstr "E278: SNiFF+ ei ole yhdistetty" +#~ msgid "E869: (NFA) Unknown operator '\\@%c'" +#~ msgstr "E869: (NFA) Tuntematon operaattori '\\@%c'" -#~ msgid "E279: Not a SNiFF+ buffer" -#~ msgstr "E279: Ei ole SNiFF+-puskuri" +#~ msgid "E868: Error building NFA with equivalence class!" +#~ msgstr "E868: Virhe NFA:n ekvivalenssiluokkia tekemisessä" -#~ msgid "Sniff: Error during write. Disconnected" -#~ msgstr "Sniff: Virhe kirjoituksessa, yhteys katkaistu" +#~ msgid "E867: (NFA) Unknown operator '\\%%%c'" +#~ msgstr "E867: (NFA) Tuntematon operaattori '\\%%%c'" -#~ msgid "invalid buffer number" -#~ msgstr "virheellinen puskurinumero" +#~ msgid "E867: (NFA) Unknown operator '\\z%c'" +#~ msgstr "E867: (NFA) Tuntematon operaattori '\\z%c'" -#~ msgid "not implemented yet" -#~ msgstr "ei toteutettu" +#~ msgid "E877: (NFA regexp) Invalid character class: %ld" +#~ msgstr "E877: (NFA regexp) Virheellinen merkkiluokka: %ld" -#~ msgid "cannot set line(s)" -#~ msgstr "ei voi asettaa rivej" +#~ msgid "E866: (NFA regexp) Misplaced %c" +#~ msgstr "E866: (NFA-regexp) %c väärässä paikassa" -#~ msgid "invalid mark name" -#~ msgstr "virheellinen merkin nimi" +#~ msgid "E865: (NFA) Regexp end encountered prematurely" +#~ msgstr "E865: (NFA) Säännöllisen ilmauksen ennenaikainen loppu" -#~ msgid "mark not set" -#~ msgstr "merkko ei ole asetettu" +#~ msgid "Error file" +#~ msgstr "Virhetiedosto" -#~ msgid "row %d column %d" -#~ msgstr "rivi %d sarake %d" +#~ msgid "shell returned %d" +#~ msgstr "kuori palautti arvon %d" -#~ msgid "cannot insert/append line" -#~ msgstr "rivin lisys ei onnistu" +#~ msgid "Vim Warning" +#~ msgstr "Vim-varoitus" -#~ msgid "line number out of range" -#~ msgstr "rivinumero arvoalueen ulkopuolella" +#~ msgid "" +#~ "VIMRUN.EXE not found in your $PATH.\n" +#~ "External commands will not pause after completion.\n" +#~ "See :help win32-vimrun for more information." +#~ msgstr "" +#~ "VIMRUN.EXEä ei löydy muuttujasta $PATH.\n" +#~ "Ulkoiset komennot eivät pysähdy suorituksen lopussa.\n" +#~ "Lisätietoja komennolla :help win32-vimrun" -#~ msgid "unknown flag: " -#~ msgstr "tuntematon asetus: " +#~ msgid "E371: Command not found" +#~ msgstr "E371: Komentoa ei löydy" -#~ msgid "unknown vimOption" -#~ msgstr "tuntematon vimOption" +#~ msgid "shutdown" +#~ msgstr "sammutus" -#~ msgid "keyboard interrupt" -#~ msgstr "nppimistkeskeytys" +#~ msgid "logoff" +#~ msgstr "uloskirjautuminen" -#~ msgid "vim error" -#~ msgstr "vim-virhe" +#~ msgid "close" +#~ msgstr "sulkeminen" -#~ msgid "cannot create buffer/window command: object is being deleted" -#~ msgstr "ei voi luoda puskuri- tai ikkunakomentoa, olio on poistumassa" +#~ msgid "Vim: Caught %s event\n" +#~ msgstr "Vim: Napattiin %s\n" -#~ msgid "" -#~ "cannot register callback command: buffer/window is already being deleted" -#~ msgstr "callbackia ei voi rekisterid: puskuri tai ikkuna on poistettu" +#~ msgid "Could not fix up function pointers to the DLL!" +#~ msgstr "Ei voitu korjata funktio-osoittimia DLL:ssä" -#~ msgid "" -#~ "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-" -#~ "dev@vim.org" -#~ msgstr "" -#~ "E280: kriittinen TCL-virhe: reflist hajalla? Ilmoita asiasta " -#~ "postituslistalle vim-dev@vim.org" +#~ msgid "VIM Error" +#~ msgstr "VIM-virhe" -#~ msgid "cannot register callback command: buffer/window reference not found" -#~ msgstr "" -#~ "callbackia ei voi rekisterid: puskurin tai ikkunan viitett ei lydy" - -#~ msgid "" -#~ "E571: Sorry, this command is disabled: the Tcl library could not be " -#~ "loaded." -#~ msgstr "E571: Sori, komento ei toimi, Tcl-kirjastoa ei voitu ladata." - -#~ msgid "" -#~ "E281: TCL ERROR: exit code is not int!? Please report this to vim-dev@vim." -#~ "org" -#~ msgstr "" -#~ "E281: TCL-virhe: lopetuskoodi ei ole kokonaisluku? Ilmoita asiasta " -#~ "postituslistalle vim-dev@vim.org" - -#~ msgid "E572: exit code %d" -#~ msgstr "E572: palautusarvo %d" - -#~ msgid "cannot get line" -#~ msgstr "ei voida hakea rivi" - -#~ msgid "Unable to register a command server name" -#~ msgstr "Komentopalvelimen nimen rekisterinti ei onnistu" +#~ msgid "Could not load vim32.dll!" +#~ msgstr "Vim32.dll:ää ei voitu ladata" -#~ msgid "E248: Failed to send command to the destination program" -#~ msgstr "E248: Komennon lhetys kohdeohjelmalle ei onnistu" +#~ msgid "At line" +#~ msgstr "Rivillä" -#~ msgid "E573: Invalid server id used: %s" -#~ msgstr "E573: Virheellinen palvelimen tunniste: %s" +#~ msgid "XSMP SmcOpenConnection failed: %s" +#~ msgstr "XSMP SmcOpenConnection epäonnistui: %s" -#~ msgid "E251: VIM instance registry property is badly formed. Deleted!" -#~ msgstr "E251: VIMin instanssin rekisteriarvo on virheellinen, poistettiin." +#~ msgid "XSMP ICE connection watch failed" +#~ msgstr "XSMP:n ICE-yhteyden tarkkailu epäonnistui" -#~ msgid "netbeans is not supported with this GUI\n" -#~ msgstr "netbeans ei toimi tss kyttliittymss\n" +#~ msgid "XSMP opening connection" +#~ msgstr "XSMP avaa yhteyttä" -#~ msgid "This Vim was not compiled with the diff feature." -#~ msgstr "Thn Vimiin ei ole knnetty diff-toimintoja mukaan." +#~ msgid "XSMP handling save-yourself request" +#~ msgstr "XSMP käsittelee save-yourself-pyyntöä" -#~ msgid "'-nb' cannot be used: not enabled at compile time\n" -#~ msgstr "-nb:t ei voi kytt, koska sit ei knnetty mukaan\n" +#~ msgid "Opening the X display failed" +#~ msgstr "X-näytön avaus epäonnistui" -#~ msgid "Vim: Error: Failure to start gvim from NetBeans\n" -#~ msgstr "Vim: Virhe: Gvimin kynnistys NetBeansist ei onnistu\n" +#~ msgid "XSMP lost ICE connection" +#~ msgstr "XSMP kadotti ICE-yhteyden" #~ msgid "" #~ "\n" -#~ "Where case is ignored prepend / to make flag upper case" +#~ "Command terminated\n" #~ msgstr "" #~ "\n" -#~ "Jos aakkoslaji on ohitettu, lis alkuun / tehdksesi asetuksesta " -#~ "suuraakkosia" - -#~ msgid "-register\t\tRegister this gvim for OLE" -#~ msgstr "-register\t\trekisteri gvim OLEa varten" - -#~ msgid "-unregister\t\tUnregister gvim for OLE" -#~ msgstr "-unregister\t\tPoista gvim OLE-rekisterist" - -#~ msgid "-g\t\t\tRun using GUI (like \"gvim\")" -#~ msgstr "-g\t\t\tAvaa GUI (kuten gvimill)" - -#~ msgid "-f or --nofork\tForeground: Don't fork when starting GUI" -#~ msgstr "-f tai --nofork\tEdustalle: l haarauta GUIn kynnistyksess" - -#~ msgid "-f\t\t\tDon't use newcli to open window" -#~ msgstr "-f\t\t\tl kyt newcli:t ikkunan avaamiseen" - -#~ msgid "-dev \t\tUse for I/O" -#~ msgstr "-dev \t\tKyt IO:hon" - -#~ msgid "-U \t\tUse instead of any .gvimrc" -#~ msgstr "-U \t\tKyt -tiedostoa .gvimrc:iden sijasta" - -#~ msgid "-x\t\t\tEdit encrypted files" -#~ msgstr "-x\t\t\tMuokkaa salattua tiedostoa" - -#~ msgid "-display \tConnect vim to this particular X-server" -#~ msgstr "-display \tYhdist vim tiettyyn X-palvelimeen" - -#~ msgid "-X\t\t\tDo not connect to X server" -#~ msgstr "-X\t\t\tl yhdist X-palvelimeen" - -#~ msgid "--remote \tEdit in a Vim server if possible" -#~ msgstr "" -#~ "--remote \tMuokkaa Vim-palvelimessa, jos " -#~ "mahdollista" - -#~ msgid "--remote-silent Same, don't complain if there is no server" -#~ msgstr "" -#~ "--remote-silent \tSama, mutta l ilmoita puuttuvasta " -#~ "palvelimesta" - -#~ msgid "" -#~ "--remote-wait As --remote but wait for files to have been edited" -#~ msgstr "" -#~ "--remote-wait kuten --remote, mutta odota tiedostojen " -#~ "muokkaamista" - -#~ msgid "" -#~ "--remote-wait-silent Same, don't complain if there is no server" -#~ msgstr "" -#~ "--remote-wait-silent sama, mutta l ilmoita puuttuvasta " -#~ "palvelimesta" +#~ "Komento loppui\n" #~ msgid "" -#~ "--remote-tab[-wait][-silent] As --remote but use tab page per " -#~ "file" -#~ msgstr "" -#~ "--remote-tab[-wait][-silent] kuten --remote, mutta avaa " -#~ "vlilehti joka tiedostolle" - -#~ msgid "--remote-send \tSend to a Vim server and exit" +#~ "\n" +#~ "Cannot execute shell " #~ msgstr "" -#~ "--remote-send \tLhet painalluksina Vimille ja " -#~ "lopeta" +#~ "\n" +#~ "Kuoren suoritus ei onnistu " #~ msgid "" -#~ "--remote-expr \tEvaluate in a Vim server and print result" +#~ "\n" +#~ "Cannot fork\n" #~ msgstr "" -#~ "--remote-expr \tKsittele Vim-palvelimella ja tulosta " -#~ "tulos" - -#~ msgid "--serverlist\t\tList available Vim server names and exit" -#~ msgstr "--serverlist\t\tLuettele Vim-palvelinten nimet ja lopeta" - -#~ msgid "--servername \tSend to/become the Vim server " -#~ msgstr "--servername \tLhet Vim-palvelimelle tai luo se" +#~ "\n" +#~ "Ei voi haarauttaa\n" #~ msgid "" #~ "\n" -#~ "Arguments recognised by gvim (Motif version):\n" +#~ "Cannot create pipes\n" #~ msgstr "" #~ "\n" -#~ "Gvimin (Motif-version) tuntemat argumentit:\n" +#~ "Putkia ei voi tehdä\n" #~ msgid "" #~ "\n" -#~ "Arguments recognised by gvim (neXtaw version):\n" +#~ "Cannot execute shell sh\n" #~ msgstr "" #~ "\n" -#~ "Gvimin (neXtaw-version) tuntemat argumentit:\n" +#~ "Kuoren sh suoritus ei onnistu\n" + +# mikä security context? +#~ msgid "Could not get security context %s for %s. Removing it!" +#~ msgstr "Ei saatu turvallisuuskontekstia %s kohteelle %s ja se poistetaan" + +#~ msgid "Could not set security context %s for %s" +#~ msgstr "Ei voitu asettaa turvallisuuskontekstia %s kohteelle %s" + +#~ msgid "Opening the X display timed out" +#~ msgstr "X-näytön avaus aikakatkaistiin" + +#~ msgid "Testing the X display failed" +#~ msgstr "X-näytön testaus epäonnistui" #~ msgid "" #~ "\n" -#~ "Arguments recognised by gvim (Athena version):\n" +#~ "Vim: Got X error\n" #~ msgstr "" #~ "\n" -#~ "Gvimin (Athena-version) tuntemat argumentit:\n" - -#~ msgid "-display \tRun vim on " -#~ msgstr "-display \tSuorita vim " +#~ "Vim: X-virhe\n" -#~ msgid "-iconic\t\tStart vim iconified" -#~ msgstr "-iconic\t\tKynnist pienennettyn" +#~ msgid "Opening the X display took %ld msec" +#~ msgstr "X-näytön avaus vei %ld millisekuntia" -#~ msgid "-background \tUse for the background (also: -bg)" -#~ msgstr "-background \tKyt taustavrin (mys: -bg)" +#~ msgid "E245: Illegal char '%c' in font name \"%s\"" +#~ msgstr "E245: Virheellinen merkki %c fontin nimessä %s" -#~ msgid "-foreground \tUse for normal text (also: -fg)" -#~ msgstr "-foreground \tKyt tekstin vrin (mys: -fg)" +#~ msgid "E244: Illegal quality name \"%s\" in font name \"%s\"" +#~ msgstr "E244: Virheellinen laatunimi %s fontin nimessä %s" -#~ msgid "-font \t\tUse for normal text (also: -fn)" -#~ msgstr "-font \t\tKyt tekstiss (mys: -fn)" +#~ msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" +#~ msgstr "E244: Virheellinen merkistön nimi %s fontin nimessä %s" -#~ msgid "-boldfont \tUse for bold text" -#~ msgstr "-boldfont \tKyt lihavoidussa tekstiss" +#~ msgid "Printing '%s'" +#~ msgstr "Tulostetaan %s" -#~ msgid "-italicfont \tUse for italic text" -#~ msgstr "-italicfont \tKyt kursivoidussa tekstiss" +#~ msgid "E238: Print error: %s" +#~ msgstr "E238: Tulostinvirhe: %s" -#~ msgid "-geometry \tUse for initial geometry (also: -geom)" -#~ msgstr "" -#~ "-geometry \tKyt mittoja ikkunan asetteluun (mys: -geom)" +#~ msgid "E613: Unknown printer font: %s" +#~ msgstr "E613: Tuntematon tulostimen fontti: %s" -#~ msgid "-borderwidth \tUse a border width of (also: -bw)" -#~ msgstr "-borderwidt \tKyt reunuksissa (mys: -bw) " +#~ msgid "to %s on %s" +#~ msgstr "tulostimelle %s kohteessa %s" -#~ msgid "" -#~ "-scrollbarwidth Use a scrollbar width of (also: -sw)" -#~ msgstr "" -#~ "-scrollbarwidth Kyt vierityspalkissa (mys: -sw)" +#~ msgid "E237: Printer selection failed" +#~ msgstr "E237: Tulostimen valinta epäonnistui" -#~ msgid "-menuheight \tUse a menu bar height of (also: -mh)" -#~ msgstr "-menuheight \tKyt valikossa (mys: -mh)" +#~ msgid "'columns' is not 80, cannot execute external commands" +#~ msgstr "columns ei ole 80, ei voi suorittaa ulkoista komentoa" -#~ msgid "-reverse\t\tUse reverse video (also: -rv)" -#~ msgstr "-reverse\t\tKyt knteisvrej (mys: -rv) " +#~ msgid "I/O ERROR" +#~ msgstr "IO-virhe" -#~ msgid "+reverse\t\tDon't use reverse video (also: +rv)" -#~ msgstr "+reverse\t\tl kyt knteisvrej (mys: +rv)" +#~ msgid "ANCHOR_BUF_SIZE too small." +#~ msgstr "ANCHOR_BUF_SIZE liian pieni." -#~ msgid "-xrm \tSet the specified resource" -#~ msgstr "-xrm \tAseta resurssi" +#~ msgid " returned\n" +#~ msgstr " palautti\n" -#~ msgid "" -#~ "\n" -#~ "Arguments recognised by gvim (RISC OS version):\n" -#~ msgstr "" -#~ "\n" -#~ "Gvimin (RISC OS -version) tuntemat argumentit:\n" +#~ msgid "shell " +#~ msgstr "kuori " -#~ msgid "--columns \tInitial width of window in columns" -#~ msgstr "--columns \tIkkunan alkuleveys sarakkeina" +#~ msgid "Cannot execute " +#~ msgstr "Ei voi suorittaa " -#~ msgid "--rows \tInitial height of window in rows" -#~ msgstr "--rows \tIkkunan alkukorkeus rivein" +#~ msgid "E360: Cannot execute shell with -f option" +#~ msgstr "E360: Kuorta ei voi avata asetuksella -f" -#~ msgid "" -#~ "\n" -#~ "Arguments recognised by gvim (GTK+ version):\n" -#~ msgstr "" -#~ "\n" -#~ "Gvimin (GTK+-version) tuntemat argumentit:\n" +#~ msgid "mch_get_shellsize: not a console??\n" +#~ msgstr "mch_get_shellsize: ei ole konsoli?\n" -#~ msgid "-display \tRun vim on (also: --display)" -#~ msgstr "-display \tSuorita vim nytll (mys: --display)" +#~ msgid "cannot change console mode ?!\n" +#~ msgstr "ei voi vaihtaa konsolitilaa?\n" -# X-ikkunointijrjestelmss saman sovelluksen saman luokan ikkunat -# tunnistetaan rooliresursseista -#~ msgid "--role \tSet a unique role to identify the main window" -#~ msgstr "" -#~ "--role \tAseta pikkunalle ainutlaatuinen rooli tunnisteeksi" +#~ msgid "Vim exiting with %d\n" +#~ msgstr "Vim sulkeutuu koodilla %d\n" -#~ msgid "--socketid \tOpen Vim inside another GTK widget" -#~ msgstr "--socketid \tAvaa Vim annettuun GTK-olioon " +#~ msgid "Cannot create " +#~ msgstr "Ei voi luoda " -#~ msgid "-P \tOpen Vim inside parent application" -#~ msgstr "-P \tAvaa Vim isntohjelman sisn" +#~ msgid "Cannot open NIL:\n" +#~ msgstr "Ei voi avata NILiä:\n" -#~ msgid "--windowid \tOpen Vim inside another win32 widget" -#~ msgstr "--windowid \tAvaa Vim annettuun win32-olioon " +#~ msgid "Need %s version %ld\n" +#~ msgstr "Tarvitaan %s versio %ld\n" -#~ msgid "No display" -#~ msgstr "Ei nytt" +#~ msgid "Need Amigados version 2.04 or later\n" +#~ msgstr "Amigados 2.04 tai uudempi tarvitaan\n" -#~ msgid ": Send failed.\n" -#~ msgstr ": Lhetys eponnistui.\n" +#~ msgid "VIM: Can't open window!\n" +#~ msgstr "VIM: Ei voi avata ikkunaa\n" -#~ msgid ": Send failed. Trying to execute locally\n" -#~ msgstr ": Lhetys eponnistui. Yritetn suorittaa paikallisena\n" +#~ msgid "cannot open " +#~ msgstr "ei voi avata " -#~ msgid "%d of %d edited" -#~ msgstr "%d/%d muokattu" +#~ msgid "E538: No mouse support" +#~ msgstr "E538: Hiirtä ei tueta" -#~ msgid "No display: Send expression failed.\n" -#~ msgstr "Ei nytt: Ilmauksen lhetys eponnistui.\n" +#~ msgid "E533: can't select wide font" +#~ msgstr "E533: Leveän fontin valinta ei onnistu" -#~ msgid ": Send expression failed.\n" -#~ msgstr ": Ilmauksen lhetys eponnistui.\n" +#~ msgid "E598: Invalid fontset" +#~ msgstr "E598: Viallinen fontset" -#~ msgid "E543: Not a valid codepage" -#~ msgstr "E543: Koodisivu ei ole kyp" +#~ msgid "E597: can't select fontset" +#~ msgstr "E597: Fontsetin valinta ei onnistu" -#~ msgid "E285: Failed to create input context" -#~ msgstr "E285: Sytekontekstin luonti ei onnistu" +#~ msgid "E596: Invalid font(s)" +#~ msgstr "E596: Viallisia fontteja" -#~ msgid "E286: Failed to open input method" -#~ msgstr "E286: Sytemetodin avaus ei onnistu" +#~ msgid "E617: Cannot be changed in the GTK+ 2 GUI" +#~ msgstr "E617: Ei voi muuttaa GTK+2-GUIssa" -#~ msgid "E287: Warning: Could not set destroy callback to IM" -#~ msgstr "" -#~ "E287: Varoitus: Ei voitu asettaa destroy-kutsua sytemetodipalvelimelle" +#~ msgid "E531: Use \":gui\" to start the GUI" +#~ msgstr "E531: Käytä komentoa :gui GUIn käynnistämiseen" -#~ msgid "E288: input method doesn't support any style" -#~ msgstr "E288: sytemetodi ei tue tyylej" +#~ msgid "E530: Cannot change term in GUI" +#~ msgstr "E530: Ei voi vaihtaa termiä GUIssa" -#~ msgid "E289: input method doesn't support my preedit type" -#~ msgstr "E289: sytemetodi ei tue tt preedit-tyyppi" +#~ msgid "E522: Not found in termcap" +#~ msgstr "E522: Puuttuu termcapista" -#~ msgid "" -#~ "E833: %s is encrypted and this version of Vim does not support encryption" -#~ msgstr "E833: %s on salattu eik tm Vim tue salausta" +#~ msgid "Thanks for flying Vim" +#~ msgstr "Kiitos että ajoit Vimiä" -#~ msgid "Swap file is encrypted: \"%s\"" -#~ msgstr "Swap-tiedosto on salattu: %s" +#~ msgid "%<%f%h%m%=Page %N" +#~ msgstr "%<%f%h%m%=Sivu %N" #~ msgid "" #~ "\n" -#~ "If you entered a new crypt key but did not write the text file," +#~ "# Registers:\n" #~ msgstr "" #~ "\n" -#~ "Jos kytit uutta salausavainta muttet kirjoittanut tekstitiedostoa," +#~ "# Rekisterit:\n" -#~ msgid "" -#~ "\n" -#~ "enter the new crypt key." -#~ msgstr "" -#~ "\n" -#~ "anna uusi salausavain." +#~ msgid "Illegal register name" +#~ msgstr "Virheellinen rekisterin nimi" + +#~ msgid "freeing %ld lines" +#~ msgstr "vapautetaan %ld riviä" + +#~ msgid "cannot yank; delete anyway" +#~ msgstr "Ei voi kopioida; poista joka tapauksessa" + +#~ msgid "E775: Eval feature not available" +#~ msgstr "E775: Eval ei ole käytettävissä" + +#~ msgid "E505: %s is read-only (add ! to override)" +#~ msgstr "E505: %s on kirjoitussuojattu (lisää komentoon ! ohittaaksesi)" + +#~ msgid "E511: netbeans already connected" +#~ msgstr "E511: netbeans on yhdistetty jo" + +#~ msgid "E838: netbeans is not supported with this GUI" +#~ msgstr "E838: netbeans ei toimi tässä käyttöliittymässä" + +#~ msgid "E658: NetBeans connection lost for buffer %ld" +#~ msgstr "E658: NetBeans-yhteys katkesi puskurille %ld" + +#~ msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" +#~ msgstr "E668: Väärä avaustila NetBeans-yhteyden infotiedostolle: %s" + +#~ msgid "E547: Illegal mouseshape" +#~ msgstr "E547: Virheellinen hiiren muoto" + +#~ msgid "E341: Internal error: lalloc(%ld, )" +#~ msgstr "E341: Sisäinen virhe: lalloc(%ld, )" + +#~ msgid "E340: Line is becoming too long" +#~ msgstr "E340: Rivistä tulee liian pitkä" #~ msgid "" +#~ "[calls] total re/malloc()'s %lu, total free()'s %lu\n" #~ "\n" -#~ "If you wrote the text file after changing the crypt key press enter" #~ msgstr "" +#~ "[kutsut] yht. re/malloc() %lu, yht. free() %lu\n" #~ "\n" -#~ "Jos kirjoitit tekstitiedoston salausavaimen vaihdon jlkeen paina enteri" #~ msgid "" #~ "\n" -#~ "to use the same key for text file and swap file" +#~ "[bytes] total alloc-freed %lu-%lu, in use %lu, peak use %lu\n" #~ msgstr "" #~ "\n" -#~ "kyttksesi samaa avainta teksti- ja swppitiedostoille" +#~ "[tavua] yht. alloc-free %lu-%lu, käytössä %lu, käyttöhuippu %lu\n" -#~ msgid "Using crypt key from swap file for the text file.\n" -#~ msgstr "Kytetn swpin salausavainta tekstitiedostolle\n" +#~ msgid "ERROR: " +#~ msgstr "VIRHE: " -#~ msgid "" -#~ "\n" -#~ " [not usable with this version of Vim]" -#~ msgstr "" -#~ "\n" -#~ " [ei toimi tmn Vim-version kanssa]" - -#~ msgid "Tear off this menu" -#~ msgstr "Repise valikko irti" +#~ msgid "E338: Sorry, no file browser in console mode" +#~ msgstr "E338: tiedostonselain puuttuu konsolitilasta" -#~ msgid "Select Directory dialog" -#~ msgstr "Hakemiston valintaikkuna" +#~ msgid "Open File dialog" +#~ msgstr "Avausikkuna" #~ msgid "Save File dialog" #~ msgstr "Tallennusikkuna" -#~ msgid "Open File dialog" -#~ msgstr "Avausikkuna" +#~ msgid "Select Directory dialog" +#~ msgstr "Hakemiston valintaikkuna" -#~ msgid "E338: Sorry, no file browser in console mode" -#~ msgstr "E338: Sori, tiedostonselain puuttuu konsolitilasta" +#~ msgid "Messages maintainer: Bram Moolenaar " +#~ msgstr "Käännöksen ylläpitäjä: Flammie Pirinen " -#~ msgid "Vim: preserving files...\n" -#~ msgstr "Vim: sstetn tiedostoja...\n" +#~ msgid "E337: Menu not found - check menu names" +#~ msgstr "E337: Valikkoa ei löytynyt - tarkista valikkojen nimet" -#~ msgid "Vim: Finished.\n" -#~ msgstr "Vim: Valmis.\n" +#~ msgid "E336: Menu path must lead to a sub-menu" +#~ msgstr "E336: Valikkopolun pitää johtaa alivalikkoon" -#~ msgid "ERROR: " -#~ msgstr "VIRHE: " +#~ msgid "Tear off this menu" +#~ msgstr "Repäise valikko irti" + +#~ msgid "Swap file already exists!" +#~ msgstr "Swap-tiedosto on jo olemassa" #~ msgid "" #~ "\n" -#~ "[bytes] total alloc-freed %-%, in use %, peak use " -#~ "%\n" +#~ " [not usable with this version of Vim]" #~ msgstr "" #~ "\n" -#~ "[tavua] yht. alloc-free %-%, kytss %, " -#~ "kytthuippu %\n" +#~ " [ei toimi tämän Vim-version kanssa]" + +#~ msgid "Using crypt key from swap file for the text file.\n" +#~ msgstr "Käytetään swäpin salausavainta tekstitiedostolle\n" #~ msgid "" -#~ "[calls] total re/malloc()'s %, total free()'s %\n" #~ "\n" +#~ "to use the same key for text file and swap file" #~ msgstr "" -#~ "[kutsut] yht. re/malloc() %, yht. free() %\n" #~ "\n" +#~ "käyttääksesi samaa avainta teksti- ja swäppitiedostoille" -#~ msgid "E340: Line is becoming too long" -#~ msgstr "E340: Rivist tulee liian pitk" - -#~ msgid "E341: Internal error: lalloc(%, )" -#~ msgstr "E341: Sisinen virhe: lalloc(%, )" - -#~ msgid "E547: Illegal mouseshape" -#~ msgstr "E547: Virheellinen hiiren muoto" - -#~ msgid "Enter encryption key: " -#~ msgstr "Anna salausavain: " - -#~ msgid "Enter same key again: " -#~ msgstr "Anna sama avain uudestaan: " - -#~ msgid "Keys don't match!" -#~ msgstr "Avaimet eivt tsm!" - -#~ msgid "Cannot connect to Netbeans #2" -#~ msgstr "Ei voi yhdist Netbeans #2:een" - -#~ msgid "Cannot connect to Netbeans" -#~ msgstr "Ei voi yhdist Netbeansiin" - -#~ msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" -#~ msgstr "E668: Vr avaustila NetBeans-yhteyden infotiedostolle: %s" +#~ msgid "" +#~ "\n" +#~ "If you wrote the text file after changing the crypt key press enter" +#~ msgstr "" +#~ "\n" +#~ "Jos kirjoitit tekstitiedoston salausavaimen vaihdon jälkeen paina enteriä" -#~ msgid "read from Netbeans socket" -#~ msgstr "luettu Netbeans-soketista" +#~ msgid "" +#~ "\n" +#~ "enter the new crypt key." +#~ msgstr "" +#~ "\n" +#~ "anna uusi salausavain." -#~ msgid "E658: NetBeans connection lost for buffer %" -#~ msgstr "E658: NetBeans-yhteys katkesi puskurille %" +#~ msgid "" +#~ "\n" +#~ "If you entered a new crypt key but did not write the text file," +#~ msgstr "" +#~ "\n" +#~ "Jos käytit uutta salausavainta muttet kirjoittanut tekstitiedostoa," -#~ msgid "E511: netbeans already connected" -#~ msgstr "E511: netbeans on yhdistetty jo" +#~ msgid "Swap file is encrypted: \"%s\"" +#~ msgstr "Swap-tiedosto on salattu: %s" -#~ msgid "E505: " -#~ msgstr "E505: " +#~ msgid "" +#~ "E833: %s is encrypted and this version of Vim does not support encryption" +#~ msgstr "E833: %s on salattu eikä tämä Vim tue salausta" -#~ msgid "E775: Eval feature not available" -#~ msgstr "E775: Eval ei ole kytettviss" +#~ msgid "E843: Error while updating swap file crypt" +#~ msgstr "E843: Virhe päivitettäessä swapin kryptausta" -#~ msgid "freeing % lines" -#~ msgstr "vapautetaan % rivi" +#~ msgid "E289: input method doesn't support my preedit type" +#~ msgstr "E289: syötemetodi ei tue tätä preedit-tyyppiä" -#~ msgid "E530: Cannot change term in GUI" -#~ msgstr "E530: Ei voi vaihtaa termi GUIssa" +#~ msgid "E288: input method doesn't support any style" +#~ msgstr "E288: syötemetodi ei tue tyylejä" -#~ msgid "E531: Use \":gui\" to start the GUI" -#~ msgstr "E531: Kyt komentoa :gui GUIn kynnistmiseen" +#~ msgid "E287: Warning: Could not set destroy callback to IM" +#~ msgstr "" +#~ "E287: Varoitus: Ei voitu asettaa destroy-kutsua syötemetodipalvelimelle" -#~ msgid "E617: Cannot be changed in the GTK+ 2 GUI" -#~ msgstr "E617: Ei voi muuttaa GTK+2-GUIssa" +#~ msgid "E286: Failed to open input method" +#~ msgstr "E286: Syötemetodin avaus ei onnistu" -#~ msgid "E596: Invalid font(s)" -#~ msgstr "E596: Viallisia fontteja" +#~ msgid "E285: Failed to create input context" +#~ msgstr "E285: Syötekontekstin luonti ei onnistu" -#~ msgid "E597: can't select fontset" -#~ msgstr "E597: Fontsetin valinta ei onnistu" +#~ msgid "E284: Cannot set IC values" +#~ msgstr "E284: Ei voi asettaa IC-arvoja" -#~ msgid "E598: Invalid fontset" -#~ msgstr "E598: Viallinen fontset" +#~ msgid "E543: Not a valid codepage" +#~ msgstr "E543: Koodisivu ei ole käypä" -#~ msgid "E533: can't select wide font" -#~ msgstr "E533: Leven fontin valinta ei onnistu" +#~ msgid "Missing '>'" +#~ msgstr "> puuttuu" -#~ msgid "E534: Invalid wide font" -#~ msgstr "E534: Viallinen leve fontti" +#~ msgid "" +#~ "\n" +#~ "# History of marks within files (newest to oldest):\n" +#~ msgstr "" +#~ "\n" +#~ "# Tiedostojen merkkien historia (uusimmasta vanhimpaan):\n" -#~ msgid "E538: No mouse support" -#~ msgstr "E538: Hiirt ei tueta" +#~ msgid "" +#~ "\n" +#~ "# Jumplist (newest first):\n" +#~ msgstr "" +#~ "\n" +#~ "# Hyppylista (uusin ensiksi):\n" -#~ msgid "cannot open " -#~ msgstr "ei voi avata " +#~ msgid "" +#~ "\n" +#~ "# File marks:\n" +#~ msgstr "" +#~ "\n" +#~ "# Tiedoston merkit:\n" -#~ msgid "VIM: Can't open window!\n" -#~ msgstr "VIM: Ei voi avata ikkunaa\n" +#~ msgid ": Send expression failed.\n" +#~ msgstr ": Ilmauksen lähetys epäonnistui.\n" -#~ msgid "Need Amigados version 2.04 or later\n" -#~ msgstr "Amigados 2.04 tai uudempi tarvitaan\n" +#~ msgid "No display: Send expression failed.\n" +#~ msgstr "Ei näyttöä: Ilmauksen lähetys epäonnistui.\n" -#~ msgid "Need %s version %\n" -#~ msgstr "Tarvitaan %s versio %\n" +#~ msgid "%d of %d edited" +#~ msgstr "%d/%d muokattu" -#~ msgid "Cannot open NIL:\n" -#~ msgstr "Ei voi avata NILi:\n" +#~ msgid ": Send failed. Trying to execute locally\n" +#~ msgstr ": Lähetys epäonnistui. Yritetään suorittaa paikallisena\n" -#~ msgid "Cannot create " -#~ msgstr "Ei voi luoda " +#~ msgid ": Send failed.\n" +#~ msgstr ": Lähetys epäonnistui.\n" -#~ msgid "Vim exiting with %d\n" -#~ msgstr "Vim sulkeutuu koodilla %d\n" +#~ msgid "No display" +#~ msgstr "Ei näyttöä" -#~ msgid "cannot change console mode ?!\n" -#~ msgstr "ei voi vaihtaa konsolitilaa?\n" +#~ msgid "--windowid \tOpen Vim inside another win32 widget" +#~ msgstr "--windowid \tAvaa Vim annettuun win32-olioon " -#~ msgid "mch_get_shellsize: not a console??\n" -#~ msgstr "mch_get_shellsize: ei ole konsoli?\n" +#~ msgid "-P \tOpen Vim inside parent application" +#~ msgstr "-P \tAvaa Vim isäntäohjelman sisään" -#~ msgid "E360: Cannot execute shell with -f option" -#~ msgstr "E360: Kuorta ei voi avata asetuksella -f" +#~ msgid "--echo-wid\t\tMake gvim echo the Window ID on stdout" +#~ msgstr "--echo-wid\t\tTulosta gvimin Window ID vakiotulosteeseen" -#~ msgid "Cannot execute " -#~ msgstr "Ei voi suorittaa " +#~ msgid "--socketid \tOpen Vim inside another GTK widget" +#~ msgstr "--socketid \tAvaa Vim annettuun GTK-olioon " -#~ msgid "shell " -#~ msgstr "kuori " +# X-ikkunointijärjestelmässä saman sovelluksen saman luokan ikkunat +# tunnistetaan rooliresursseista +#~ msgid "--role \tSet a unique role to identify the main window" +#~ msgstr "" +#~ "--role \tAseta pääikkunalle ainutlaatuinen rooli tunnisteeksi" -#~ msgid " returned\n" -#~ msgstr " palautti\n" +#~ msgid "-display \tRun vim on (also: --display)" +#~ msgstr "-display \tSuorita vim näytöllä (myös: --display)" -#~ msgid "ANCHOR_BUF_SIZE too small." -#~ msgstr "ANCHOR_BUF_SIZE liian pieni." +#~ msgid "" +#~ "\n" +#~ "Arguments recognised by gvim (GTK+ version):\n" +#~ msgstr "" +#~ "\n" +#~ "Gvimin (GTK+-version) tuntemat argumentit:\n" -#~ msgid "I/O ERROR" -#~ msgstr "IO-virhe" +#~ msgid "-xrm \tSet the specified resource" +#~ msgstr "-xrm \tAseta resurssi" -#~ msgid "Message" -#~ msgstr "Viesti" +#~ msgid "+reverse\t\tDon't use reverse video (also: +rv)" +#~ msgstr "+reverse\t\tÄlä käytä käänteisvärejä (myös: +rv)" -#~ msgid "'columns' is not 80, cannot execute external commands" -#~ msgstr "columns ei ole 80, ei voi suorittaa ulkoista komentoa" +#~ msgid "-reverse\t\tUse reverse video (also: -rv)" +#~ msgstr "-reverse\t\tKäytä käänteisvärejä (myös: -rv) " -#~ msgid "E237: Printer selection failed" -#~ msgstr "E237: Tulostimen valinta eponnistui" +#~ msgid "-menuheight \tUse a menu bar height of (also: -mh)" +#~ msgstr "-menuheight \tKäytä valikossa (myös: -mh)" -#~ msgid "to %s on %s" -#~ msgstr "tulostimelle %s kohteessa %s" +#~ msgid "" +#~ "-scrollbarwidth Use a scrollbar width of (also: -sw)" +#~ msgstr "" +#~ "-scrollbarwidth Käytä vierityspalkissa (myös: -sw)" -#~ msgid "E613: Unknown printer font: %s" -#~ msgstr "E613: Tuntematon tulostimen fontti: %s" +#~ msgid "-borderwidth \tUse a border width of (also: -bw)" +#~ msgstr "-borderwidt \tKäytä reunuksissa (myös: -bw) " -#~ msgid "E238: Print error: %s" -#~ msgstr "E238: Tulostinvirhe: %s" +#~ msgid "-geometry \tUse for initial geometry (also: -geom)" +#~ msgstr "" +#~ "-geometry \tKäytä mittoja ikkunan asetteluun (myös: -geom)" -#~ msgid "Printing '%s'" -#~ msgstr "Tulostetaan %s" +#~ msgid "-italicfont \tUse for italic text" +#~ msgstr "-italicfont \tKäytä kursivoidussa tekstissä" -#~ msgid "E244: Illegal charset name \"%s\" in font name \"%s\"" -#~ msgstr "E244: Virheellinen merkistn nimi %s fontin nimess %s" +#~ msgid "-boldfont \tUse for bold text" +#~ msgstr "-boldfont \tKäytä lihavoidussa tekstissä" -#~ msgid "E245: Illegal char '%c' in font name \"%s\"" -#~ msgstr "E245: Virheellinen merkki %c fontin nimess %s" +#~ msgid "-font \t\tUse for normal text (also: -fn)" +#~ msgstr "-font \t\tKäytä tekstissä (myös: -fn)" -#~ msgid "Vim: Double signal, exiting\n" -#~ msgstr "Vim: Kaksoissignaali, lopetetaan\n" +#~ msgid "-foreground \tUse for normal text (also: -fg)" +#~ msgstr "-foreground \tKäytä tekstin värinä (myös: -fg)" -#~ msgid "Vim: Caught deadly signal %s\n" -#~ msgstr "Vim: Tappava signaali %s\n" +#~ msgid "-background \tUse for the background (also: -bg)" +#~ msgstr "-background \tKäytä taustavärinä (myös: -bg)" -#~ msgid "Vim: Caught deadly signal\n" -#~ msgstr "Vim: Tappava signaali\n" +#~ msgid "-iconic\t\tStart vim iconified" +#~ msgstr "-iconic\t\tKäynnistä pienennettynä" -#~ msgid "Opening the X display took % msec" -#~ msgstr "X-nytn avaus vei % millisekuntia" +#~ msgid "-display \tRun vim on " +#~ msgstr "-display \tSuorita vim " #~ msgid "" #~ "\n" -#~ "Vim: Got X error\n" +#~ "Arguments recognised by gvim (Athena version):\n" #~ msgstr "" #~ "\n" -#~ "Vim: X-virhe\n" - -#~ msgid "Testing the X display failed" -#~ msgstr "X-nytn testaus eponnistui" - -#~ msgid "Opening the X display timed out" -#~ msgstr "X-nytn avaus aikakatkaistiin" +#~ "Gvimin (Athena-version) tuntemat argumentit:\n" #~ msgid "" #~ "\n" -#~ "Cannot execute shell sh\n" +#~ "Arguments recognised by gvim (neXtaw version):\n" #~ msgstr "" #~ "\n" -#~ "Kuoren sh suoritus ei onnistu\n" +#~ "Gvimin (neXtaw-version) tuntemat argumentit:\n" #~ msgid "" #~ "\n" -#~ "Cannot create pipes\n" +#~ "Arguments recognised by gvim (Motif version):\n" #~ msgstr "" #~ "\n" -#~ "Putkia ei voi tehd\n" +#~ "Gvimin (Motif-version) tuntemat argumentit:\n" + +#~ msgid "-i \t\tUse instead of .viminfo" +#~ msgstr "-i \t\tKäytä -tiedostoa .viminfon sijaan" + +#~ msgid "--servername \tSend to/become the Vim server " +#~ msgstr "--servername \tLähetä Vim-palvelimelle tai luo se" + +#~ msgid "--serverlist\t\tList available Vim server names and exit" +#~ msgstr "--serverlist\t\tLuettele Vim-palvelinten nimet ja lopeta" #~ msgid "" -#~ "\n" -#~ "Cannot fork\n" +#~ "--remote-expr \tEvaluate in a Vim server and print result" #~ msgstr "" -#~ "\n" -#~ "Ei voi haarauttaa\n" +#~ "--remote-expr \tKäsittele Vim-palvelimella ja tulosta " +#~ "tulos" + +#~ msgid "--remote-send \tSend to a Vim server and exit" +#~ msgstr "" +#~ "--remote-send \tLähetä painalluksina Vimille ja " +#~ "lopeta" #~ msgid "" -#~ "\n" -#~ "Command terminated\n" +#~ "--remote-tab[-wait][-silent] As --remote but use tab page per " +#~ "file" #~ msgstr "" -#~ "\n" -#~ "Komento loppui\n" +#~ "--remote-tab[-wait][-silent] kuten --remote, mutta avaa " +#~ "välilehti joka tiedostolle" -#~ msgid "XSMP lost ICE connection" -#~ msgstr "XSMP kadotti ICE-yhteyden" +#~ msgid "" +#~ "--remote-wait-silent Same, don't complain if there is no server" +#~ msgstr "" +#~ "--remote-wait-silent sama, mutta älä ilmoita puuttuvasta " +#~ "palvelimesta" -#~ msgid "Opening the X display failed" -#~ msgstr "X-nytn avaus eponnistui" +#~ msgid "" +#~ "--remote-wait As --remote but wait for files to have been edited" +#~ msgstr "" +#~ "--remote-wait kuten --remote, mutta odota tiedostojen " +#~ "muokkaamista" -#~ msgid "XSMP handling save-yourself request" -#~ msgstr "XSMP ksittelee save-yourself-pyynt" +#~ msgid "--remote-silent Same, don't complain if there is no server" +#~ msgstr "" +#~ "--remote-silent \tSama, mutta älä ilmoita puuttuvasta " +#~ "palvelimesta" -#~ msgid "XSMP opening connection" -#~ msgstr "XSMP avaa yhteytt" +#~ msgid "--remote \tEdit in a Vim server if possible" +#~ msgstr "" +#~ "--remote \tMuokkaa Vim-palvelimessa, jos " +#~ "mahdollista" -#~ msgid "XSMP ICE connection watch failed" -#~ msgstr "XSMP:n ICE-yhteyden tarkkailu eponnistui" +#~ msgid "-X\t\t\tDo not connect to X server" +#~ msgstr "-X\t\t\tÄlä yhdistä X-palvelimeen" -#~ msgid "XSMP SmcOpenConnection failed: %s" -#~ msgstr "XSMP SmcOpenConnection eponnistui: %s" +#~ msgid "-display \tConnect vim to this particular X-server" +#~ msgstr "-display \tYhdistä vim tiettyyn X-palvelimeen" -#~ msgid "At line" -#~ msgstr "Rivill" +#~ msgid "-x\t\t\tEdit encrypted files" +#~ msgstr "-x\t\t\tMuokkaa salattua tiedostoa" -#~ msgid "Could not load vim32.dll!" -#~ msgstr "Vim32.dll: ei voitu ladata" +#~ msgid "+\t\t\tStart at end of file" +#~ msgstr "+\t\t\tAloita tiedoston lopusta" -#~ msgid "VIM Error" -#~ msgstr "VIM-virhe" +#~ msgid "-U \t\tUse instead of any .gvimrc" +#~ msgstr "-U \t\tKäytä -tiedostoa .gvimrc:iden sijasta" -#~ msgid "Could not fix up function pointers to the DLL!" -#~ msgstr "Ei voitu korjata funktio-osoittimia DLL:ss" +#~ msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" +#~ msgstr "--not-a-term\t\tOhita varoitus siitä että i/o ei ole terminaali" -#~ msgid "shell returned %d" -#~ msgstr "kuori palautti arvon %d" +#~ msgid "-T \tSet terminal type to " +#~ msgstr "-T \tAseta terminaalin tyypiksi " -#~ msgid "Vim: Caught %s event\n" -#~ msgstr "Vim: Napattiin %s\n" +#~ msgid "-F\t\t\tStart in Farsi mode" +#~ msgstr "-F\t\t\tkäynnistä farsi-tilassa" -#~ msgid "close" -#~ msgstr "sulkeminen" +#~ msgid "-H\t\t\tStart in Hebrew mode" +#~ msgstr "-H\t\t\tkäynnistä heprea-tilassa" -#~ msgid "logoff" -#~ msgstr "uloskirjautuminen" +#~ msgid "-A\t\t\tstart in Arabic mode" +#~ msgstr "-A\t\t\tkäynnistä arabia-tilassa" -#~ msgid "shutdown" -#~ msgstr "sammutus" +#~ msgid "-dev \t\tUse for I/O" +#~ msgstr "-dev \t\tKäytä IO:hon" -#~ msgid "E371: Command not found" -#~ msgstr "E371: Komentoa ei lydy" +#~ msgid "-f\t\t\tDon't use newcli to open window" +#~ msgstr "-f\t\t\tÄlä käytä newcli:tä ikkunan avaamiseen" -#~ msgid "" -#~ "VIMRUN.EXE not found in your $PATH.\n" -#~ "External commands will not pause after completion.\n" -#~ "See :help win32-vimrun for more information." -#~ msgstr "" -#~ "VIMRUN.EXE ei lydy muuttujasta $PATH.\n" -#~ "Ulkoiset komennot eivt pyshdy suorituksen lopussa.\n" -#~ "Listietoja komennolla :help win32-vimrun" +#~ msgid "-L\t\t\tSame as -r" +#~ msgstr "-L\t\t\tkuten -r" -#~ msgid "Vim Warning" -#~ msgstr "Vim-varoitus" +#~ msgid "-D\t\t\tDebugging mode" +#~ msgstr "-D\t\t\tVianetsintätila" -#~ msgid "Error file" -#~ msgstr "Virhetiedosto" +#~ msgid "-N\t\t\tNot fully Vi compatible: 'nocompatible'" +#~ msgstr "-N\t\t\tEi Vi-yhteensopivuutta: nocompatible" -#~ msgid "Conversion in %s not supported" -#~ msgstr "Muutosta kohteessa %s ei tueta" +#~ msgid "-C\t\t\tCompatible with Vi: 'compatible'" +#~ msgstr "-C\t\t\tVi-yhteensopivuustila: compatible" -#~ msgid "E430: Tag file path truncated for %s\n" -#~ msgstr "E430: Tgitiedoston polku katkaistu kohdassa %s\n" +#~ msgid "-l\t\t\tLisp mode" +#~ msgstr "-l\t\t\tLisp-tila" -#~ msgid "new shell started\n" -#~ msgstr "uusi kuori avattu\n" +#~ msgid "-b\t\t\tBinary mode" +#~ msgstr "-b\t\t\tBinääritila" -#~ msgid "Used CUT_BUFFER0 instead of empty selection" -#~ msgstr "Kytettiin CUT_BUFFER0:aa tyhjn valinnan sijaan" +#~ msgid "-Z\t\t\tRestricted mode (like \"rvim\")" +#~ msgstr "-Z\t\t\tRajoitettu tila (kuten rvimillä)" -#~ msgid "No undo possible; continue anyway" -#~ msgstr "Ei voi kumota, jatketaan silti" +#~ msgid "-R\t\t\tReadonly mode (like \"view\")" +#~ msgstr "-R\t\t\tKirjoitussuojattu tila (kuten view'lla)" -#~ msgid "E832: Non-encrypted file has encrypted undo file: %s" -#~ msgstr "E832: Salaamattomalla tiedostolla on salattu kumoustiedosto: %s" +#~ msgid "-y\t\t\tEasy mode (like \"evim\", modeless)" +#~ msgstr "-y\t\t\tHelppokäyttötila (kuten evimissä, ilman tiloja)" -#~ msgid "E826: Undo file decryption failed: %s" -#~ msgstr "E826: Kumoustiedoston purku eponnistui: %s" +#~ msgid "-d\t\t\tDiff mode (like \"vimdiff\")" +#~ msgstr "-d\t\t\tDiff-tila (kuten vimdiffillä)" -#~ msgid "E827: Undo file is encrypted: %s" -#~ msgstr "E827: Kumoustiedosto on salattu: %s" +#~ msgid "-E\t\t\tImproved Ex mode" +#~ msgstr "-E\t\t\tParanneltu Ex-tila" + +#~ msgid "-e\t\t\tEx mode (like \"ex\")" +#~ msgstr "-e\t\t\tEx-tila (kute exillä)" + +#~ msgid "-v\t\t\tVi mode (like \"vi\")" +#~ msgstr "-v\t\t\tVi-tila (kuten villä)" + +#~ msgid "-f or --nofork\tForeground: Don't fork when starting GUI" +#~ msgstr "-f tai --nofork\tEdustalle: Älä haarauta GUIn käynnistyksessä" + +#~ msgid "-g\t\t\tRun using GUI (like \"gvim\")" +#~ msgstr "-g\t\t\tAvaa GUI (kuten gvimillä)" + +#~ msgid "-unregister\t\tUnregister gvim for OLE" +#~ msgstr "-unregister\t\tPoista gvim OLE-rekisteristä" + +#~ msgid "-register\t\tRegister this gvim for OLE" +#~ msgstr "-register\t\trekisteröi gvim OLEa varten" #~ msgid "" #~ "\n" -#~ "MS-Windows 16/32-bit GUI version" +#~ "Where case is ignored prepend / to make flag upper case" #~ msgstr "" #~ "\n" -#~ "MS-Windows 16- t. 32-bittinen GUI-versio" +#~ "Jos aakkoslaji on ohitettu, lisää alkuun / tehdäksesi asetuksesta " +#~ "suuraakkosia" #~ msgid "" #~ "\n" -#~ "MS-Windows 64-bit GUI version" +#~ " or:" #~ msgstr "" #~ "\n" -#~ "MS-Windows 64-bittinen GUI-versio" +#~ " tai:" + +#~ msgid " vim [arguments] " +#~ msgstr " vim [argumentit] " + +#~ msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" +#~ msgstr "Vim: Virhe: Tämä versio Vimistä ei toimi Cygwinin terminaalissa\n" + +#~ msgid "Vim: Error: Failure to start gvim from NetBeans\n" +#~ msgstr "Vim: Virhe: Gvimin käynnistys NetBeansistä ei onnistu\n" + +#~ msgid "This Vim was not compiled with the diff feature." +#~ msgstr "Tähän Vimiin ei ole käännetty diff-toimintoja mukaan." + +#~ msgid "'-nb' cannot be used: not enabled at compile time\n" +#~ msgstr "-nb:tä ei voi käyttää, koska sitä ei käännetty mukaan\n" + +#~ msgid "netbeans is not supported with this GUI\n" +#~ msgstr "netbeans ei toimi tässä käyttöliittymässä\n" + +#~ msgid "%d files to edit\n" +#~ msgstr "%d tiedostoa muokattavana\n" + +#~ msgid "E251: VIM instance registry property is badly formed. Deleted!" +#~ msgstr "E251: VIMin instanssin rekisteriarvo on virheellinen, poistettiin." + +#~ msgid "E573: Invalid server id used: %s" +#~ msgstr "E573: Virheellinen palvelimen tunniste: %s" + +#~ msgid "E248: Failed to send command to the destination program" +#~ msgstr "E248: Komennon lähetys kohdeohjelmalle ei onnistu" + +#~ msgid "Unable to register a command server name" +#~ msgstr "Komentopalvelimen nimen rekisteröinti ei onnistu" + +#~ msgid "cannot get line" +#~ msgstr "ei voida hakea riviä" + +#~ msgid "E572: exit code %d" +#~ msgstr "E572: palautusarvo %d" #~ msgid "" -#~ "\n" -#~ "MS-Windows 32-bit GUI version" +#~ "E571: Sorry, this command is disabled: the Tcl library could not be " +#~ "loaded." +#~ msgstr "E571: komento ei toimi, Tcl-kirjastoa ei voitu ladata." + +#~ msgid "cannot register callback command: buffer/window reference not found" #~ msgstr "" -#~ "\n" -#~ "MS-Windows 32-bittinen GUI-version" +#~ "callbackia ei voi rekisteröidä: puskurin tai ikkunan viitettä ei löydy" -#~ msgid " in Win32s mode" -#~ msgstr " Win32s-tilassa" +#~ msgid "" +#~ "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-" +#~ "dev@vim.org" +#~ msgstr "" +#~ "E280: kriittinen TCL-virhe: reflist hajalla? Ilmoita asiasta " +#~ "postituslistalle vim-dev@vim.org" -#~ msgid " with OLE support" -#~ msgstr " OLE-tuella" +#~ msgid "" +#~ "cannot register callback command: buffer/window is already being deleted" +#~ msgstr "callbackia ei voi rekisteröidä: puskuri tai ikkuna on poistettu" + +#~ msgid "cannot create buffer/window command: object is being deleted" +#~ msgstr "ei voi luoda puskuri- tai ikkunakomentoa, olio on poistumassa" + +#~ msgid "vim error" +#~ msgstr "vim-virhe" + +#~ msgid "unknown vimOption" +#~ msgstr "tuntematon vimOption" + +#~ msgid "unknown flag: " +#~ msgstr "tuntematon asetus: " + +#~ msgid "cannot insert/append line" +#~ msgstr "rivin lisäys ei onnistu" + +#~ msgid "row %d column %d" +#~ msgstr "rivi %d sarake %d" + +#~ msgid "mark not set" +#~ msgstr "merkko ei ole asetettu" + +#~ msgid "cannot set line(s)" +#~ msgstr "ei voi asettaa rivejä" + +#~ msgid "not implemented yet" +#~ msgstr "ei toteutettu" + +#~ msgid "E273: unknown longjmp status %d" +#~ msgstr "E273: tuntematon longjmp-tila %d" + +#~ msgid "E272: unhandled exception" +#~ msgstr "E272: käsittelemätön poikkeus" + +#~ msgid "E271: retry outside of rescue clause" +#~ msgstr "E271: retry rescuen ulkopuolella" + +#~ msgid "E269: unexpected break" +#~ msgstr "E269: Odotuksenvastainen break" + +#~ msgid "E268: unexpected next" +#~ msgstr "E268: Odotuksenvastainen next" + +#~ msgid "E267: unexpected return" +#~ msgstr "E267: odotuksenvastainen return" #~ msgid "" -#~ "\n" -#~ "MS-Windows 64-bit console version" +#~ "E266: Sorry, this command is disabled, the Ruby library could not be " +#~ "loaded." +#~ msgstr "E266: komento ei toimi, Ruby-kirjastoa ei voitu ladata." + +#~ msgid "E265: $_ must be an instance of String" +#~ msgstr "E265: muuttujan $_ pitää olla Stringin instanssi" + +#~ msgid "E837: This Vim cannot execute :py3 after using :python" #~ msgstr "" -#~ "\n" -#~ "MS-Windows 32-bittinen konsoliversio" +#~ "E837: Python: Ei voi käyttää komentoja :py ja :py3 samassa istunnossa" + +#~ msgid "E659: Cannot invoke Python recursively" +#~ msgstr "E659: Pythonia ei voi kutsua rekursiivisesti" + +#~ msgid "" +#~ "E887: Sorry, this command is disabled, the Python's site module could not " +#~ "be loaded." +#~ msgstr "" +#~ "E887: Komento ei toimi, Pythonin site-moduulien lataaminen ei onnistunut." + +#~ msgid "" +#~ "E263: Sorry, this command is disabled, the Python library could not be " +#~ "loaded." +#~ msgstr "E263: komento ei toimi, Python-kirjaston lataaminen ei onnistunut." + +#~ msgid "E836: This Vim cannot execute :python after using :py3" +#~ msgstr "" +#~ "E836: Python: Ei voi käyttää komentoja :py ja :py3 samassa istunnossa" + +#~ msgid "not allowed in the Vim sandbox" +#~ msgstr "ei sallittu Vimin hiekkalaatikossa" + +#~ msgid "linenr out of range" +#~ msgstr "rivinumero arvoalueen ulkopuolelta" + +#~ msgid "window is invalid" +#~ msgstr "ikkuna on virheellinen" + +#~ msgid "buffer is invalid" +#~ msgstr "puskuri on virheellinen" + +#~ msgid "Vim error" +#~ msgstr "Vim-virhe" + +#~ msgid "Vim error: ~a" +#~ msgstr "Vim-virhe: ~a" + +#~ msgid "couldn't open buffer" +#~ msgstr "ei voitu avata puskuria" + +#~ msgid "unknown option" +#~ msgstr "tuntematon asetus" + +#~ msgid "hidden option" +#~ msgstr "piilotettu asetus" + +#~ msgid "expressions disabled at compile time" +#~ msgstr "ilmaukset poistettu käytöstä käännösaikana" + +#~ msgid "invalid expression" +#~ msgstr "virheellinen ilmaus" + +#~ msgid "" +#~ "E895: Sorry, this command is disabled, the MzScheme's racket/base module " +#~ "could not be loaded." +#~ msgstr "" +#~ "E895: Komento ei toimi, MzScheme-moduulia racket/base ei voitu ladata." + +#~ msgid "" +#~ "E815: Sorry, this command is disabled, the MzScheme libraries could not " +#~ "be loaded." +#~ msgstr "E815: komento ei toimi, MzScheme-kirjastoa ei voitu ladata." + +#~ msgid "Lua library cannot be loaded." +#~ msgstr "Luan kirjastoa ei voitu ladata." + +#~ msgid "E626: cannot get cscope database information" +#~ msgstr "E626: ei voi hakea cscope-tietokannan tietoja" + +#~ msgid "E625: cannot open cscope database: %s" +#~ msgstr "E625: ei voi avata cscope-tietokantaa: %s" + +#~ msgid "E563: stat error" +#~ msgstr "E563: stat-virhe" + +#~ msgid "E256: Hangul automata ERROR" +#~ msgstr "E256: Hangu-automaattivirhe" + +#~ msgid "Size:" +#~ msgstr "Koko:" + +#~ msgid "Style:" +#~ msgstr "Tyyli:" + +#~ msgid "Font:" +#~ msgstr "Fontti:" + +#~ msgid "Encoding:" +#~ msgstr "Koodaus:" + +#~ msgid "Show size in Points" +#~ msgstr "Näytä koko pisteinä" + +#~ msgid "Name:" +#~ msgstr "Nimi:" + +#~ msgid "Vim - Font Selector" +#~ msgstr "Vim - fonttivalitsin" + +#~ msgid "no specific match" +#~ msgstr "ei tarkkaa täsmäystä" + +#~ msgid "&Dismiss" +#~ msgstr "&Ohita" + +#~ msgid "Invalid font specification" +#~ msgstr "Virheellinen fonttimääritys" + +#~ msgid "Font1 width: %ld" +#~ msgstr "Fontti1:n leveys: %ld" + +#~ msgid "Font0 width: %ld" +#~ msgstr "Fontti0:n leveys: %ld" + +#~ msgid "Font%ld width is not twice that of font0" +#~ msgstr "Fontti%ld:n leveys ei ole kaksi kertaa fontti0:n" + +#~ msgid "Font1: %s" +#~ msgstr "Fontti1: %s" + +#~ msgid "Font0: %s" +#~ msgstr "Fontti0: %s" + +#~ msgid "E253: Fontset name: %s" +#~ msgstr "E253: Fontsetin nimi: %s" + +#~ msgid "Font '%s' is not fixed-width" +#~ msgstr "Fontti %s ei ole tasavälinen" + +#~ msgid "E252: Fontset name: %s" +#~ msgstr "E252: Fontsetin nimi: %s" + +#~ msgid "E250: Fonts for the following charsets are missing in fontset %s:" +#~ msgstr "E250: Seuraavien merkistöjoukkojen fontit puuttuvat fontsetistä %s:" + +#~ msgid "" +#~ "Vim E458: Cannot allocate colormap entry, some colors may be incorrect" +#~ msgstr "" +#~ "Vim E458: Ei voi varata värikartan alkiota, värit voivat mennä väärin" + +# MDI eli windowsin moni-ikkunasovellus +#~ msgid "E672: Unable to open window inside MDI application" +#~ msgstr "E672: Ikkunaa ei voitu avata MDI-sovellukseen" + +# OLE on object linking and embedding på windowska +#~ msgid "E243: Argument not supported: \"-%s\"; Use the OLE version." +#~ msgstr "E243: Argumenttia ei tueta: -%s, käytä OLE-versiota" + +#~ msgid "Directory\t*.nothing\n" +#~ msgstr "Hakemisto\t*.nothing\n" + +#~ msgid "Not Used" +#~ msgstr "Ei käytössä" + +#~ msgid "Find & Replace (use '\\\\' to find a '\\')" +#~ msgstr "Etsi ja korvaa (\\\\:llä löytää \\:t)" + +#~ msgid "Find string (use '\\\\' to find a '\\')" +#~ msgstr "Etsi merkkijonoa (\\\\:llä löytää \\:t)" + +#~ msgid "Open tab..." +#~ msgstr "Avaa välilehti..." + +#~ msgid "&Undo" +#~ msgstr "&Kumoa" + +#~ msgid "Replace &All" +#~ msgstr "Korvaa k&aikki" + +#~ msgid "&Replace" +#~ msgstr "Ko&rvaa" + +#~ msgid "Find &Next" +#~ msgstr "Hae &seuraava" + +#~ msgid "Selection" +#~ msgstr "Valinta" + +#~ msgid "&OK" +#~ msgstr "&Ok" + +#~ msgid "Files" +#~ msgstr "Tiedostot" + +#~ msgid "&Help" +#~ msgstr "O&hje" + +#~ msgid "Filter" +#~ msgstr "Suodatus" + +#~ msgid "Directories" +#~ msgstr "Hakemistot" + +#~ msgid "&Cancel" +#~ msgstr "&Peru" + +#~ msgid "&Filter" +#~ msgstr "&Suodata" + +#~ msgid "Vim: Main window unexpectedly destroyed\n" +#~ msgstr "Vim: Pääikkuna tuhoutui odottamatta\n" + +#~ msgid "Open Tab..." +#~ msgstr "Avaa välilehti..." + +#~ msgid "New tab" +#~ msgstr "Uusi välilehti" + +#~ msgid "Close tab" +#~ msgstr "Sulje välilehti" + +#~ msgid "Vim: Received \"die\" request from session manager\n" +#~ msgstr "Vim: sessiomanageri lähetti die-pyynnön\n" + +#~ msgid "_Close" +#~ msgstr "_Sulje" + +#~ msgid "Replace All" +#~ msgstr "Korvaa kaikki" + +#~ msgid "Replace" +#~ msgstr "Korvaa" + +#~ msgid "Find Next" +#~ msgstr "Etsi seuraava" + +#~ msgid "Down" +#~ msgstr "Alas" + +#~ msgid "Up" +#~ msgstr "Ylös" + +#~ msgid "Direction" +#~ msgstr "Suunta" + +#~ msgid "Match case" +#~ msgstr "Kirjaintaso" + +#~ msgid "Match whole word only" +#~ msgstr "Korvaa kokonaisia sanoja" + +#~ msgid "Replace with:" +#~ msgstr "Korvaa:" + +#~ msgid "Find what:" +#~ msgstr "Etsi:" + +#~ msgid "VIM - Search..." +#~ msgstr "VIM - Etsi..." + +#~ msgid "VIM - Search and Replace..." +#~ msgstr "VIM - Etsi ja korvaa..." + +#~ msgid "Input _Methods" +#~ msgstr "Syöte_menetelmät" + +#~ msgid "No" +#~ msgstr "Ei" + +#~ msgid "Yes" +#~ msgstr "Kyllä" + +#~ msgid "_OK" +#~ msgstr "_OK" + +#~ msgid "_Open" +#~ msgstr "_Avaa" + +#~ msgid "_Save" +#~ msgstr "_Tallenna" + +#~ msgid "_Cancel" +#~ msgstr "_Peru" + +#~ msgid "E232: Cannot create BalloonEval with both message and callback" +#~ msgstr "E232: Ei voi luoda BalloonEvalia viestille ja callbackille" + +#~ msgid "Vim dialog" +#~ msgstr "Vim-ikkuna" + +#~ msgid "Scrollbar Widget: Could not get geometry of thumb pixmap." +#~ msgstr "Vierityspalkki: Pixmapin geometria ei selviä" -#~ msgid "" -#~ "\n" -#~ "MS-Windows 32-bit console version" -#~ msgstr "" -#~ "\n" -#~ "MS-Windows 32-bittinen konsoliversio" +#~ msgid "Cancel" +#~ msgstr "Peru" -#~ msgid "" -#~ "\n" -#~ "MS-Windows 16-bit version" -#~ msgstr "" -#~ "\n" -#~ "MS-Windows 16-bittinen versio" +#~ msgid "OK" +#~ msgstr "OK" -#~ msgid "" -#~ "\n" -#~ "32-bit MS-DOS version" -#~ msgstr "" -#~ "\n" -#~ "32-bittinen MS-DOS-versio" +#~ msgid "E615: vim_SelFile: can't get current directory" +#~ msgstr "E615: vim_SelFile: nykyistä hakemistoa ei saada selville" -#~ msgid "" -#~ "\n" -#~ "16-bit MS-DOS version" -#~ msgstr "" -#~ "\n" -#~ "16-bittinen MS-DOS-versio" +#~ msgid "Pathname:" +#~ msgstr "Polku:" -#~ msgid "" -#~ "\n" -#~ "MacOS X (unix) version" -#~ msgstr "" -#~ "\n" -#~ "MacOS X-version (unix)" +#~ msgid "E614: vim_SelFile: can't return to current directory" +#~ msgstr "E614: vim_SelFile: nykyiseen hakemistoon ei voi palata" -#~ msgid "" -#~ "\n" -#~ "MacOS X version" -#~ msgstr "" -#~ "\n" -#~ "MacOS X-version" +#~ msgid "E616: vim_SelFile: can't get font %s" +#~ msgstr "E616: vim_SelFile: ei saada fonttia %s" -#~ msgid "" -#~ "\n" -#~ "MacOS version" -#~ msgstr "" -#~ "\n" -#~ "MacOS-version" +#~ msgid " " +#~ msgstr " " -#~ msgid "" -#~ "\n" -#~ "RISC OS version" -#~ msgstr "" -#~ "\n" -#~ "RISC OS-version" +#~ msgid "No match at cursor, finding next" +#~ msgstr "Ei täsmäystä kursorin alla, etsitään seuraava" -#~ msgid "" -#~ "\n" -#~ "OpenVMS version" -#~ msgstr "" -#~ "\n" -#~ "OpenVMS-version" +#~ msgid "E599: Value of 'imactivatekey' is invalid" +#~ msgstr "E599: imactivatekeyn arvo on virheellinen" -#~ msgid "" -#~ "\n" -#~ "Big version " -#~ msgstr "" -#~ "\n" -#~ "Big-version " +#~ msgid "E231: 'guifontwide' invalid" +#~ msgstr "E231: guifontwide virheellinen" -#~ msgid "" -#~ "\n" -#~ "Normal version " -#~ msgstr "" -#~ "\n" -#~ "Normal-versio " +#~ msgid "E665: Cannot start GUI, no valid font found" +#~ msgstr "E665: Ei voi avata GUIta, sopivaa fonttia ei löydy" -#~ msgid "" -#~ "\n" -#~ "Small version " -#~ msgstr "" -#~ "\n" -#~ "Small-versio " +#~ msgid "E230: Cannot read from \"%s\"" +#~ msgstr "E230: Ei voi lukea kohteesta %s" -#~ msgid "" -#~ "\n" -#~ "Tiny version " -#~ msgstr "" -#~ "\n" -#~ "Tiny-versio " +#~ msgid "E229: Cannot start the GUI" +#~ msgstr "E229: GUIn käynnistys ei onnistu" -#~ msgid "with GTK2-GNOME GUI." -#~ msgstr "GTK2-Gnome-GUIlla." +#~ msgid "E851: Failed to create a new process for the GUI" +#~ msgstr "E851: Ei voitu luoda uutta prosessia käyttöliittymälle" -#~ msgid "with GTK2 GUI." -#~ msgstr "GTK2-GUIlla." +# tietääkseni resurssiforkki on applen tiedostojärjestelmän tunnistejuttujuttu +#~ msgid "E460: The resource fork would be lost (add ! to override)" +#~ msgstr "E460: resurssiosa häviäisi (lisää komentoon ! ohittaaksesi)" -#~ msgid "with X11-Motif GUI." -#~ msgstr "X11-Motif-GUIlla." +#~ msgid "writing to device disabled with 'opendevice' option" +#~ msgstr "laitteeseen kirjoittaminen pois käytöstä opendevice-asetuksella" -#~ msgid "with X11-neXtaw GUI." -#~ msgstr "X11-neXtaw-GUIlla." +#~ msgid "Partial writes disallowed for NetBeans buffers" +#~ msgstr "Osittaiset kirjoitukset kielletty NetBeans-puskureissa" -#~ msgid "with X11-Athena GUI." -#~ msgstr "X11-Athena-GUIlla." +#~ msgid "NetBeans disallows writes of unmodified buffers" +#~ msgstr "NetBeans ei salli kirjoittaa muokkaamattomiin puskureihin" -#~ msgid "with Photon GUI." -#~ msgstr "Photon-GUIlla." +#~ msgid "Reading from stdin..." +#~ msgstr "Luetaan vakiosyötteestä" -#~ msgid "with GUI." -#~ msgstr "GUIlla." +#~ msgid "Vim: Reading from stdin...\n" +#~ msgstr "Vim: Luetaan vakiosyötteestä...\n" -#~ msgid "with Carbon GUI." -#~ msgstr "Carbon-GUIlla." +#~ msgid "is a device (disabled with 'opendevice' option)" +#~ msgstr "on laite (ei käytössä opendevice-asetuksen takia)" -#~ msgid "with Cocoa GUI." -#~ msgstr "Cocoa-GUIlla." +#~ msgid "Debug Line" +#~ msgstr "Vianetsintärivi" -#~ msgid "with (classic) GUI." -#~ msgstr "perinteisell GUIlla." +#~ msgid "Input Line" +#~ msgstr "Syöterivi" -#~ msgid " system gvimrc file: \"" -#~ msgstr " jrjestelmn gvimrc: \"" +#~ msgid "Expression" +#~ msgstr "Ilmaus" -#~ msgid " user gvimrc file: \"" -#~ msgstr " kyttjn gvimrc: \"" +#~ msgid "Search String" +#~ msgstr "Hakujono" -#~ msgid "2nd user gvimrc file: \"" -#~ msgstr "2. kyttjn gvimrc: \"" +#~ msgid "Command Line" +#~ msgstr "Komentorivi" -#~ msgid "3rd user gvimrc file: \"" -#~ msgstr "3. kyttjn gvimrc: \"" +#~ msgid "" +#~ "\n" +#~ "# %s History (newest to oldest):\n" +#~ msgstr "" +#~ "\n" +#~ "# %s Historia (uusimmasta alkaen):\n" -#~ msgid " system menu file: \"" -#~ msgstr " jrjestelmvalikko: \"" +#~ msgid "E196: No digraphs in this version" +#~ msgstr "E196: Digraafeja ei ole tässä versiossa" -#~ msgid "Compiler: " -#~ msgstr "Knnin: " +#~ msgid "E195: Cannot open viminfo file for reading" +#~ msgstr "E195: Viminfoa ei voi avata lukemista varten" -#~ msgid "menu Help->Orphans for information " -#~ msgstr "valikko Ohje->Orvot listietoja varten " +#~ msgid "E809: #< is not available without the +eval feature" +#~ msgstr "E809: #< ei ole käytössä jollei +eval ole päällä" -#~ msgid "Running modeless, typed text is inserted" -#~ msgstr "Suoritetaan tilattomana, kirjoitettu teksti sytetn" +#~ msgid "Save Setup" +#~ msgstr "Tallenna asetukset" -#~ msgid "menu Edit->Global Settings->Toggle Insert Mode " -#~ msgstr "valikko Muokkaa->Yleiset asetukset->Vaihda sytetilaa" +#~ msgid "Save Session" +#~ msgstr "Tallenna sessio" -#~ msgid " for two modes " -#~ msgstr " kahta tilaa varten " +#~ msgid "Save View" +#~ msgstr "Tallenna näkymä" -#~ msgid "menu Edit->Global Settings->Toggle Vi Compatible" -#~ msgstr "valikko Muokkaa->Yleiset asetukset->Vaihda Vi-yhteensopivuutta" +#~ msgid "Save Redirection" +#~ msgstr "Tallenna uudelleenosoitus" -#~ msgid " for Vim defaults " -#~ msgstr " Vim-oletuksia varten" +#~ msgid "E930: Cannot use :redir inside execute()" +#~ msgstr "E930: Komentoa :redir ei voi käyttää funktion execute() sisällä" -#~ msgid "WARNING: Windows 95/98/ME detected" -#~ msgstr "VAROITUS: Window 95/98/ME havaittu" +#~ msgid "E466: :winpos requires two number arguments" +#~ msgstr "E466: :winpos vaatii kaksi lukuargumenttia" -#~ msgid "type :help windows95 for info on this" -#~ msgstr "kirjoita :help windows95 listietoja varten" +#~ msgid "E188: Obtaining window position not implemented for this platform" +#~ msgstr "E188: Ikkunan sijainnin selvitys ei toimi tällä alustalla" -#~ msgid "E370: Could not load library %s" -#~ msgstr "E370: Kirjaston %s lataaminen ei onnistu" +#~ msgid "Window position: X %d, Y %d" +#~ msgstr "Ikkunan sijainti: X %d, Y %d" #~ msgid "" -#~ "Sorry, this command is disabled: the Perl library could not be loaded." -#~ msgstr "Sori, komento ei toimi, Perl kirjastoa ei voinut ladata." +#~ "E747: Cannot change directory, buffer is modified (add ! to override)" +#~ msgstr "" +#~ "E747: Hakemistoa ei voida muuttaa, puskuria on muokattu (lisää " +#~ "komentoon ! ohittaaksesi" -#~ msgid "E299: Perl evaluation forbidden in sandbox without the Safe module" -#~ msgstr "E299: Perl-suoritus kielletty hiekkalaatikossa ilman Safe-moduulia" +#~ msgid "Append File" +#~ msgstr "Lisää tiedostoon" -#~ msgid "Edit with &multiple Vims" -#~ msgstr "&Muokkaa usealla Vimill" +#~ msgid "Edit File in new window" +#~ msgstr "Muokkaa uudessa ikkunassa" -#~ msgid "Edit with single &Vim" -#~ msgstr "Muokkaa yhdell &Vimill" +#~ msgid "unknown" +#~ msgstr "tuntematon" -#~ msgid "Diff with Vim" -#~ msgstr "Diffi Vimill" +#~ msgid "E172: Only one file name allowed" +#~ msgstr "E172: Vain yksi tiedostonimi sallitaan" -#~ msgid "Edit with &Vim" -#~ msgstr "Muokkaa &Vimill" +#~ msgid "Source Vim script" +#~ msgstr "Lataa vim-skripti" -#~ msgid "Edit with existing Vim - " -#~ msgstr "Muokkaa olemassaolevalla Vimill - " +#~ msgid " (NOT FOUND)" +#~ msgstr " (EI LÖYTYNYT)" -#~ msgid "Edits the selected file(s) with Vim" -#~ msgstr "Muokkaa valittuja tiedostoja Vimill" +#~ msgid "" +#~ "\n" +#~ "# Last Substitute String:\n" +#~ "$" +#~ msgstr "" +#~ "\n" +#~ "# Viimeisin korvausmerkkijono:\n" +#~ "$" -#~ msgid "Error creating process: Check if gvim is in your path!" -#~ msgstr "Virhe prosessin kynnistmisess, varmista ett gvim on polulla" +#~ msgid "Edit File" +#~ msgstr "Muokkaa tiedostoa" -#~ msgid "gvimext.dll error" -#~ msgstr "gvimext.dll-virhe" +#~ msgid "Save As" +#~ msgstr "Tallenna nimellä" -#~ msgid "Path length too long!" -#~ msgstr "Liian pitk polku" +#~ msgid "" +#~ "\n" +#~ "# Bar lines, copied verbatim:\n" +#~ msgstr "" +#~ "\n" +#~ "# Bar-rivit, kopiotu sellaisenaan:\n" -#~ msgid "E234: Unknown fontset: %s" -#~ msgstr "E234: Tuntematon fontset: %s" +#~ msgid "Illegal starting char" +#~ msgstr "Virheellinen aloitusmerkki" -#~ msgid "E235: Unknown font: %s" -#~ msgstr "E235: Tuntematon fontti: %s" +#~ msgid "# Value of 'encoding' when this file was written\n" +#~ msgstr "# encoding-muuttujan arvo tiedostoa kirjoitettaessa\n" -#~ msgid "E236: Font \"%s\" is not fixed-width" -#~ msgstr "E236: Fontti %s ei ole tasavlinen" +#~ msgid "" +#~ "# You may edit it if you're careful!\n" +#~ "\n" +#~ msgstr "" +#~ "# Muokkaa varovasti!\n" +#~ "\n" -#~ msgid "E448: Could not load library function %s" -#~ msgstr "E448: Ei voitu ladta kirjastofunktiota %s" +#~ msgid "# This viminfo file was generated by Vim %s.\n" +#~ msgstr "# Vimin %s generoima viminfo-tiedosto.\n" -#~ msgid "E26: Hebrew cannot be used: Not enabled at compile time\n" -#~ msgstr "E26: Hepreaa ei voi kytt, koska sit ei knnetty mukaan\n" +#~ msgid "E138: Can't write viminfo file %s!" +#~ msgstr "E138: Viminfo-tiedoston kirjoittaminen ei onnistu %s" -#~ msgid "E27: Farsi cannot be used: Not enabled at compile time\n" -#~ msgstr "E27: Farsia ei voi kytt, koska sit ei knnetty mukaan\n" +#~ msgid "E929: Too many viminfo temp files, like %s!" +#~ msgstr "E929: liikaa viminfo-väliaikaistiedostoja, kuten %s." -#~ msgid "E800: Arabic cannot be used: Not enabled at compile time\n" -#~ msgstr "E800: Arabiaa ei voi kytt, koska sit ei knnetty mukaan\n" +#~ msgid "E136: viminfo: Too many errors, skipping rest of file" +#~ msgstr "E136: viminfo: liikaa virheitä, ohitetaan lopputiedosto" -#~ msgid "E247: no registered server named \"%s\"" -#~ msgstr "E247: palvelinta %s ei ole rekisterityn" +#~ msgid "%sviminfo: %s in line: " +#~ msgstr "%sviminfo: %s rivillä: " -#~ msgid "E233: cannot open display" -#~ msgstr "E233: nytt ei voi avata" +#~ msgid "E258: Unable to send to client" +#~ msgstr "E258: Asiakkaalle lähetys ei onnistunut" -#~ msgid "E449: Invalid expression received" -#~ msgstr "E449: Virheellinen ilmaus saatu" +#~ msgid "E277: Unable to read a server reply" +#~ msgstr "E277: Palvelimen vastauksen lukeminen ei onnistunut" -#~ msgid "E463: Region is guarded, cannot modify" -#~ msgstr "E463: Alue on suojattu, muuttaminen ei onnistu" +#~ msgid "E240: No connection to Vim server" +#~ msgstr "E240: Ei yhteyttä vim-palvelimeen" -#~ msgid "E744: NetBeans does not allow changes in read-only files" -#~ msgstr "E744: NetBeans ei tue muutoksia kirjoitussuojattuihin tiedostoihin" +#~ msgid "" +#~ "&OK\n" +#~ "&Cancel" +#~ msgstr "" +#~ "&OK\n" +#~ "&Peru" -#~ msgid "Need encryption key for \"%s\"" -#~ msgstr "Tarvitaan salausavain kohteelle %s " +#~ msgid "" +#~ "\n" +#~ "# global variables:\n" +#~ msgstr "" +#~ "\n" +#~ "# globaalit muuttujat:\n" -#~ msgid "writelines() requires list of strings" -#~ msgstr "writelines()-komennolle pit antaa merkkijonolista" +#~ msgid "E729: using Funcref as a String" +#~ msgstr "E729: Funcref ei käy merkkijonosta" -#~ msgid "E264: Python: Error initialising I/O objects" -#~ msgstr "E264: Python: Virhe IO-olioiden alustuksessa" +#~ msgid "E914: Using a Channel as a Float" +#~ msgstr "E914: Käytettiin Channelia Floattina" -#~ msgid "no such buffer" -#~ msgstr "puskuria ei ole" +#~ msgid "E911: Using a Job as a Float" +#~ msgstr "E911: Job ei käy Floatista" -#~ msgid "attempt to refer to deleted window" -#~ msgstr "yritettiin viitata poistettuun ikkunaan" +#~ msgid "E913: Using a Channel as a Number" +#~ msgstr "E913: Channel ei käy Numberista" -#~ msgid "readonly attribute" -#~ msgstr "kirjoitussuojattu attribuutti" +#~ msgid "E910: Using a Job as a Number" +#~ msgstr "E910: Job ei käy Numberista" -#~ msgid "cursor position outside buffer" -#~ msgstr "kursorin sijainti puskurin ulkopuolella" +#~ msgid "E703: Using a Funcref as a Number" +#~ msgstr "E703: Funcref ei käy Numberista" -#~ msgid "" -#~ msgstr "" +#~ msgid "E724: variable nested too deep for displaying" +#~ msgstr "E724: muuttuja on upotettu liian syvälle näytettäväksi" -#~ msgid "" -#~ msgstr "" +#~ msgid "Patch file" +#~ msgstr "Patch-tiedosto" -#~ msgid "" -#~ msgstr "" +#~ msgid "[crypted]" +#~ msgstr "[salattu]" -#~ msgid "no such window" -#~ msgstr "ikkunaa ei ole" +#~ msgid "Keys don't match!" +#~ msgstr "Avaimet eivät täsmää!" -#~ msgid "attempt to refer to deleted buffer" -#~ msgstr "yritettiin viitata poistettuun puskuriin" +#~ msgid "Enter same key again: " +#~ msgstr "Anna sama avain uudestaan: " + +#~ msgid "Enter encryption key: " +#~ msgstr "Anna salausavain: " + +#~ msgid "Warning: Using a weak encryption method; see :help 'cm'" +#~ msgstr "Varoitus: Käytetään heikkoa salausmenetelmää, ks. :help 'cm'" -# New Line eli uusi rivinvaihtomerkki (ei CR, LF tai CR LF) -#~ msgid "[NL found]" -#~ msgstr "[NL puuttuu]" +#~ msgid "E821: File is encrypted with unknown method" +#~ msgstr "E821: Tiedoston salaus on tuntematon" -#~ msgid "Vim dialog..." -#~ msgstr "Vim-ikkuna..." +#~ msgid "E918: buffer must be loaded: %s" +#~ msgstr "E918: puskuria ei voi ladata: %s" -#~ msgid "Font Selection" -#~ msgstr "Fontin valinta" +#~ msgid "E915: in_io buffer requires in_buf or in_name to be set" +#~ msgstr "E915: in_io-puskurilla pitää olla in_buf tai in_name asetettu" -#~ msgid "E569: maximum number of cscope connections reached" -#~ msgstr "E569: enimmismr cscope-yhteyksi otettu" +#~ msgid "E920: _io file requires _name to be set" +#~ msgstr "E920: _io-tiedostolla pitää olla _name asetettu" -#~ msgid "-name \t\tUse resource as if vim was " -#~ msgstr "-name \t\tKyt resurssia vim " +#~ msgid "E906: not an open channel" +#~ msgstr "E906: ei ole avoin kanava" -#~ msgid "\t\t\t (Unimplemented)\n" -#~ msgstr "\t\t\t (toteuttamatta)\n" +#~ msgid "" +#~ "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel" +#~ msgstr "" +#~ "E912: ei voida käyttää funktioita ch_evalexpr(), ch_sendexpr() raa'an tai " +#~ "nl-kanavan kanssa" -#~ msgid "E290: over-the-spot style requires fontset" -#~ msgstr "E290: over-the-spot-tyyliss pit olla fontset" +#~ msgid "E917: Cannot use a callback with %s()" +#~ msgstr "E917: Ei voitu käyttää callbackia %s()" -#~ msgid "E291: Your GTK+ is older than 1.2.3. Status area disabled" -#~ msgstr "E291: GTK+-versio vanhempi kuin 1.2.3: Tila-alue poistettu kytst" +#~ msgid "" +#~ "\n" +#~ "# Buffer list:\n" +#~ msgstr "" +#~ "\n" +#~ "# Puskuriluettelo:\n" -#~ msgid "E292: Input Method Server is not running" -#~ msgstr "E292: Sytemetodipalvelin ei ole kynniss" +#~ msgid "E931: Buffer cannot be registered" +#~ msgstr "E931: Puskuria ei voi rekisteröidä" -#~ msgid "E396: containedin argument not accepted here" -#~ msgstr "E396: containedin ei sovi thn" +#~ msgid "E819: Blowfish test failed" +#~ msgstr "E819: Blowfish-testi epäonnistui" -#~ msgid "with GTK-GNOME GUI." -#~ msgstr "GTK-Gnome-GUIlla." +#~ msgid "E818: sha256 test failed" +#~ msgstr "E818: sha256-testi epäonnistui failed" -#~ msgid "with GTK GUI." -#~ msgstr "GTK-GUIlla." +#~ msgid "E817: Blowfish big/little endian use wrong" +#~ msgstr "E817: Blowfishin tavujärjestys väärä" -#~ msgid "-V[N]\t\tVerbose level" -#~ msgstr "-V[N]\t\tMonisanaisuustaso" +#~ msgid "E820: sizeof(uint32_t) != 4" +#~ msgstr "E820: sizeof(uint32_t) != 4" -#~ msgid "...(truncated)" -#~ msgstr "...(katkaistu)" +#~ msgid "E831: bf_key_init() called with empty password" +#~ msgstr "E831: bf_key_init() tyhjällä salasanalla" -- cgit From c5d7eaf66468d5f71049a602e820c19d8ad8c772 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sat, 15 Apr 2017 13:21:38 -0400 Subject: vim-patch:7.4.2152 Problem: No proper translation of messages with a count. Solution: Use ngettext(). (Sergey Alyoshin) https://github.com/vim/vim/commit/ee695f787ade7fd88fc5f5497553d95c0c3645b5 --- src/nvim/eval.c | 7 +++---- src/nvim/fold.c | 18 ++++++++++-------- src/nvim/screen.c | 2 +- src/nvim/version.c | 2 +- src/nvim/vim.h | 2 ++ 5 files changed, 17 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index dcbd7ab152..60c4e725b7 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -8663,7 +8663,6 @@ static void f_foldtext(typval_T *argvars, typval_T *rettv, FunPtr fptr) char_u *r; int len; char *txt; - long count; rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; @@ -8691,8 +8690,8 @@ static void f_foldtext(typval_T *argvars, typval_T *rettv, FunPtr fptr) s = skipwhite(s + 1); } } - count = (long)(foldend - foldstart + 1); - txt = _("+-%s%3ld lines: "); + unsigned long count = (unsigned long)(foldend - foldstart + 1); + txt = ngettext("+-%s%3ld line: ", "+-%s%3ld lines: ", count); r = xmalloc(STRLEN(txt) + STRLEN(dashes) // for %s + 20 // for %3ld @@ -8712,7 +8711,7 @@ static void f_foldtext(typval_T *argvars, typval_T *rettv, FunPtr fptr) static void f_foldtextresult(typval_T *argvars, typval_T *rettv, FunPtr fptr) { char_u *text; - char_u buf[51]; + char_u buf[FOLD_TEXT_LEN]; foldinfo_T foldinfo; int fold_count; diff --git a/src/nvim/fold.c b/src/nvim/fold.c index 34db4d2171..ff3f46cb78 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -1689,12 +1689,10 @@ static void foldDelMarker(linenr_T lnum, char_u *marker, size_t markerlen) } } -/* get_foldtext() {{{2 */ -/* - * Return the text for a closed fold at line "lnum", with last line "lnume". - * When 'foldtext' isn't set puts the result in "buf[51]". Otherwise the - * result is in allocated memory. - */ +// get_foldtext() {{{2 +/// Return the text for a closed fold at line "lnum", with last line "lnume". +/// When 'foldtext' isn't set puts the result in "buf[FOLD_TEXT_LEN]". +/// Otherwise the result is in allocated memory. char_u *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume, foldinfo_T *foldinfo, char_u *buf) FUNC_ATTR_NONNULL_ARG(1) @@ -1781,8 +1779,12 @@ char_u *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume, } } if (text == NULL) { - sprintf((char *)buf, _("+--%3ld lines folded "), - (long)(lnume - lnum + 1)); + unsigned long count = (unsigned long)(lnume - lnum + 1); + + vim_snprintf((char *)buf, FOLD_TEXT_LEN, + ngettext("+--%3ld line folded", + "+--%3ld lines folded ", count), + count); text = buf; } return text; diff --git a/src/nvim/screen.c b/src/nvim/screen.c index a8993be4e5..f34dbf5d64 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -1684,7 +1684,7 @@ static int compute_foldcolumn(win_T *wp, int col) */ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T lnum, int row) { - char_u buf[51]; + char_u buf[FOLD_TEXT_LEN]; pos_T *top, *bot; linenr_T lnume = lnum + fold_count - 1; int len; diff --git a/src/nvim/version.c b/src/nvim/version.c index 9a5d7ce169..cd904da573 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -289,7 +289,7 @@ static const int included_patches[] = { // 2155 NA // 2154 NA // 2153 NA - // 2152, + 2152, 2151, // 2150 NA 2149, diff --git a/src/nvim/vim.h b/src/nvim/vim.h index 172e62b039..f29ccdd296 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -204,6 +204,8 @@ enum { #define DIALOG_MSG_SIZE 1000 /* buffer size for dialog_msg() */ +enum { FOLD_TEXT_LEN = 51 }; //!< buffer size for get_foldtext() + /* * Maximum length of key sequence to be mapped. * Must be able to hold an Amiga resize report. -- cgit From cb02137dfac7357650a2e9cc32acb66326e59058 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sat, 15 Apr 2017 13:54:40 -0400 Subject: vim-patch:7.4.2209 Problem: Cannot map . (Stephen Riehm) Solution: Solve the memory access problem in another way. (Dominique Pelle) Allow for using in a string. https://github.com/vim/vim/commit/35a4cfa200917dd171b1fff3cd5b6cee9add673d --- src/nvim/eval.c | 2 +- src/nvim/keymap.c | 40 +++++++++++++++++++++++---------------- src/nvim/option.c | 2 +- src/nvim/os/input.c | 3 ++- src/nvim/testdir/test_mapping.vim | 8 ++++++++ src/nvim/version.c | 2 +- 6 files changed, 37 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 60c4e725b7..9f56d8db0c 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -4764,7 +4764,7 @@ static int get_string_tv(char_u **arg, typval_T *rettv, int evaluate) // Special key, e.g.: "\" case '<': - extra = trans_special((const char_u **) &p, STRLEN(p), name, true); + extra = trans_special((const char_u **)&p, STRLEN(p), name, true, true); if (extra != 0) { name += extra; break; diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c index 72b0d0aa40..9838b63a6b 100644 --- a/src/nvim/keymap.c +++ b/src/nvim/keymap.c @@ -490,17 +490,19 @@ char_u *get_special_key_name(int c, int modifiers) /// @param[out] dst Location where translation result will be kept. Must have /// at least six bytes. /// @param[in] keycode Prefer key code, e.g. K_DEL in place of DEL. +/// @param[in] in_string Inside a double quoted string /// /// @return Number of characters added to dst, zero for no match. unsigned int trans_special(const char_u **srcp, const size_t src_len, - char_u *const dst, const bool keycode) + char_u *const dst, const bool keycode, + const bool in_string) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT { int modifiers = 0; int key; unsigned int dlen = 0; - key = find_special_key(srcp, src_len, &modifiers, keycode, false); + key = find_special_key(srcp, src_len, &modifiers, keycode, false, in_string); if (key == 0) { return 0; } @@ -536,10 +538,12 @@ unsigned int trans_special(const char_u **srcp, const size_t src_len, /// @param[out] modp Location where information about modifiers is saved. /// @param[in] keycode Prefer key code, e.g. K_DEL in place of DEL. /// @param[in] keep_x_key Don’t translate xHome to Home key. +/// @param[in] in_string In string, double quote is escaped /// /// @return Key and modifiers or 0 if there is no match. int find_special_key(const char_u **srcp, const size_t src_len, int *const modp, - const bool keycode, const bool keep_x_key) + const bool keycode, const bool keep_x_key, + const bool in_string) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL { const char_u *last_dash; @@ -573,10 +577,14 @@ int find_special_key(const char_u **srcp, const size_t src_len, int *const modp, } else { l = 1; } - if (end - bp > l && bp[l] != '"' && bp[l + 1] == '>') { - // Anything accepted, like , except , because the " - // ends the string. + // Anything accepted, like . + // or are not special in strings as " is + // the string delimiter. With a backslash it works: + if (end - bp > l && !(in_string && bp[1] == '"') && bp[2] == '>') { bp += l; + } else if (end - bp > 2 && in_string && bp[1] == '\\' + && bp[2] == '"' && bp[3] == '>') { + bp += 2; } } } @@ -612,18 +620,17 @@ int find_special_key(const char_u **srcp, const size_t src_len, int *const modp, vim_str2nr(last_dash + 6, NULL, NULL, STR2NR_ALL, NULL, &n, 0); key = (int)n; } else { - /* - * Modifier with single letter, or special key name. - */ - if (has_mbyte) { - l = mb_ptr2len(last_dash + 1); - } else { - l = 1; + int off = 1; + + // Modifier with single letter, or special key name. + if (in_string && last_dash[1] == '\\' && last_dash[2] == '"') { + off = 2; } + l = mb_ptr2len(last_dash + 1); if (modifiers != 0 && last_dash[l + 1] == '>') { - key = PTR2CHAR(last_dash + 1); + key = PTR2CHAR(last_dash + off); } else { - key = get_special_key_code(last_dash + 1); + key = get_special_key_code(last_dash + off); if (!keep_x_key) { key = handle_x_keys(key); } @@ -828,7 +835,8 @@ char_u *replace_termcodes(const char_u *from, const size_t from_len, } } - slen = trans_special(&src, (size_t) (end - src) + 1, result + dlen, true); + slen = trans_special(&src, (size_t)(end - src) + 1, result + dlen, true, + true); if (slen) { dlen += slen; continue; diff --git a/src/nvim/option.c b/src/nvim/option.c index 0070a0056d..8748406ba4 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -4818,7 +4818,7 @@ int find_key_option_len(const char_u *arg, size_t len) } else { arg--; // put arg at the '<' modifiers = 0; - key = find_special_key(&arg, len + 1, &modifiers, true, true); + key = find_special_key(&arg, len + 1, &modifiers, true, true, false); if (modifiers) { // can't handle modifiers here key = 0; } diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c index 5f0f2ec677..1fa1f52806 100644 --- a/src/nvim/os/input.c +++ b/src/nvim/os/input.c @@ -182,7 +182,8 @@ size_t input_enqueue(String keys) while (rbuffer_space(input_buffer) >= 6 && ptr < end) { uint8_t buf[6] = { 0 }; unsigned int new_size - = trans_special((const uint8_t **)&ptr, (size_t)(end - ptr), buf, true); + = trans_special((const uint8_t **)&ptr, (size_t)(end - ptr), buf, true, + true); if (new_size) { new_size = handle_mouse_event(&ptr, buf, new_size); diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim index 6b313ff54f..7f93ddd56e 100644 --- a/src/nvim/testdir/test_mapping.vim +++ b/src/nvim/testdir/test_mapping.vim @@ -150,3 +150,11 @@ func Test_break_undo() call assert_equal('new line here', getline(line('$') - 1)) set nomodified endfunc + +func Test_map_meta_quotes() + imap foo + call feedkeys("Go-\-\", "xt") + call assert_equal("-foo-", getline('$')) + set nomodified + iunmap +endfunc diff --git a/src/nvim/version.c b/src/nvim/version.c index cd904da573..f7a78a15f9 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -232,7 +232,7 @@ static const int included_patches[] = { 2212, // 2211 NA // 2210 NA - // 2209, + 2209, 2208, // 2207 NA // 2206 NA -- cgit From a6f50c1120f4427d1b4f531ac564d83b770fd62f Mon Sep 17 00:00:00 2001 From: James McCoy Date: Wed, 19 Apr 2017 23:22:27 -0400 Subject: version.c: Mark 7.4.{2165,2173,2179} applied --- src/nvim/version.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/version.c b/src/nvim/version.c index f7a78a15f9..4edfe88e18 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -262,13 +262,13 @@ static const int included_patches[] = { // 2182 NA // 2181 NA 2180, - // 2179, + 2179, 2178, 2177, // 2176 NA 2175, 2174, - // 2173, + 2173, 2172, // 2171 NA 2170, @@ -276,7 +276,7 @@ static const int included_patches[] = { // 2168 NA // 2167 NA // 2166 NA - // 2165, + 2165, 2164, 2163, 2162, -- cgit From 17052946c744abd53d8f3349f453964ffa818bea Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 20 Apr 2017 12:32:14 +0200 Subject: 'scrollback': Allow :setlocal -1 on normal buffers Avoids a spurious :loadview error. --- src/nvim/option.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/option.c b/src/nvim/option.c index 8748406ba4..ae038389b4 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -4223,7 +4223,7 @@ static char *set_num_option(int opt_idx, char_u *varp, long value, } else if (pp == &curbuf->b_p_scbk || pp == &p_scbk) { // 'scrollback' if (*pp < -1 || *pp > SB_MAX - || (opt_flags == OPT_LOCAL && !curbuf->terminal)) { + || (*pp != -1 && opt_flags == OPT_LOCAL && !curbuf->terminal)) { errmsg = e_invarg; *pp = old_value; } else if (curbuf->terminal) { -- cgit From 9cdbbd49825561d642705990a2704b2241cf0584 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Mon, 17 Apr 2017 11:32:14 +0200 Subject: ui: support more cursor shape modes throttle unneccessary cursor shape events --- src/nvim/api/ui.c | 23 +++++++++---------- src/nvim/cursor_shape.c | 35 ++++++++++++++++++++++++++++- src/nvim/cursor_shape.h | 3 ++- src/nvim/ex_getln.c | 16 +++++++++++++ src/nvim/mouse.c | 1 + src/nvim/tui/tui.c | 60 +++++++++++++------------------------------------ src/nvim/ui.c | 31 +++++++++---------------- src/nvim/ui.h | 2 +- src/nvim/ui_bridge.c | 4 ++-- 9 files changed, 93 insertions(+), 82 deletions(-) (limited to 'src') diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index de60339e5f..0053050717 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -266,19 +266,14 @@ static void remote_ui_mouse_off(UI *ui) push_call(ui, "mouse_off", args); } -static void remote_ui_mode_change(UI *ui, int mode) +static void remote_ui_mode_change(UI *ui, int mode_idx) { Array args = ARRAY_DICT_INIT; - if (mode == INSERT) { - ADD(args, STRING_OBJ(cstr_to_string("insert"))); - } else if (mode == REPLACE) { - ADD(args, STRING_OBJ(cstr_to_string("replace"))); - } else if (mode == CMDLINE) { - ADD(args, STRING_OBJ(cstr_to_string("cmdline"))); - } else { - assert(mode == NORMAL); - ADD(args, STRING_OBJ(cstr_to_string("normal"))); - } + + char *full_name = shape_table[mode_idx].full_name; + ADD(args, STRING_OBJ(cstr_to_string(full_name))); + + ADD(args, INTEGER_OBJ(mode_idx)); push_call(ui, "mode_change", args); } @@ -393,8 +388,10 @@ static void remote_ui_update_sp(UI *ui, int sp) static void remote_ui_flush(UI *ui) { UIData *data = ui->data; - channel_send_event(data->channel_id, "redraw", data->buffer); - data->buffer = (Array)ARRAY_DICT_INIT; + if (data->buffer.size > 0) { + channel_send_event(data->channel_id, "redraw", data->buffer); + data->buffer = (Array)ARRAY_DICT_INIT; + } } static void remote_ui_suspend(UI *ui) diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c index 34ee53bf75..57dc241c54 100644 --- a/src/nvim/cursor_shape.c +++ b/src/nvim/cursor_shape.c @@ -11,7 +11,7 @@ #include "nvim/ui.h" /// Handling of cursor and mouse pointer shapes in various modes. -static cursorentry_T shape_table[SHAPE_IDX_COUNT] = +cursorentry_T shape_table[SHAPE_IDX_COUNT] = { // Values are set by 'guicursor' and 'mouseshape'. // Adjust the SHAPE_IDX_ defines when changing this! @@ -63,6 +63,7 @@ Dictionary cursor_shape_dict(void) PUT(dic, "id_lm", INTEGER_OBJ(cur->id_lm)); } PUT(dic, "short_name", STRING_OBJ(cstr_to_string(cur->name))); + PUT(dic, "mode_idx", INTEGER_OBJ(i)); PUT(all, cur->full_name, DICTIONARY_OBJ(dic)); } @@ -260,3 +261,35 @@ int cursor_mode_str2int(const char *mode) return -1; } + +/// Return the index into shape_table[] for the current mode. +int cursor_get_mode_idx(void) +{ + if (State == SHOWMATCH) { + return SHAPE_IDX_SM; + } else if (State & VREPLACE_FLAG) { + return SHAPE_IDX_R; + } else if (State & REPLACE_FLAG) { + return SHAPE_IDX_R; + } else if (State & INSERT) { + return SHAPE_IDX_I; + } else if (State & CMDLINE) { + if (cmdline_at_end()) { + return SHAPE_IDX_C; + } else if (cmdline_overstrike()) { + return SHAPE_IDX_CR; + } else { + return SHAPE_IDX_CI; + } + } else if (finish_op) { + return SHAPE_IDX_O; + } else if (VIsual_active) { + if (*p_sel == 'e') { + return SHAPE_IDX_VE; + } else { + return SHAPE_IDX_V; + } + } else { + return SHAPE_IDX_N; + } +} diff --git a/src/nvim/cursor_shape.h b/src/nvim/cursor_shape.h index 7cf65cba3c..2c466603f0 100644 --- a/src/nvim/cursor_shape.h +++ b/src/nvim/cursor_shape.h @@ -25,7 +25,7 @@ SHAPE_IDX_MORE = 14, ///< Hit-return or More SHAPE_IDX_MOREL = 15, ///< Hit-return or More in last line SHAPE_IDX_SM = 16, ///< showing matching paren SHAPE_IDX_COUNT = 17 -} MouseMode; +} ModeShape; typedef enum { SHAPE_BLOCK = 0, ///< block cursor @@ -53,6 +53,7 @@ typedef struct cursor_entry { char used_for; ///< SHAPE_MOUSE and/or SHAPE_CURSOR } cursorentry_T; +extern cursorentry_T shape_table[SHAPE_IDX_COUNT]; #ifdef INCLUDE_GENERATED_DECLARATIONS # include "cursor_shape.h.generated.h" diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 0b6036ace9..5d228e7492 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -351,6 +351,7 @@ static int command_line_check(VimState *state) quit_more = false; // reset after CTRL-D which had a more-prompt cursorcmd(); // set the cursor on the right spot + ui_cursor_shape(); return 1; } @@ -2092,6 +2093,18 @@ redraw: return (char_u *)line_ga.ga_data; } +bool cmdline_overstrike(void) +{ + return ccline.overstrike; +} + + +/// Return true if the cursor is at the end of the cmdline. +bool cmdline_at_end(void) +{ + return (ccline.cmdpos >= ccline.cmdlen); +} + /* * Allocate a new command line buffer. * Assigns the new buffer to ccline.cmdbuff and ccline.cmdbufflen. @@ -2262,6 +2275,7 @@ void putcmdline(int c, int shift) draw_cmdline(ccline.cmdpos, ccline.cmdlen - ccline.cmdpos); msg_no_more = FALSE; cursorcmd(); + ui_cursor_shape(); } /* @@ -2281,6 +2295,7 @@ void unputcmdline(void) draw_cmdline(ccline.cmdpos, 1); msg_no_more = FALSE; cursorcmd(); + ui_cursor_shape(); } /* @@ -2598,6 +2613,7 @@ void redrawcmdline(void) compute_cmdrow(); redrawcmd(); cursorcmd(); + ui_cursor_shape(); } static void redrawcmdprompt(void) diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c index 2ebe199f47..0029f364da 100644 --- a/src/nvim/mouse.c +++ b/src/nvim/mouse.c @@ -456,6 +456,7 @@ void setmouse(void) { int checkfor; + ui_cursor_shape(); /* be quick when mouse is off */ if (*p_mouse == NUL) diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index f34f5f1bc4..3498e8f4e7 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -73,7 +73,7 @@ typedef struct { bool busy; cursorentry_T cursor_shapes[SHAPE_IDX_COUNT]; HlAttrs print_attrs; - int showing_mode; + ModeShape showing_mode; struct { int enable_mouse, disable_mouse; int enable_bracketed_paste, disable_bracketed_paste; @@ -131,7 +131,7 @@ static void terminfo_start(UI *ui) data->can_use_terminal_scroll = true; data->bufpos = 0; data->bufsize = sizeof(data->buf) - CNORM_COMMAND_MAX_SIZE; - data->showing_mode = 0; + data->showing_mode = SHAPE_IDX_N; data->unibi_ext.enable_mouse = -1; data->unibi_ext.disable_mouse = -1; data->unibi_ext.set_cursor_color = -1; @@ -173,7 +173,7 @@ static void terminfo_stop(UI *ui) { TUIData *data = ui->data; // Destroy output stuff - tui_mode_change(ui, NORMAL); + tui_mode_change(ui, SHAPE_IDX_N); tui_mouse_off(ui); unibi_out(ui, unibi_exit_attribute_mode); // cursor should be set to normal before exiting alternate screen @@ -451,7 +451,7 @@ CursorShape tui_cursor_decode_shape(const char *shape_str) return shape; } -static cursorentry_T decode_cursor_entry(Dictionary args) +static cursorentry_T decode_cursor_entry(Dictionary args, int *mode_idx) { cursorentry_T r; @@ -467,6 +467,8 @@ static cursorentry_T decode_cursor_entry(Dictionary args) r.blinkoff = (int)value.data.integer; } else if (strequal(key, "hl_id")) { r.id = (int)value.data.integer; + } else if (strequal(key, "mode_idx")) { + *mode_idx = (int)value.data.integer; } } return r; @@ -484,15 +486,15 @@ static void tui_cursor_style_set(UI *ui, bool enabled, Dictionary args) // Keys: as defined by `shape_table`. for (size_t i = 0; i < args.size; i++) { char *mode_name = args.items[i].key.data; - const int mode_id = cursor_mode_str2int(mode_name); - assert(mode_id >= 0); - cursorentry_T r = decode_cursor_entry(args.items[i].value.data.dictionary); + int mode_idx; + cursorentry_T r = decode_cursor_entry(args.items[i].value.data.dictionary, + &mode_idx); + assert(mode_idx >= 0); r.full_name = mode_name; - data->cursor_shapes[mode_id] = r; + data->cursor_shapes[mode_idx] = r; } - MouseMode cursor_mode = tui_mode2cursor(data->showing_mode); - tui_set_cursor(ui, cursor_mode); + tui_set_mode(ui, data->showing_mode); } static void tui_update_menu(UI *ui) @@ -529,7 +531,7 @@ static void tui_mouse_off(UI *ui) } /// @param mode one of SHAPE_XXX -static void tui_set_cursor(UI *ui, MouseMode mode) +static void tui_set_mode(UI *ui, ModeShape mode) { if (!cursor_style_enabled) { return; @@ -584,42 +586,12 @@ static void tui_set_cursor(UI *ui, MouseMode mode) } } -/// Returns cursor mode from edit mode -static MouseMode tui_mode2cursor(int mode) -{ - switch (mode) { - case INSERT: return SHAPE_IDX_I; - case CMDLINE: return SHAPE_IDX_C; - case REPLACE: return SHAPE_IDX_R; - case NORMAL: - default: return SHAPE_IDX_N; - } -} - /// @param mode editor mode -static void tui_mode_change(UI *ui, int mode) +static void tui_mode_change(UI *ui, int mode_idx) { TUIData *data = ui->data; - - if (mode == INSERT) { - if (data->showing_mode != INSERT) { - tui_set_cursor(ui, SHAPE_IDX_I); - } - } else if (mode == CMDLINE) { - if (data->showing_mode != CMDLINE) { - tui_set_cursor(ui, SHAPE_IDX_C); - } - } else if (mode == REPLACE) { - if (data->showing_mode != REPLACE) { - tui_set_cursor(ui, SHAPE_IDX_R); - } - } else { - assert(mode == NORMAL); - if (data->showing_mode != NORMAL) { - tui_set_cursor(ui, SHAPE_IDX_N); - } - } - data->showing_mode = mode; + tui_set_mode(ui, (ModeShape)mode_idx); + data->showing_mode = (ModeShape)mode_idx; } static void tui_set_scroll_region(UI *ui, int top, int bot, int left, diff --git a/src/nvim/ui.c b/src/nvim/ui.c index 28f71b7ef2..8c5e579301 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -53,6 +53,7 @@ static int current_attr_code = 0; static bool pending_cursor_update = false; static int busy = 0; static int height, width; +static int old_mode_idx = -1; // UI_CALL invokes a function on all registered UI instances. The functions can // have 0-5 arguments (configurable by SELECT_NTH). @@ -150,12 +151,6 @@ void ui_event(char *name, Array args) } } -// May update the shape of the cursor. -void ui_cursor_shape(void) -{ - ui_mode_change(); -} - void ui_refresh(void) { if (!ui_active()) { @@ -181,6 +176,8 @@ void ui_refresh(void) screen_resize(width, height); pum_set_external(pum_external); ui_cursor_style_set(); + old_mode_idx = -1; + ui_cursor_shape(); } static void ui_refresh_event(void **argv) @@ -541,25 +538,19 @@ static void flush_cursor_update(void) } } -// Notify that the current mode has changed. Can be used to change cursor -// shape, for example. -static void ui_mode_change(void) +/// Check if current mode has changed. +/// May update the shape of the cursor. +void ui_cursor_shape(void) { - int mode; if (!full_screen) { return; } - // Get a simple UI mode out of State. - if ((State & REPLACE) == REPLACE) { - mode = REPLACE; - } else if (State & INSERT) { - mode = INSERT; - } else if (State & CMDLINE) { - mode = CMDLINE; - } else { - mode = NORMAL; + int mode_idx = cursor_get_mode_idx(); + + if (old_mode_idx != mode_idx) { + old_mode_idx = mode_idx; + UI_CALL(mode_change, mode_idx); } - UI_CALL(mode_change, mode); conceal_check_cursur_line(); } diff --git a/src/nvim/ui.h b/src/nvim/ui.h index 8ffc5a45a6..d63ceb106c 100644 --- a/src/nvim/ui.h +++ b/src/nvim/ui.h @@ -28,7 +28,7 @@ struct ui_t { void (*busy_stop)(UI *ui); void (*mouse_on)(UI *ui); void (*mouse_off)(UI *ui); - void (*mode_change)(UI *ui, int mode); + void (*mode_change)(UI *ui, int mode_idx); void (*set_scroll_region)(UI *ui, int top, int bot, int left, int right); void (*scroll)(UI *ui, int count); void (*highlight_set)(UI *ui, HlAttrs attrs); diff --git a/src/nvim/ui_bridge.c b/src/nvim/ui_bridge.c index 9f780663ac..59942fb2cb 100644 --- a/src/nvim/ui_bridge.c +++ b/src/nvim/ui_bridge.c @@ -249,9 +249,9 @@ static void ui_bridge_mouse_off_event(void **argv) ui->mouse_off(ui); } -static void ui_bridge_mode_change(UI *b, int mode) +static void ui_bridge_mode_change(UI *b, int mode_idx) { - UI_CALL(b, mode_change, 2, b, INT2PTR(mode)); + UI_CALL(b, mode_change, 2, b, INT2PTR(mode_idx)); } static void ui_bridge_mode_change_event(void **argv) { -- cgit From 7ea5c78687168c07bfc4582c84145e86a5252f94 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Tue, 18 Apr 2017 13:42:04 +0200 Subject: ui: use an array for mode styles --- src/nvim/api/ui.c | 10 +++++----- src/nvim/cursor_shape.c | 14 +++++++------- src/nvim/tui/tui.c | 25 ++++++++++--------------- src/nvim/ui.c | 10 +++++----- src/nvim/ui.ch | 0 src/nvim/ui.h | 2 +- src/nvim/ui_bridge.c | 20 ++++++++++---------- 7 files changed, 38 insertions(+), 43 deletions(-) create mode 100644 src/nvim/ui.ch (limited to 'src') diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 0053050717..3e7e2718bb 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -70,7 +70,7 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, ui->clear = remote_ui_clear; ui->eol_clear = remote_ui_eol_clear; ui->cursor_goto = remote_ui_cursor_goto; - ui->cursor_style_set = remote_ui_cursor_style_set; + ui->mode_info_set = remote_ui_mode_info_set; ui->update_menu = remote_ui_update_menu; ui->busy_start = remote_ui_busy_start; ui->busy_stop = remote_ui_busy_stop; @@ -295,12 +295,12 @@ static void remote_ui_scroll(UI *ui, int count) push_call(ui, "scroll", args); } -static void remote_ui_cursor_style_set(UI *ui, bool enabled, Dictionary data) +static void remote_ui_mode_info_set(UI *ui, bool guicursor_enabled, Array data) { Array args = ARRAY_DICT_INIT; - ADD(args, BOOLEAN_OBJ(enabled)); - ADD(args, copy_object(DICTIONARY_OBJ(data))); - push_call(ui, "cursor_style_set", args); + ADD(args, BOOLEAN_OBJ(guicursor_enabled)); + ADD(args, copy_object(ARRAY_OBJ(data))); + push_call(ui, "mode_info_set", args); } static void remote_ui_highlight_set(UI *ui, HlAttrs attrs) diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c index 57dc241c54..3099a5189b 100644 --- a/src/nvim/cursor_shape.c +++ b/src/nvim/cursor_shape.c @@ -34,11 +34,11 @@ cursorentry_T shape_table[SHAPE_IDX_COUNT] = { "showmatch", 0, 0, 0, 100L, 100L, 100L, 0, 0, "sm", SHAPE_CURSOR }, }; -/// Converts cursor_shapes into a Dictionary of dictionaries -/// @return dictionary of the form {"normal" : { "cursor_shape": ... }, ...} -Dictionary cursor_shape_dict(void) +/// Converts cursor_shapes into an Array of Dictionaries +/// @return Array of the form {[ "cursor_shape": ... ], ...} +Array mode_style_array(void) { - Dictionary all = ARRAY_DICT_INIT; + Array all = ARRAY_DICT_INIT; for (int i = 0; i < SHAPE_IDX_COUNT; i++) { Dictionary dic = ARRAY_DICT_INIT; @@ -62,10 +62,10 @@ Dictionary cursor_shape_dict(void) PUT(dic, "hl_id", INTEGER_OBJ(cur->id)); PUT(dic, "id_lm", INTEGER_OBJ(cur->id_lm)); } + PUT(dic, "name", STRING_OBJ(cstr_to_string(cur->full_name))); PUT(dic, "short_name", STRING_OBJ(cstr_to_string(cur->name))); - PUT(dic, "mode_idx", INTEGER_OBJ(i)); - PUT(all, cur->full_name, DICTIONARY_OBJ(dic)); + ADD(all, DICTIONARY_OBJ(dic)); } return all; @@ -241,7 +241,7 @@ char_u *parse_shape_opt(int what) shape_table[SHAPE_IDX_VE].id_lm = shape_table[SHAPE_IDX_V].id_lm; } } - ui_cursor_style_set(); + ui_mode_info_set(); return NULL; } diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 3498e8f4e7..172160fddb 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -101,7 +101,7 @@ UI *tui_start(void) ui->clear = tui_clear; ui->eol_clear = tui_eol_clear; ui->cursor_goto = tui_cursor_goto; - ui->cursor_style_set = tui_cursor_style_set; + ui->mode_info_set = tui_mode_info_set; ui->update_menu = tui_update_menu; ui->busy_start = tui_busy_start; ui->busy_stop = tui_busy_stop; @@ -451,7 +451,7 @@ CursorShape tui_cursor_decode_shape(const char *shape_str) return shape; } -static cursorentry_T decode_cursor_entry(Dictionary args, int *mode_idx) +static cursorentry_T decode_cursor_entry(Dictionary args) { cursorentry_T r; @@ -467,31 +467,26 @@ static cursorentry_T decode_cursor_entry(Dictionary args, int *mode_idx) r.blinkoff = (int)value.data.integer; } else if (strequal(key, "hl_id")) { r.id = (int)value.data.integer; - } else if (strequal(key, "mode_idx")) { - *mode_idx = (int)value.data.integer; } } return r; } -static void tui_cursor_style_set(UI *ui, bool enabled, Dictionary args) +static void tui_mode_info_set(UI *ui, bool guicursor_enabled, Array args) { - cursor_style_enabled = enabled; - if (!enabled) { + cursor_style_enabled = guicursor_enabled; + if (!guicursor_enabled) { return; // Do not send cursor style control codes. } TUIData *data = ui->data; assert(args.size); - // Keys: as defined by `shape_table`. + + // cursor style entries as defined by `shape_table`. for (size_t i = 0; i < args.size; i++) { - char *mode_name = args.items[i].key.data; - int mode_idx; - cursorentry_T r = decode_cursor_entry(args.items[i].value.data.dictionary, - &mode_idx); - assert(mode_idx >= 0); - r.full_name = mode_name; - data->cursor_shapes[mode_idx] = r; + assert(args.items[i].type == kObjectTypeDictionary); + cursorentry_T r = decode_cursor_entry(args.items[i].data.dictionary); + data->cursor_shapes[i] = r; } tui_set_mode(ui, data->showing_mode); diff --git a/src/nvim/ui.c b/src/nvim/ui.c index 8c5e579301..5fb57dd257 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -175,7 +175,7 @@ void ui_refresh(void) row = col = 0; screen_resize(width, height); pum_set_external(pum_external); - ui_cursor_style_set(); + ui_mode_info_set(); old_mode_idx = -1; ui_cursor_shape(); } @@ -375,12 +375,12 @@ void ui_cursor_goto(int new_row, int new_col) pending_cursor_update = true; } -void ui_cursor_style_set(void) +void ui_mode_info_set(void) { - Dictionary style = cursor_shape_dict(); + Array style = mode_style_array(); bool enabled = (*p_guicursor != NUL); - UI_CALL(cursor_style_set, enabled, style); - api_free_dictionary(style); + UI_CALL(mode_info_set, enabled, style); + api_free_array(style); } void ui_update_menu(void) diff --git a/src/nvim/ui.ch b/src/nvim/ui.ch new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/nvim/ui.h b/src/nvim/ui.h index d63ceb106c..f5cbf748ee 100644 --- a/src/nvim/ui.h +++ b/src/nvim/ui.h @@ -22,7 +22,7 @@ struct ui_t { void (*clear)(UI *ui); void (*eol_clear)(UI *ui); void (*cursor_goto)(UI *ui, int row, int col); - void (*cursor_style_set)(UI *ui, bool enabled, Dictionary cursor_styles); + void (*mode_info_set)(UI *ui, bool enabled, Array cursor_styles); void (*update_menu)(UI *ui); void (*busy_start)(UI *ui); void (*busy_stop)(UI *ui); diff --git a/src/nvim/ui_bridge.c b/src/nvim/ui_bridge.c index 59942fb2cb..e899cbf397 100644 --- a/src/nvim/ui_bridge.c +++ b/src/nvim/ui_bridge.c @@ -60,7 +60,7 @@ UI *ui_bridge_attach(UI *ui, ui_main_fn ui_main, event_scheduler scheduler) rv->bridge.clear = ui_bridge_clear; rv->bridge.eol_clear = ui_bridge_eol_clear; rv->bridge.cursor_goto = ui_bridge_cursor_goto; - rv->bridge.cursor_style_set = ui_bridge_cursor_style_set; + rv->bridge.mode_info_set = ui_bridge_mode_info_set; rv->bridge.update_menu = ui_bridge_update_menu; rv->bridge.busy_start = ui_bridge_busy_start; rv->bridge.busy_stop = ui_bridge_busy_stop; @@ -180,23 +180,23 @@ static void ui_bridge_cursor_goto_event(void **argv) ui->cursor_goto(ui, PTR2INT(argv[1]), PTR2INT(argv[2])); } -static void ui_bridge_cursor_style_set(UI *b, bool enabled, Dictionary styles) +static void ui_bridge_mode_info_set(UI *b, bool enabled, Array modes) { bool *enabledp = xmalloc(sizeof(*enabledp)); - Object *stylesp = xmalloc(sizeof(*stylesp)); + Object *modesp = xmalloc(sizeof(*modesp)); *enabledp = enabled; - *stylesp = copy_object(DICTIONARY_OBJ(styles)); - UI_CALL(b, cursor_style_set, 3, b, enabledp, stylesp); + *modesp = copy_object(ARRAY_OBJ(modes)); + UI_CALL(b, mode_info_set, 3, b, enabledp, modesp); } -static void ui_bridge_cursor_style_set_event(void **argv) +static void ui_bridge_mode_info_set_event(void **argv) { UI *ui = UI(argv[0]); bool *enabled = argv[1]; - Object *styles = argv[2]; - ui->cursor_style_set(ui, *enabled, styles->data.dictionary); + Object *modes = argv[2]; + ui->mode_info_set(ui, *enabled, modes->data.array); xfree(enabled); - api_free_object(*styles); - xfree(styles); + api_free_object(*modes); + xfree(modes); } static void ui_bridge_update_menu(UI *b) -- cgit From a396874da0efaeb7def5e26afab9ae1c980510a0 Mon Sep 17 00:00:00 2001 From: Othon Briganó Date: Fri, 21 Apr 2017 10:21:02 -0300 Subject: refactor/single-include: getchar.h (#6560) --- src/nvim/CMakeLists.txt | 1 - src/nvim/getchar.h | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index a91657f1bd..e4b3b4de13 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -429,7 +429,6 @@ function(get_test_target prefix sfile relative_path_var target_var) endfunction() set(NO_SINGLE_CHECK_HEADERS - getchar.h if_cscope_defs.h misc2.h msgpack_rpc/server.h diff --git a/src/nvim/getchar.h b/src/nvim/getchar.h index bdf65909b6..28584e0534 100644 --- a/src/nvim/getchar.h +++ b/src/nvim/getchar.h @@ -1,6 +1,10 @@ #ifndef NVIM_GETCHAR_H #define NVIM_GETCHAR_H +#include "nvim/types.h" +#include "nvim/buffer_defs.h" +#include "nvim/ex_cmds_defs.h" + /* Values for "noremap" argument of ins_typebuf(). Also used for * map->m_noremap and menu->noremap[]. */ #define REMAP_YES 0 /* allow remapping */ @@ -12,6 +16,7 @@ #define KEYLEN_PART_MAP -2 /* keylen value for incomplete mapping */ #define KEYLEN_REMOVED 9999 /* keylen value for removed sequence */ + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "getchar.h.generated.h" #endif -- cgit From f50e03f2e35cf4bee8cedb2c95bf9619f3b57bc2 Mon Sep 17 00:00:00 2001 From: sander2 Date: Fri, 21 Apr 2017 15:45:51 +0200 Subject: ex_cmds.c: Fix bug in ex_z (#6557) vim-patch:8.0.0571 --- src/nvim/ex_cmds.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 117ef6a507..7726e0fc6d 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -2877,8 +2877,11 @@ void ex_z(exarg_T *eap) if (end > curbuf->b_ml.ml_line_count) end = curbuf->b_ml.ml_line_count; - if (curs > curbuf->b_ml.ml_line_count) + if (curs > curbuf->b_ml.ml_line_count) { curs = curbuf->b_ml.ml_line_count; + } else if (curs < 1) { + curs = 1; + } for (i = start; i <= end; i++) { if (minus && i == lnum) { @@ -2898,8 +2901,11 @@ void ex_z(exarg_T *eap) } } - curwin->w_cursor.lnum = curs; - ex_no_reprint = TRUE; + if (curwin->w_cursor.lnum != curs) { + curwin->w_cursor.lnum = curs; + curwin->w_cursor.col = 0; + } + ex_no_reprint = true; } /* -- cgit From 654c50b227b7616300763da75ad4a79151883694 Mon Sep 17 00:00:00 2001 From: relnod Date: Sat, 22 Apr 2017 15:43:35 +0200 Subject: refactor/single-include: window.h, version.h (#6570) --- src/nvim/CMakeLists.txt | 2 -- src/nvim/version.h | 2 ++ src/nvim/window.h | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index e4b3b4de13..04fe56952f 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -456,8 +456,6 @@ set(NO_SINGLE_CHECK_HEADERS ui_bridge.h undo.h undo_defs.h - version.h - window.h ) foreach(hfile ${NVIM_HEADERS}) get_test_target(test-includes "${hfile}" relative_path texe) diff --git a/src/nvim/version.h b/src/nvim/version.h index 1de809e539..a0babfb156 100644 --- a/src/nvim/version.h +++ b/src/nvim/version.h @@ -1,6 +1,8 @@ #ifndef NVIM_VERSION_H #define NVIM_VERSION_H +#include "nvim/ex_cmds_defs.h" + // defined in version.c extern char* Version; extern char* longVersion; diff --git a/src/nvim/window.h b/src/nvim/window.h index 2ac4c00c28..82b3fe5e88 100644 --- a/src/nvim/window.h +++ b/src/nvim/window.h @@ -3,6 +3,8 @@ #include +#include "nvim/buffer_defs.h" + /* Values for file_name_in_line() */ #define FNAME_MESS 1 /* give error message */ #define FNAME_EXP 2 /* expand to path */ -- cgit From e41c044b530d2cc3f548fcef07862640eb249c58 Mon Sep 17 00:00:00 2001 From: Othon Briganó Date: Sat, 22 Apr 2017 10:44:58 -0300 Subject: refactor/single-include (#6563) --- src/nvim/CMakeLists.txt | 3 --- src/nvim/screen.h | 4 ++++ src/nvim/search.h | 6 ++++++ src/nvim/syntax.h | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 04fe56952f..597864845e 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -440,13 +440,10 @@ set(NO_SINGLE_CHECK_HEADERS quickfix.h regexp.h regexp_defs.h - screen.h - search.h sha256.h sign_defs.h spell.h spellfile.h - syntax.h syntax_defs.h tag.h terminal.h diff --git a/src/nvim/screen.h b/src/nvim/screen.h index 81a8b9ed4c..17515d4253 100644 --- a/src/nvim/screen.h +++ b/src/nvim/screen.h @@ -3,6 +3,10 @@ #include +#include "nvim/types.h" +#include "nvim/buffer_defs.h" +#include "nvim/pos.h" + /* * flags for update_screen() * The higher the value, the higher the priority diff --git a/src/nvim/search.h b/src/nvim/search.h index d4e40cb287..cb50742990 100644 --- a/src/nvim/search.h +++ b/src/nvim/search.h @@ -4,6 +4,12 @@ #include #include +#include "nvim/types.h" +#include "nvim/buffer_defs.h" +#include "nvim/eval/typval.h" +#include "nvim/normal.h" +#include "nvim/os/time.h" + /* Values for the find_pattern_in_path() function args 'type' and 'action': */ #define FIND_ANY 1 #define FIND_DEFINE 2 diff --git a/src/nvim/syntax.h b/src/nvim/syntax.h index 574e3372e2..bb733ead30 100644 --- a/src/nvim/syntax.h +++ b/src/nvim/syntax.h @@ -4,7 +4,7 @@ #include #include "nvim/buffer_defs.h" - +#include "nvim/ex_cmds_defs.h" /// Terminal highlighting attribute bits. /// Attributes above HL_ALL are used for syntax highlighting. -- cgit From 1e83add288b4f9183d39387356fc7e8f294d5d4b Mon Sep 17 00:00:00 2001 From: relnod Date: Sat, 22 Apr 2017 16:55:28 +0200 Subject: refactor/single-include: ui.h, ui_bridge.h, ugrid.h (#6571) --- src/nvim/CMakeLists.txt | 3 --- src/nvim/ui.h | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 597864845e..db5e62fd67 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -448,9 +448,6 @@ set(NO_SINGLE_CHECK_HEADERS tag.h terminal.h tui/tui.h - ugrid.h - ui.h - ui_bridge.h undo.h undo_defs.h ) diff --git a/src/nvim/ui.h b/src/nvim/ui.h index f5cbf748ee..fcf52ac9e1 100644 --- a/src/nvim/ui.h +++ b/src/nvim/ui.h @@ -6,6 +6,7 @@ #include #include "api/private/defs.h" +#include "nvim/buffer_defs.h" typedef struct { bool bold, underline, undercurl, italic, reverse; -- cgit From c703d0529b3c4f6485d6ce6f37033d4658356b05 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 22 Apr 2017 18:19:37 +0200 Subject: 'guicursor': iTerm: Set cursor color. iTerm uses proprietary escape codes to set cursor color. https://www.iterm2.com/documentation-escape-codes.html --- src/nvim/tui/tui.c | 53 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 6ea6376202..ae7551098d 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -43,6 +43,15 @@ #define OUTBUF_SIZE 0xffff #define TOO_MANY_EVENTS 1000000 +#define STARTS_WITH(str, prefix) (!memcmp(str, prefix, sizeof(prefix) - 1)) + +typedef enum TermType { + kTermUnknown, + kTermGnome, + kTermiTerm, + kTermKonsole, + kTermRxvt, +} TermType; typedef struct { int top, bot, left, right; @@ -77,6 +86,7 @@ typedef struct { cursorentry_T cursor_shapes[SHAPE_IDX_COUNT]; HlAttrs print_attrs; ModeShape showing_mode; + TermType term; struct { int enable_mouse, disable_mouse; int enable_bracketed_paste, disable_bracketed_paste; @@ -528,7 +538,6 @@ static void tui_mouse_off(UI *ui) } } -/// @param mode one of SHAPE_XXX static void tui_set_mode(UI *ui, ModeShape mode) { if (!cursor_style_enabled) { @@ -537,14 +546,14 @@ static void tui_set_mode(UI *ui, ModeShape mode) TUIData *data = ui->data; cursorentry_T c = data->cursor_shapes[mode]; int shape = c.shape; - bool inside_tmux = os_getenv("TMUX") != NULL; + bool is_tmux = os_getenv("TMUX") != NULL; unibi_var_t vars[26 + 26] = { { 0 } }; -# define TMUX_WRAP(seq) (inside_tmux ? "\x1bPtmux;\x1b" seq "\x1b\\" : seq) +# define TMUX_WRAP(seq) (is_tmux ? "\x1bPtmux;\x1b" seq "\x1b\\" : seq) // Support changing cursor shape on some popular terminals. const char *vte_version = os_getenv("VTE_VERSION"); - if (os_getenv("KONSOLE_PROFILE_NAME") || os_getenv("KONSOLE_DBUS_SESSION")) { + if (data->term == kTermKonsole) { // Konsole uses a proprietary escape code to set the cursor shape // and does not support DECSCUSR. switch (shape) { @@ -921,6 +930,24 @@ static void unibi_set_if_empty(unibi_term *ut, enum unibi_string str, } } +static TermType detect_term(const char *term, const char *colorterm) +{ + if (STARTS_WITH(term, "rxvt")) { + return kTermRxvt; + } + if (os_getenv("KONSOLE_PROFILE_NAME") || os_getenv("KONSOLE_DBUS_SESSION")) { + return kTermKonsole; + } + const char *termprg = os_getenv("TERM_PROGRAM"); + if (termprg && strstr(termprg, "iTerm.app")) { + return kTermiTerm; + } + if (colorterm && strstr(colorterm, "gnome-terminal")) { + return kTermGnome; + } + return kTermUnknown; +} + static void fix_terminfo(TUIData *data) { unibi_term *ut = data->ut; @@ -930,10 +957,9 @@ static void fix_terminfo(TUIData *data) if (!term) { goto end; } + data->term = detect_term(term, colorterm); -#define STARTS_WITH(str, prefix) (!memcmp(str, prefix, sizeof(prefix) - 1)) - - if (STARTS_WITH(term, "rxvt")) { + if (data->term == kTermRxvt) { unibi_set_if_empty(ut, unibi_exit_attribute_mode, "\x1b[m\x1b(B"); unibi_set_if_empty(ut, unibi_flash_screen, "\x1b[?5h$<20/>\x1b[?5l"); unibi_set_if_empty(ut, unibi_enter_italics_mode, "\x1b[3m"); @@ -945,7 +971,7 @@ static void fix_terminfo(TUIData *data) unibi_set_if_empty(ut, unibi_from_status_line, "\x1b\\"); } - if (STARTS_WITH(term, "xterm") || STARTS_WITH(term, "rxvt")) { + if (STARTS_WITH(term, "xterm") || data->term == kTermRxvt) { const char *normal = unibi_get_str(ut, unibi_cursor_normal); if (!normal) { unibi_set_str(ut, unibi_cursor_normal, "\x1b[?25h"); @@ -982,7 +1008,7 @@ static void fix_terminfo(TUIData *data) if ((colorterm && strstr(colorterm, "256")) || strstr(term, "256") || strstr(term, "xterm")) { - // Assume TERM~=xterm or COLORTERM~=256 supports 256 colors. + // Assume TERM=~xterm or COLORTERM=~256 supports 256 colors. unibi_set_num(ut, unibi_max_colors, 256); unibi_set_str(ut, unibi_set_a_foreground, XTERM_SETAF); unibi_set_str(ut, unibi_set_a_background, XTERM_SETAB); @@ -990,8 +1016,13 @@ static void fix_terminfo(TUIData *data) end: // Fill some empty slots with common terminal strings - data->unibi_ext.set_cursor_color = (int)unibi_add_ext_str( - ut, NULL, "\033]12;#%p1%06x\007"); + if (data->term == kTermiTerm) { + data->unibi_ext.set_cursor_color = (int)unibi_add_ext_str( + ut, NULL, "\033]Pl%p1%06x\033\\"); + } else { + data->unibi_ext.set_cursor_color = (int)unibi_add_ext_str( + ut, NULL, "\033]12;#%p1%06x\007"); + } data->unibi_ext.enable_mouse = (int)unibi_add_ext_str(ut, NULL, "\x1b[?1002h\x1b[?1006h"); data->unibi_ext.disable_mouse = (int)unibi_add_ext_str(ut, NULL, -- cgit From 719095d7d33a05679f47f5adc1309b5432529385 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 22 Apr 2017 18:53:01 +0200 Subject: os_term_is_nice: Return true for rxvt and iTerm. --- src/nvim/os/env.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index 72bd0bf788..8f7a6e72b5 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -915,9 +915,20 @@ bool os_term_is_nice(void) return true; #else const char *vte_version = os_getenv("VTE_VERSION"); - return (vte_version && atoi(vte_version) >= 3900) - || NULL != os_getenv("KONSOLE_PROFILE_NAME") - || NULL != os_getenv("KONSOLE_DBUS_SESSION"); + if ((vte_version && atoi(vte_version) >= 3900) + || os_getenv("KONSOLE_PROFILE_NAME") + || os_getenv("KONSOLE_DBUS_SESSION")) { + return true; + } + const char *termprg = os_getenv("TERM_PROGRAM"); + if (termprg && striequal(termprg, "iTerm.app")) { + return true; + } + const char *term = os_getenv("TERM"); + if (term && strncmp(term, "rxvt", 4) == 0) { + return true; + } + return false; #endif } -- cgit From 1fe8945748620713402cab77a46501ec5311778b Mon Sep 17 00:00:00 2001 From: Patrick Jackson Date: Sat, 22 Apr 2017 17:32:56 -0700 Subject: refactor: Remove unused MAP_IMPL. (#6573) --- src/nvim/map.c | 1 - src/nvim/map.h | 1 - 2 files changed, 2 deletions(-) (limited to 'src') diff --git a/src/nvim/map.c b/src/nvim/map.c index 54a9e559af..366b286d14 100644 --- a/src/nvim/map.c +++ b/src/nvim/map.c @@ -142,7 +142,6 @@ static inline bool String_eq(String a, String b) MAP_IMPL(int, int, DEFAULT_INITIALIZER) -MAP_IMPL(cstr_t, uint64_t, DEFAULT_INITIALIZER) MAP_IMPL(cstr_t, ptr_t, DEFAULT_INITIALIZER) MAP_IMPL(ptr_t, ptr_t, DEFAULT_INITIALIZER) MAP_IMPL(uint64_t, ptr_t, DEFAULT_INITIALIZER) diff --git a/src/nvim/map.h b/src/nvim/map.h index ba3e84cb31..a4fccf47f9 100644 --- a/src/nvim/map.h +++ b/src/nvim/map.h @@ -25,7 +25,6 @@ void map_##T##_##U##_clear(Map(T, U) *map); MAP_DECLS(int, int) -MAP_DECLS(cstr_t, uint64_t) MAP_DECLS(cstr_t, ptr_t) MAP_DECLS(ptr_t, ptr_t) MAP_DECLS(uint64_t, ptr_t) -- cgit From 5c9860a0a2bf27d409c986673f0a74542561c4c3 Mon Sep 17 00:00:00 2001 From: Sander Bosma Date: Wed, 1 Mar 2017 10:43:47 +0100 Subject: api: Do not truncate errors <1 MB. #6237 Closes #5984 --- src/nvim/api/buffer.c | 44 ++++++++-------- src/nvim/api/private/defs.h | 4 +- src/nvim/api/private/helpers.c | 113 +++++++++++++++++++++++++---------------- src/nvim/api/private/helpers.h | 10 ---- src/nvim/api/tabpage.c | 4 +- src/nvim/api/ui.c | 18 +++---- src/nvim/api/vim.c | 44 ++++++++-------- src/nvim/api/window.c | 16 +++--- src/nvim/eval.c | 5 +- src/nvim/msgpack_rpc/channel.c | 73 +++++++++++++------------- src/nvim/msgpack_rpc/helpers.c | 22 ++++---- src/nvim/terminal.c | 10 ++-- src/nvim/tui/input.c | 2 +- 13 files changed, 197 insertions(+), 168 deletions(-) (limited to 'src') diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 1b3592679b..2f306ebfc8 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -171,7 +171,7 @@ ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id, end = normalize_index(buf, end, &oob); if (strict_indexing && oob) { - api_set_error(err, Validation, _("Index out of bounds")); + _api_set_error(err, kErrorTypeValidation, _("Index out of bounds")); return rv; } @@ -187,7 +187,7 @@ ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id, int64_t lnum = start + (int64_t)i; if (lnum > LONG_MAX) { - api_set_error(err, Validation, _("Line index is too high")); + _api_set_error(err, kErrorTypeValidation, _("Line index is too high")); goto end; } @@ -283,14 +283,14 @@ void nvim_buf_set_lines(uint64_t channel_id, end = normalize_index(buf, end, &oob); if (strict_indexing && oob) { - api_set_error(err, Validation, _("Index out of bounds")); + _api_set_error(err, kErrorTypeValidation, _("Index out of bounds")); return; } if (start > end) { - api_set_error(err, - Validation, + _api_set_error(err, + kErrorTypeValidation, _("Argument \"start\" is higher than \"end\"")); return; } @@ -304,8 +304,8 @@ void nvim_buf_set_lines(uint64_t channel_id, for (size_t i = 0; i < new_len; i++) { if (replacement.items[i].type != kObjectTypeString) { - api_set_error(err, - Validation, + _api_set_error(err, + kErrorTypeValidation, _("All items in the replacement array must be strings")); goto end; } @@ -317,7 +317,7 @@ void nvim_buf_set_lines(uint64_t channel_id, lines[i] = xmallocz(l.size); for (size_t j = 0; j < l.size; j++) { if (l.data[j] == '\n' && channel_id != INTERNAL_CALL) { - api_set_error(err, Exception, _("string cannot contain newlines")); + _api_set_error(err, kErrorTypeException, _("string cannot contain newlines")); new_len = i + 1; goto end; } @@ -330,7 +330,7 @@ void nvim_buf_set_lines(uint64_t channel_id, switch_to_win_for_buf(buf, &save_curwin, &save_curtab, &save_curbuf); if (u_save((linenr_T)(start - 1), (linenr_T)end) == FAIL) { - api_set_error(err, Exception, _("Failed to save undo information")); + _api_set_error(err, kErrorTypeException, _("Failed to save undo information")); goto end; } @@ -340,7 +340,7 @@ void nvim_buf_set_lines(uint64_t channel_id, size_t to_delete = (new_len < old_len) ? (size_t)(old_len - new_len) : 0; for (size_t i = 0; i < to_delete; i++) { if (ml_delete((linenr_T)start, false) == FAIL) { - api_set_error(err, Exception, _("Failed to delete line")); + _api_set_error(err, kErrorTypeException, _("Failed to delete line")); goto end; } } @@ -357,12 +357,12 @@ void nvim_buf_set_lines(uint64_t channel_id, int64_t lnum = start + (int64_t)i; if (lnum > LONG_MAX) { - api_set_error(err, Validation, _("Index value is too high")); + _api_set_error(err, kErrorTypeValidation, _("Index value is too high")); goto end; } if (ml_replace((linenr_T)lnum, (char_u *)lines[i], false) == FAIL) { - api_set_error(err, Exception, _("Failed to replace line")); + _api_set_error(err, kErrorTypeException, _("Failed to replace line")); goto end; } // Mark lines that haven't been passed to the buffer as they need @@ -375,12 +375,12 @@ void nvim_buf_set_lines(uint64_t channel_id, int64_t lnum = start + (int64_t)i - 1; if (lnum > LONG_MAX) { - api_set_error(err, Validation, _("Index value is too high")); + _api_set_error(err, kErrorTypeValidation, _("Index value is too high")); goto end; } if (ml_append((linenr_T)lnum, (char_u *)lines[i], 0, false) == FAIL) { - api_set_error(err, Exception, _("Failed to insert line")); + _api_set_error(err, kErrorTypeException, _("Failed to insert line")); goto end; } @@ -627,7 +627,7 @@ void nvim_buf_set_name(Buffer buffer, String name, Error *err) } if (ren_ret == FAIL) { - api_set_error(err, Exception, _("Failed to rename buffer")); + _api_set_error(err, kErrorTypeException, _("Failed to rename buffer")); } } @@ -639,7 +639,9 @@ Boolean nvim_buf_is_valid(Buffer buffer) FUNC_API_SINCE(1) { Error stub = ERROR_INIT; - return find_buffer_by_handle(buffer, &stub) != NULL; + Boolean ret = find_buffer_by_handle(buffer, &stub) != NULL; + xfree(stub.msg); + return ret; } /// Inserts a sequence of lines to a buffer at a certain index @@ -678,7 +680,7 @@ ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err) } if (name.size != 1) { - api_set_error(err, Validation, _("Mark name must be a single character")); + _api_set_error(err, kErrorTypeValidation, _("Mark name must be a single character")); return rv; } @@ -696,7 +698,7 @@ ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err) } if (posp == NULL) { - api_set_error(err, Validation, _("Invalid mark name")); + _api_set_error(err, kErrorTypeValidation, _("Invalid mark name")); return rv; } @@ -751,11 +753,11 @@ Integer nvim_buf_add_highlight(Buffer buffer, } if (line < 0 || line >= MAXLNUM) { - api_set_error(err, Validation, _("Line number outside range")); + _api_set_error(err, kErrorTypeValidation, _("Line number outside range")); return 0; } if (col_start < 0 || col_start > MAXCOL) { - api_set_error(err, Validation, _("Column value outside range")); + _api_set_error(err, kErrorTypeValidation, _("Column value outside range")); return 0; } if (col_end < 0 || col_end > MAXCOL) { @@ -792,7 +794,7 @@ void nvim_buf_clear_highlight(Buffer buffer, } if (line_start < 0 || line_start >= MAXLNUM) { - api_set_error(err, Validation, _("Line number outside range")); + _api_set_error(err, kErrorTypeValidation, _("Line number outside range")); return; } if (line_end < 0 || line_end > MAXLNUM) { diff --git a/src/nvim/api/private/defs.h b/src/nvim/api/private/defs.h index 223aab09dc..a07422bd12 100644 --- a/src/nvim/api/private/defs.h +++ b/src/nvim/api/private/defs.h @@ -8,7 +8,7 @@ #define ARRAY_DICT_INIT {.size = 0, .capacity = 0, .items = NULL} #define STRING_INIT {.data = NULL, .size = 0} #define OBJECT_INIT { .type = kObjectTypeNil } -#define ERROR_INIT { .set = false } +#define ERROR_INIT { .set = false, .msg = NULL } #define REMOTE_TYPE(type) typedef handle_T type #ifdef INCLUDE_GENERATED_DECLARATIONS @@ -38,7 +38,7 @@ typedef enum { typedef struct { ErrorType type; - char msg[1024]; + char *msg; bool set; } Error; diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index 5877b848fc..e6632525e1 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -61,7 +61,7 @@ bool try_end(Error *err) discard_current_exception(); } - api_set_error(err, Exception, _("Keyboard interrupt")); + _api_set_error(err, kErrorTypeException, _("Keyboard interrupt")); got_int = false; } else if (msg_list != NULL && *msg_list != NULL) { int should_free; @@ -69,15 +69,14 @@ bool try_end(Error *err) ET_ERROR, NULL, &should_free); - xstrlcpy(err->msg, msg, sizeof(err->msg)); - err->set = true; + _api_set_error(err, err->type, "%s", msg); free_global_msglist(); if (should_free) { xfree(msg); } } else if (did_throw) { - api_set_error(err, Exception, "%s", current_exception->value); + _api_set_error(err, kErrorTypeException, "%s", current_exception->value); discard_current_exception(); } @@ -94,7 +93,7 @@ Object dict_get_value(dict_T *dict, String key, Error *err) dictitem_T *const di = tv_dict_find(dict, key.data, (ptrdiff_t)key.size); if (di == NULL) { - api_set_error(err, Validation, _("Key not found")); + _api_set_error(err, kErrorTypeValidation, _("Key not found")); return (Object) OBJECT_INIT; } @@ -118,17 +117,17 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del, Object rv = OBJECT_INIT; if (dict->dv_lock) { - api_set_error(err, Exception, _("Dictionary is locked")); + _api_set_error(err, kErrorTypeException, _("Dictionary is locked")); return rv; } if (key.size == 0) { - api_set_error(err, Validation, _("Empty variable names aren't allowed")); + _api_set_error(err, kErrorTypeValidation, _("Empty variable names aren't allowed")); return rv; } if (key.size > INT_MAX) { - api_set_error(err, Validation, _("Key length is too high")); + _api_set_error(err, kErrorTypeValidation, _("Key length is too high")); return rv; } @@ -136,13 +135,13 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del, if (di != NULL) { if (di->di_flags & DI_FLAGS_RO) { - api_set_error(err, Exception, _("Key is read-only: %s"), key.data); + _api_set_error(err, kErrorTypeException, _("Key is read-only: %s"), key.data); return rv; } else if (di->di_flags & DI_FLAGS_FIX) { - api_set_error(err, Exception, _("Key is fixed: %s"), key.data); + _api_set_error(err, kErrorTypeException, _("Key is fixed: %s"), key.data); return rv; } else if (di->di_flags & DI_FLAGS_LOCK) { - api_set_error(err, Exception, _("Key is locked: %s"), key.data); + _api_set_error(err, kErrorTypeException, _("Key is locked: %s"), key.data); return rv; } } @@ -151,7 +150,7 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del, // Delete the key if (di == NULL) { // Doesn't exist, fail - api_set_error(err, Validation, _("Key \"%s\" doesn't exist"), key.data); + _api_set_error(err, kErrorTypeValidation, _("Key \"%s\" doesn't exist"), key.data); } else { // Return the old value if (retval) { @@ -203,7 +202,7 @@ Object get_option_from(void *from, int type, String name, Error *err) Object rv = OBJECT_INIT; if (name.size == 0) { - api_set_error(err, Validation, _("Empty option name")); + _api_set_error(err, kErrorTypeValidation, _("Empty option name")); return rv; } @@ -214,8 +213,8 @@ Object get_option_from(void *from, int type, String name, Error *err) type, from); if (!flags) { - api_set_error(err, - Validation, + _api_set_error(err, + kErrorTypeValidation, _("Invalid option name \"%s\""), name.data); return rv; @@ -233,14 +232,14 @@ Object get_option_from(void *from, int type, String name, Error *err) rv.data.string.data = stringval; rv.data.string.size = strlen(stringval); } else { - api_set_error(err, - Exception, + _api_set_error(err, + kErrorTypeException, _("Unable to get value for option \"%s\""), name.data); } } else { - api_set_error(err, - Exception, + _api_set_error(err, + kErrorTypeException, _("Unknown type for option \"%s\""), name.data); } @@ -258,15 +257,15 @@ Object get_option_from(void *from, int type, String name, Error *err) void set_option_to(void *to, int type, String name, Object value, Error *err) { if (name.size == 0) { - api_set_error(err, Validation, _("Empty option name")); + _api_set_error(err, kErrorTypeValidation, _("Empty option name")); return; } int flags = get_option_value_strict(name.data, NULL, NULL, type, to); if (flags == 0) { - api_set_error(err, - Validation, + _api_set_error(err, + kErrorTypeValidation, _("Invalid option name \"%s\""), name.data); return; @@ -274,14 +273,14 @@ void set_option_to(void *to, int type, String name, Object value, Error *err) if (value.type == kObjectTypeNil) { if (type == SREQ_GLOBAL) { - api_set_error(err, - Exception, + _api_set_error(err, + kErrorTypeException, _("Unable to unset option \"%s\""), name.data); return; } else if (!(flags & SOPT_GLOBAL)) { - api_set_error(err, - Exception, + _api_set_error(err, + kErrorTypeException, _("Cannot unset option \"%s\" " "because it doesn't have a global value"), name.data); @@ -296,8 +295,8 @@ void set_option_to(void *to, int type, String name, Object value, Error *err) if (flags & SOPT_BOOL) { if (value.type != kObjectTypeBoolean) { - api_set_error(err, - Validation, + _api_set_error(err, + kErrorTypeValidation, _("Option \"%s\" requires a boolean value"), name.data); return; @@ -307,16 +306,16 @@ void set_option_to(void *to, int type, String name, Object value, Error *err) set_option_value_for(name.data, val, NULL, opt_flags, type, to, err); } else if (flags & SOPT_NUM) { if (value.type != kObjectTypeInteger) { - api_set_error(err, - Validation, + _api_set_error(err, + kErrorTypeValidation, _("Option \"%s\" requires an integer value"), name.data); return; } if (value.data.integer > INT_MAX || value.data.integer < INT_MIN) { - api_set_error(err, - Validation, + _api_set_error(err, + kErrorTypeValidation, _("Value for option \"%s\" is outside range"), name.data); return; @@ -326,8 +325,8 @@ void set_option_to(void *to, int type, String name, Object value, Error *err) set_option_value_for(name.data, val, NULL, opt_flags, type, to, err); } else { if (value.type != kObjectTypeString) { - api_set_error(err, - Validation, + _api_set_error(err, + kErrorTypeValidation, _("Option \"%s\" requires a string value"), name.data); return; @@ -561,13 +560,13 @@ buf_T *find_buffer_by_handle(Buffer buffer, Error *err) buf_T *rv = handle_get_buffer(buffer); if (!rv) { - api_set_error(err, Validation, _("Invalid buffer id")); + _api_set_error(err, kErrorTypeValidation, _("Invalid buffer id")); } return rv; } -win_T * find_window_by_handle(Window window, Error *err) +win_T *find_window_by_handle(Window window, Error *err) { if (window == 0) { return curwin; @@ -576,13 +575,13 @@ win_T * find_window_by_handle(Window window, Error *err) win_T *rv = handle_get_window(window); if (!rv) { - api_set_error(err, Validation, _("Invalid window id")); + _api_set_error(err, kErrorTypeValidation, _("Invalid window id")); } return rv; } -tabpage_T * find_tab_by_handle(Tabpage tabpage, Error *err) +tabpage_T *find_tab_by_handle(Tabpage tabpage, Error *err) { if (tabpage == 0) { return curtab; @@ -591,7 +590,7 @@ tabpage_T * find_tab_by_handle(Tabpage tabpage, Error *err) tabpage_T *rv = handle_get_tabpage(tabpage); if (!rv) { - api_set_error(err, Validation, _("Invalid tabpage id")); + _api_set_error(err, kErrorTypeValidation, _("Invalid tabpage id")); } return rv; @@ -659,7 +658,7 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err) case kObjectTypeInteger: if (obj.data.integer > VARNUMBER_MAX || obj.data.integer < VARNUMBER_MIN) { - api_set_error(err, Validation, _("Integer value outside range")); + _api_set_error(err, kErrorTypeValidation, _("Integer value outside range")); return false; } @@ -713,7 +712,7 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err) String key = item.key; if (key.size == 0) { - api_set_error(err, Validation, + _api_set_error(err, kErrorTypeValidation, _("Empty dictionary keys aren't allowed")); // cleanup tv_dict_free(dict); @@ -801,6 +800,12 @@ void api_free_dictionary(Dictionary value) xfree(value.items); } +void api_free_error(Error *value) +{ + xfree(value->msg); + value->msg = NULL; +} + Dictionary api_metadata(void) { static Dictionary metadata = ARRAY_DICT_INIT; @@ -926,8 +931,8 @@ static void set_option_value_for(char *key, if (try_end(err)) { return; } - api_set_error(err, - Exception, + _api_set_error(err, + kErrorTypeException, _("Problem while switching windows")); return; } @@ -965,6 +970,26 @@ static void set_option_value_err(char *key, return; } - api_set_error(err, Exception, "%s", errmsg); + _api_set_error(err, kErrorTypeException, "%s", errmsg); } } + +void _api_set_error(Error *err, ErrorType errType, const char *format, ...) + FUNC_ATTR_NONNULL_ALL +{ + va_list args1; + va_list args2; + va_start(args1, format); + va_copy(args2, args1); + int len = vsnprintf(NULL, 0, format, args1); + va_end(args1); + assert(len >= 0); + // Limit error message to 1 MB. + size_t bufsize = MIN((size_t)len + 1, 1024 * 1024); + err->msg = xmalloc(bufsize); + vsnprintf(err->msg, bufsize, format, args2); + va_end(args2); + + err->set = true; + err->type = errType; +} diff --git a/src/nvim/api/private/helpers.h b/src/nvim/api/private/helpers.h index 20b4015fb5..681945ac9c 100644 --- a/src/nvim/api/private/helpers.h +++ b/src/nvim/api/private/helpers.h @@ -8,16 +8,6 @@ #include "nvim/memory.h" #include "nvim/lib/kvec.h" -// -V:api_set_error:618 -#define api_set_error(err, errtype, ...) \ - do { \ - snprintf((err)->msg, \ - sizeof((err)->msg), \ - __VA_ARGS__); \ - (err)->set = true; \ - (err)->type = kErrorType##errtype; \ - } while (0) - #define OBJECT_OBJ(o) o #define BOOLEAN_OBJ(b) ((Object) { \ diff --git a/src/nvim/api/tabpage.c b/src/nvim/api/tabpage.c index 29592408fc..e6d5f7edad 100644 --- a/src/nvim/api/tabpage.c +++ b/src/nvim/api/tabpage.c @@ -193,6 +193,8 @@ Boolean nvim_tabpage_is_valid(Tabpage tabpage) FUNC_API_SINCE(1) { Error stub = ERROR_INIT; - return find_tab_by_handle(tabpage, &stub) != NULL; + Boolean ret = find_tab_by_handle(tabpage, &stub) != NULL; + xfree(stub.msg); + return ret; } diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 2a33d2ad72..534274db0f 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -55,12 +55,12 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (pmap_has(uint64_t)(connected_uis, channel_id)) { - api_set_error(err, Exception, _("UI already attached for channel")); + _api_set_error(err, kErrorTypeException, _("UI already attached for channel")); return; } if (width <= 0 || height <= 0) { - api_set_error(err, Validation, + _api_set_error(err, kErrorTypeValidation, _("Expected width > 0 and height > 0")); return; } @@ -126,7 +126,7 @@ void nvim_ui_detach(uint64_t channel_id, Error *err) FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (!pmap_has(uint64_t)(connected_uis, channel_id)) { - api_set_error(err, Exception, _("UI is not attached for channel")); + _api_set_error(err, kErrorTypeException, _("UI is not attached for channel")); return; } remote_ui_disconnect(channel_id); @@ -138,12 +138,12 @@ void nvim_ui_try_resize(uint64_t channel_id, Integer width, FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (!pmap_has(uint64_t)(connected_uis, channel_id)) { - api_set_error(err, Exception, _("UI is not attached for channel")); + _api_set_error(err, kErrorTypeException, _("UI is not attached for channel")); return; } if (width <= 0 || height <= 0) { - api_set_error(err, Validation, + _api_set_error(err, kErrorTypeValidation, _("Expected width > 0 and height > 0")); return; } @@ -159,7 +159,7 @@ void nvim_ui_set_option(uint64_t channel_id, String name, FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (!pmap_has(uint64_t)(connected_uis, channel_id)) { - api_set_error(error, Exception, _("UI is not attached for channel")); + _api_set_error(error, kErrorTypeException, _("UI is not attached for channel")); return; } UI *ui = pmap_get(uint64_t)(connected_uis, channel_id); @@ -173,19 +173,19 @@ void nvim_ui_set_option(uint64_t channel_id, String name, static void ui_set_option(UI *ui, String name, Object value, Error *error) { if (strcmp(name.data, "rgb") == 0) { if (value.type != kObjectTypeBoolean) { - api_set_error(error, Validation, _("rgb must be a Boolean")); + _api_set_error(error, kErrorTypeValidation, _("rgb must be a Boolean")); return; } ui->rgb = value.data.boolean; } else if (strcmp(name.data, "popupmenu_external") == 0) { if (value.type != kObjectTypeBoolean) { - api_set_error(error, Validation, + _api_set_error(error, kErrorTypeValidation, _("popupmenu_external must be a Boolean")); return; } ui->pum_external = value.data.boolean; } else { - api_set_error(error, Validation, _("No such ui option")); + _api_set_error(error, kErrorTypeValidation, _("No such ui option")); } } diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index e5ef4a35c1..bd4a196367 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -188,7 +188,7 @@ Object nvim_eval(String expr, Error *err) typval_T rettv; if (eval0((char_u *)expr.data, &rettv, NULL, true) == FAIL) { - api_set_error(err, Exception, "Failed to evaluate expression"); + _api_set_error(err, kErrorTypeException, "Failed to evaluate expression"); } if (!try_end(err)) { @@ -214,7 +214,7 @@ Object nvim_call_function(String fname, Array args, Error *err) { Object rv = OBJECT_INIT; if (args.size > MAX_FUNC_ARGS) { - api_set_error(err, Validation, + _api_set_error(err, kErrorTypeValidation, _("Function called with too many arguments.")); return rv; } @@ -237,7 +237,7 @@ Object nvim_call_function(String fname, Array args, Error *err) curwin->w_cursor.lnum, curwin->w_cursor.lnum, &dummy, true, NULL, NULL); if (r == FAIL) { - api_set_error(err, Exception, _("Error calling function.")); + _api_set_error(err, kErrorTypeException, _("Error calling function.")); } if (!try_end(err)) { rv = vim_to_object(&rettv); @@ -262,7 +262,7 @@ Integer nvim_strwidth(String str, Error *err) FUNC_API_SINCE(1) { if (str.size > INT_MAX) { - api_set_error(err, Validation, _("String length is too high")); + _api_set_error(err, kErrorTypeValidation, _("String length is too high")); return 0; } @@ -318,7 +318,7 @@ void nvim_set_current_dir(String dir, Error *err) FUNC_API_SINCE(1) { if (dir.size >= MAXPATHL) { - api_set_error(err, Validation, _("Directory string is too long")); + _api_set_error(err, kErrorTypeValidation, _("Directory string is too long")); return; } @@ -330,7 +330,7 @@ void nvim_set_current_dir(String dir, Error *err) if (vim_chdir((char_u *)string, kCdScopeGlobal)) { if (!try_end(err)) { - api_set_error(err, Exception, _("Failed to change directory")); + _api_set_error(err, kErrorTypeException, _("Failed to change directory")); } return; } @@ -538,8 +538,8 @@ void nvim_set_current_buf(Buffer buffer, Error *err) try_start(); int result = do_buffer(DOBUF_GOTO, DOBUF_FIRST, FORWARD, buf->b_fnum, 0); if (!try_end(err) && result == FAIL) { - api_set_error(err, - Exception, + _api_set_error(err, + kErrorTypeException, _("Failed to switch to buffer %d"), buffer); } @@ -591,8 +591,8 @@ void nvim_set_current_win(Window window, Error *err) try_start(); goto_tabpage_win(win_find_tabpage(win), win); if (!try_end(err) && win != curwin) { - api_set_error(err, - Exception, + _api_set_error(err, + kErrorTypeException, _("Failed to switch to window %d"), window); } @@ -645,8 +645,8 @@ void nvim_set_current_tabpage(Tabpage tabpage, Error *err) try_start(); goto_tabpage_tp(tp, true, true); if (!try_end(err) && tp != curtab) { - api_set_error(err, - Exception, + _api_set_error(err, + kErrorTypeException, _("Failed to switch to tabpage %d"), tabpage); } @@ -744,30 +744,30 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err) size_t i; // also used for freeing the variables for (i = 0; i < calls.size; i++) { if (calls.items[i].type != kObjectTypeArray) { - api_set_error(err, - Validation, + _api_set_error(err, + kErrorTypeValidation, _("All items in calls array must be arrays")); goto validation_error; } Array call = calls.items[i].data.array; if (call.size != 2) { - api_set_error(err, - Validation, + _api_set_error(err, + kErrorTypeValidation, _("All items in calls array must be arrays of size 2")); goto validation_error; } if (call.items[0].type != kObjectTypeString) { - api_set_error(err, - Validation, + _api_set_error(err, + kErrorTypeValidation, _("name must be String")); goto validation_error; } String name = call.items[0].data.string; if (call.items[1].type != kObjectTypeArray) { - api_set_error(err, - Validation, + _api_set_error(err, + kErrorTypeValidation, _("args must be Array")); goto validation_error; } @@ -794,10 +794,12 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err) } else { ADD(rv, NIL); } - return rv; + goto theend; validation_error: api_free_array(results); +theend: + api_free_error(&nested_error); return rv; } diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c index e1bb70ee0d..254ab1c09f 100644 --- a/src/nvim/api/window.c +++ b/src/nvim/api/window.c @@ -64,8 +64,8 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err) if (pos.size != 2 || pos.items[0].type != kObjectTypeInteger || pos.items[1].type != kObjectTypeInteger) { - api_set_error(err, - Validation, + _api_set_error(err, + kErrorTypeValidation, _("Argument \"pos\" must be a [row, col] array")); return; } @@ -78,12 +78,12 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err) int64_t col = pos.items[1].data.integer; if (row <= 0 || row > win->w_buffer->b_ml.ml_line_count) { - api_set_error(err, Validation, _("Cursor position outside buffer")); + _api_set_error(err, kErrorTypeValidation, _("Cursor position outside buffer")); return; } if (col > MAXCOL || col < 0) { - api_set_error(err, Validation, _("Column value outside range")); + _api_set_error(err, kErrorTypeValidation, _("Column value outside range")); return; } @@ -132,7 +132,7 @@ void nvim_win_set_height(Window window, Integer height, Error *err) } if (height > INT_MAX || height < INT_MIN) { - api_set_error(err, Validation, _("Height value outside range")); + _api_set_error(err, kErrorTypeValidation, _("Height value outside range")); return; } @@ -177,7 +177,7 @@ void nvim_win_set_width(Window window, Integer width, Error *err) } if (width > INT_MAX || width < INT_MIN) { - api_set_error(err, Validation, _("Width value outside range")); + _api_set_error(err, kErrorTypeValidation, _("Width value outside range")); return; } @@ -387,6 +387,8 @@ Boolean nvim_win_is_valid(Window window) FUNC_API_SINCE(1) { Error stub = ERROR_INIT; - return find_window_by_handle(window, &stub) != NULL; + Boolean ret = find_window_by_handle(window, &stub) != NULL; + xfree(stub.msg); + return ret; } diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 7cef0d81ed..56dc35c31d 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -6524,6 +6524,7 @@ static void api_wrapper(typval_T *argvars, typval_T *rettv, FunPtr fptr) end: api_free_array(args); api_free_object(result); + xfree(err.msg); } /* @@ -13794,6 +13795,7 @@ static void f_rpcrequest(typval_T *argvars, typval_T *rettv, FunPtr fptr) end: api_free_object(result); + xfree(err.msg); } // "rpcstart()" function (DEPRECATED) @@ -16523,7 +16525,7 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr) curbuf->b_p_swf = false; (void)setfname(curbuf, (char_u *)buf, NULL, true); // Save the job id and pid in b:terminal_job_{id,pid} - Error err; + Error err = ERROR_INIT; dict_set_var(curbuf->b_vars, cstr_as_string("terminal_job_id"), INTEGER_OBJ(rettv->vval.v_number), false, false, &err); dict_set_var(curbuf->b_vars, cstr_as_string("terminal_job_pid"), @@ -16532,6 +16534,7 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr) Terminal *term = terminal_open(topts); data->term = term; data->refcount++; + xfree(err.msg); return; } diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index b2c6ef852c..06cdf7d1f1 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -192,7 +192,7 @@ Object channel_send_call(uint64_t id, Channel *channel = NULL; if (!(channel = pmap_get(uint64_t)(channels, id)) || channel->closed) { - api_set_error(err, Exception, _("Invalid channel \"%" PRIu64 "\""), id); + _api_set_error(err, kErrorTypeException, _("Invalid channel \"%" PRIu64 "\""), id); api_free_array(args); return NIL; } @@ -212,7 +212,7 @@ Object channel_send_call(uint64_t id, if (frame.errored) { if (frame.result.type == kObjectTypeString) { - api_set_error(err, Exception, "%s", frame.result.data.string.data); + _api_set_error(err, kErrorTypeException, "%s", frame.result.data.string.data); } else if (frame.result.type == kObjectTypeArray) { // Should be an error in the form [type, message] Array array = frame.result.data.array; @@ -220,14 +220,13 @@ Object channel_send_call(uint64_t id, && (array.items[0].data.integer == kErrorTypeException || array.items[0].data.integer == kErrorTypeValidation) && array.items[1].type == kObjectTypeString) { - err->type = (ErrorType) array.items[0].data.integer; - xstrlcpy(err->msg, array.items[1].data.string.data, sizeof(err->msg)); - err->set = true; + _api_set_error(err, (ErrorType)array.items[0].data.integer, "%s", + array.items[1].data.string.data); } else { - api_set_error(err, Exception, "%s", "unknown error"); + _api_set_error(err, kErrorTypeException, "%s", "unknown error"); } } else { - api_set_error(err, Exception, "%s", "unknown error"); + _api_set_error(err, kErrorTypeException, "%s", "unknown error"); } api_free_object(frame.result); @@ -412,38 +411,38 @@ static void handle_request(Channel *channel, msgpack_object *request) channel->id); call_set_error(channel, buf); } - return; - } - - // Retrieve the request handler - MsgpackRpcRequestHandler handler; - msgpack_object *method = msgpack_rpc_method(request); - - if (method) { - handler = msgpack_rpc_get_handler_for(method->via.bin.ptr, - method->via.bin.size); } else { - handler.fn = msgpack_rpc_handle_missing_method; - handler.async = true; - } + // Retrieve the request handler + MsgpackRpcRequestHandler handler; + msgpack_object *method = msgpack_rpc_method(request); - Array args = ARRAY_DICT_INIT; - if (!msgpack_rpc_to_array(msgpack_rpc_args(request), &args)) { - handler.fn = msgpack_rpc_handle_invalid_arguments; - handler.async = true; - } + if (method) { + handler = msgpack_rpc_get_handler_for(method->via.bin.ptr, + method->via.bin.size); + } else { + handler.fn = msgpack_rpc_handle_missing_method; + handler.async = true; + } - RequestEvent *event_data = xmalloc(sizeof(RequestEvent)); - event_data->channel = channel; - event_data->handler = handler; - event_data->args = args; - event_data->request_id = request_id; - incref(channel); - if (handler.async) { - on_request_event((void **)&event_data); - } else { - multiqueue_put(channel->events, on_request_event, 1, event_data); + Array args = ARRAY_DICT_INIT; + if (!msgpack_rpc_to_array(msgpack_rpc_args(request), &args)) { + handler.fn = msgpack_rpc_handle_invalid_arguments; + handler.async = true; + } + + RequestEvent *event_data = xmalloc(sizeof(RequestEvent)); + event_data->channel = channel; + event_data->handler = handler; + event_data->args = args; + event_data->request_id = request_id; + incref(channel); + if (handler.async) { + on_request_event((void **)&event_data); + } else { + multiqueue_put(channel->events, on_request_event, 1, event_data); + } } + xfree(error.msg); } static void on_request_event(void **argv) @@ -470,6 +469,7 @@ static void on_request_event(void **argv) api_free_array(args); decref(channel); xfree(e); + xfree(error.msg); } static bool channel_write(Channel *channel, WBuffer *buffer) @@ -512,12 +512,13 @@ static bool channel_write(Channel *channel, WBuffer *buffer) static void send_error(Channel *channel, uint64_t id, char *err) { Error e = ERROR_INIT; - api_set_error(&e, Exception, "%s", err); + _api_set_error(&e, kErrorTypeException, "%s", err); channel_write(channel, serialize_response(channel->id, id, &e, NIL, &out_buffer)); + xfree(e.msg); } static void send_request(Channel *channel, diff --git a/src/nvim/msgpack_rpc/helpers.c b/src/nvim/msgpack_rpc/helpers.c index 967ce31c1b..c273343b41 100644 --- a/src/nvim/msgpack_rpc/helpers.c +++ b/src/nvim/msgpack_rpc/helpers.c @@ -475,8 +475,7 @@ Object msgpack_rpc_handle_missing_method(uint64_t channel_id, Array args, Error *error) { - snprintf(error->msg, sizeof(error->msg), "Invalid method name"); - error->set = true; + _api_set_error(error, error->type, "Invalid method name"); return NIL; } @@ -485,8 +484,7 @@ Object msgpack_rpc_handle_invalid_arguments(uint64_t channel_id, Array args, Error *error) { - snprintf(error->msg, sizeof(error->msg), "Invalid method arguments"); - error->set = true; + _api_set_error(error, error->type, "Invalid method arguments"); return NIL; } @@ -572,29 +570,29 @@ void msgpack_rpc_validate(uint64_t *response_id, *response_id = NO_RESPONSE; // Validate the basic structure of the msgpack-rpc payload if (req->type != MSGPACK_OBJECT_ARRAY) { - api_set_error(err, Validation, _("Message is not an array")); + _api_set_error(err, kErrorTypeValidation, _("Message is not an array")); return; } if (req->via.array.size == 0) { - api_set_error(err, Validation, _("Message is empty")); + _api_set_error(err, kErrorTypeValidation, _("Message is empty")); return; } if (req->via.array.ptr[0].type != MSGPACK_OBJECT_POSITIVE_INTEGER) { - api_set_error(err, Validation, _("Message type must be an integer")); + _api_set_error(err, kErrorTypeValidation, _("Message type must be an integer")); return; } uint64_t type = req->via.array.ptr[0].via.u64; if (type != kMessageTypeRequest && type != kMessageTypeNotification) { - api_set_error(err, Validation, _("Unknown message type")); + _api_set_error(err, kErrorTypeValidation, _("Unknown message type")); return; } if ((type == kMessageTypeRequest && req->via.array.size != 4) || (type == kMessageTypeNotification && req->via.array.size != 3)) { - api_set_error(err, Validation, _("Request array size should be 4 (request) " + _api_set_error(err, kErrorTypeValidation, _("Request array size should be 4 (request) " "or 3 (notification)")); return; } @@ -602,19 +600,19 @@ void msgpack_rpc_validate(uint64_t *response_id, if (type == kMessageTypeRequest) { msgpack_object *id_obj = msgpack_rpc_msg_id(req); if (!id_obj) { - api_set_error(err, Validation, _("ID must be a positive integer")); + _api_set_error(err, kErrorTypeValidation, _("ID must be a positive integer")); return; } *response_id = id_obj->via.u64; } if (!msgpack_rpc_method(req)) { - api_set_error(err, Validation, _("Method must be a string")); + _api_set_error(err, kErrorTypeValidation, _("Method must be a string")); return; } if (!msgpack_rpc_args(req)) { - api_set_error(err, Validation, _("Parameters must be an array")); + _api_set_error(err, kErrorTypeValidation, _("Parameters must be an array")); return; } } diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 19b9bdc19f..43e4ea87e3 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -633,13 +633,14 @@ static int term_movecursor(VTermPos new, VTermPos old, int visible, static void buf_set_term_title(buf_T *buf, char *title) FUNC_ATTR_NONNULL_ALL { - Error err; + Error err = ERROR_INIT; dict_set_var(buf->b_vars, STATIC_CSTR_AS_STRING("term_title"), STRING_OBJ(cstr_as_string(title)), false, false, &err); + xfree(err.msg); } static int term_settermprop(VTermProp prop, VTermValue *val, void *data) @@ -1220,12 +1221,15 @@ static bool is_focused(Terminal *term) #define GET_CONFIG_VALUE(k, o) \ do { \ - Error err; \ + Error err = ERROR_INIT; \ /* Only called from terminal_open where curbuf->terminal is the */ \ /* context */ \ o = dict_get_value(curbuf->b_vars, cstr_as_string(k), &err); \ + xfree(err.msg); \ if (o.type == kObjectTypeNil) { \ - o = dict_get_value(&globvardict, cstr_as_string(k), &err); \ + Error err2 = ERROR_INIT; \ + o = dict_get_value(&globvardict, cstr_as_string(k), &err2); \ + xfree(err2.msg); \ } \ } while (0) diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c index 3f2ccd4746..921f67fb7d 100644 --- a/src/nvim/tui/input.c +++ b/src/nvim/tui/input.c @@ -228,7 +228,7 @@ static int get_key_code_timeout(void) if (nvim_get_option(cstr_as_string("ttimeout"), &err).data.boolean) { ms = nvim_get_option(cstr_as_string("ttimeoutlen"), &err).data.integer; } - + xfree(err.msg); return (int)ms; } -- cgit From 2a49163103827465f25810f5f4e3d4305159f209 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 23 Apr 2017 15:59:59 +0200 Subject: api_clear_error() --- src/nvim/api/buffer.c | 2 +- src/nvim/api/private/helpers.c | 3 ++- src/nvim/api/tabpage.c | 2 +- src/nvim/api/vim.c | 2 +- src/nvim/api/window.c | 2 +- src/nvim/eval.c | 7 ++--- src/nvim/msgpack_rpc/channel.c | 60 +++++++++++++++++++++--------------------- src/nvim/terminal.c | 9 +++---- src/nvim/tui/input.c | 2 +- 9 files changed, 45 insertions(+), 44 deletions(-) (limited to 'src') diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 2f306ebfc8..81d25d7c95 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -640,7 +640,7 @@ Boolean nvim_buf_is_valid(Buffer buffer) { Error stub = ERROR_INIT; Boolean ret = find_buffer_by_handle(buffer, &stub) != NULL; - xfree(stub.msg); + api_clear_error(&stub); return ret; } diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index e6632525e1..547ac29bed 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -800,7 +800,8 @@ void api_free_dictionary(Dictionary value) xfree(value.items); } -void api_free_error(Error *value) +void api_clear_error(Error *value) + FUNC_ATTR_NONNULL_ALL { xfree(value->msg); value->msg = NULL; diff --git a/src/nvim/api/tabpage.c b/src/nvim/api/tabpage.c index e6d5f7edad..6f2f9e1d2a 100644 --- a/src/nvim/api/tabpage.c +++ b/src/nvim/api/tabpage.c @@ -194,7 +194,7 @@ Boolean nvim_tabpage_is_valid(Tabpage tabpage) { Error stub = ERROR_INIT; Boolean ret = find_tab_by_handle(tabpage, &stub) != NULL; - xfree(stub.msg); + api_clear_error(&stub); return ret; } diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index bd4a196367..2c78ffdec1 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -799,7 +799,7 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err) validation_error: api_free_array(results); theend: - api_free_error(&nested_error); + api_clear_error(&nested_error); return rv; } diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c index 254ab1c09f..b8326c1198 100644 --- a/src/nvim/api/window.c +++ b/src/nvim/api/window.c @@ -388,7 +388,7 @@ Boolean nvim_win_is_valid(Window window) { Error stub = ERROR_INIT; Boolean ret = find_window_by_handle(window, &stub) != NULL; - xfree(stub.msg); + api_clear_error(&stub); return ret; } diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 56dc35c31d..1e174712a3 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -6524,7 +6524,7 @@ static void api_wrapper(typval_T *argvars, typval_T *rettv, FunPtr fptr) end: api_free_array(args); api_free_object(result); - xfree(err.msg); + api_clear_error(&err); } /* @@ -13795,7 +13795,7 @@ static void f_rpcrequest(typval_T *argvars, typval_T *rettv, FunPtr fptr) end: api_free_object(result); - xfree(err.msg); + api_clear_error(&err); } // "rpcstart()" function (DEPRECATED) @@ -16528,13 +16528,14 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr) Error err = ERROR_INIT; dict_set_var(curbuf->b_vars, cstr_as_string("terminal_job_id"), INTEGER_OBJ(rettv->vval.v_number), false, false, &err); + api_clear_error(&err); dict_set_var(curbuf->b_vars, cstr_as_string("terminal_job_pid"), INTEGER_OBJ(pid), false, false, &err); + api_clear_error(&err); Terminal *term = terminal_open(topts); data->term = term; data->refcount++; - xfree(err.msg); return; } diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index 06cdf7d1f1..bd7f84fed9 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -411,38 +411,38 @@ static void handle_request(Channel *channel, msgpack_object *request) channel->id); call_set_error(channel, buf); } - } else { - // Retrieve the request handler - MsgpackRpcRequestHandler handler; - msgpack_object *method = msgpack_rpc_method(request); + api_clear_error(&error); + return; + } + // Retrieve the request handler + MsgpackRpcRequestHandler handler; + msgpack_object *method = msgpack_rpc_method(request); - if (method) { - handler = msgpack_rpc_get_handler_for(method->via.bin.ptr, - method->via.bin.size); - } else { - handler.fn = msgpack_rpc_handle_missing_method; - handler.async = true; - } + if (method) { + handler = msgpack_rpc_get_handler_for(method->via.bin.ptr, + method->via.bin.size); + } else { + handler.fn = msgpack_rpc_handle_missing_method; + handler.async = true; + } - Array args = ARRAY_DICT_INIT; - if (!msgpack_rpc_to_array(msgpack_rpc_args(request), &args)) { - handler.fn = msgpack_rpc_handle_invalid_arguments; - handler.async = true; - } + Array args = ARRAY_DICT_INIT; + if (!msgpack_rpc_to_array(msgpack_rpc_args(request), &args)) { + handler.fn = msgpack_rpc_handle_invalid_arguments; + handler.async = true; + } - RequestEvent *event_data = xmalloc(sizeof(RequestEvent)); - event_data->channel = channel; - event_data->handler = handler; - event_data->args = args; - event_data->request_id = request_id; - incref(channel); - if (handler.async) { - on_request_event((void **)&event_data); - } else { - multiqueue_put(channel->events, on_request_event, 1, event_data); - } + RequestEvent *event_data = xmalloc(sizeof(RequestEvent)); + event_data->channel = channel; + event_data->handler = handler; + event_data->args = args; + event_data->request_id = request_id; + incref(channel); + if (handler.async) { + on_request_event((void **)&event_data); + } else { + multiqueue_put(channel->events, on_request_event, 1, event_data); } - xfree(error.msg); } static void on_request_event(void **argv) @@ -469,7 +469,7 @@ static void on_request_event(void **argv) api_free_array(args); decref(channel); xfree(e); - xfree(error.msg); + api_clear_error(&error); } static bool channel_write(Channel *channel, WBuffer *buffer) @@ -518,7 +518,7 @@ static void send_error(Channel *channel, uint64_t id, char *err) &e, NIL, &out_buffer)); - xfree(e.msg); + api_clear_error(&e); } static void send_request(Channel *channel, diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 43e4ea87e3..c44fe15be5 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -640,7 +640,7 @@ static void buf_set_term_title(buf_T *buf, char *title) false, false, &err); - xfree(err.msg); + api_clear_error(&err); } static int term_settermprop(VTermProp prop, VTermValue *val, void *data) @@ -1225,11 +1225,10 @@ static bool is_focused(Terminal *term) /* Only called from terminal_open where curbuf->terminal is the */ \ /* context */ \ o = dict_get_value(curbuf->b_vars, cstr_as_string(k), &err); \ - xfree(err.msg); \ + api_clear_error(&err); \ if (o.type == kObjectTypeNil) { \ - Error err2 = ERROR_INIT; \ - o = dict_get_value(&globvardict, cstr_as_string(k), &err2); \ - xfree(err2.msg); \ + o = dict_get_value(&globvardict, cstr_as_string(k), &err); \ + api_clear_error(&err); \ } \ } while (0) diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c index 921f67fb7d..be016668fc 100644 --- a/src/nvim/tui/input.c +++ b/src/nvim/tui/input.c @@ -228,7 +228,7 @@ static int get_key_code_timeout(void) if (nvim_get_option(cstr_as_string("ttimeout"), &err).data.boolean) { ms = nvim_get_option(cstr_as_string("ttimeoutlen"), &err).data.integer; } - xfree(err.msg); + api_clear_error(&err); return (int)ms; } -- cgit From 62c3f436a96e2102ec5c1e3af974c8e57fe4e76c Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 23 Apr 2017 16:43:07 +0200 Subject: api_clear_error: Skip if error was not set. --- src/nvim/api/private/helpers.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index 547ac29bed..3bf584ff2f 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -803,6 +803,9 @@ void api_free_dictionary(Dictionary value) void api_clear_error(Error *value) FUNC_ATTR_NONNULL_ALL { + if (!value->set) { + return; + } xfree(value->msg); value->msg = NULL; } -- cgit From 2ed91f222f1dddda10fbdc9cb80df2be7d4c2da3 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 23 Apr 2017 19:58:13 +0200 Subject: api/internal: Remove `set` field from Error type. --- src/nvim/api/buffer.c | 4 ++-- src/nvim/api/private/defs.h | 6 ++++-- src/nvim/api/private/helpers.c | 11 ++++++----- src/nvim/api/ui.c | 4 ++-- src/nvim/api/vim.c | 6 +++--- src/nvim/eval.c | 4 ++-- src/nvim/msgpack_rpc/channel.c | 2 +- src/nvim/msgpack_rpc/helpers.c | 6 +++--- 8 files changed, 23 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 81d25d7c95..cffc7a2e38 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -65,7 +65,7 @@ String buffer_get_line(Buffer buffer, Integer index, Error *err) index = convert_index(index); Array slice = nvim_buf_get_lines(0, buffer, index, index+1, true, err); - if (!err->set && slice.size) { + if (!ERROR_SET(err) && slice.size) { rv = slice.items[0].data.string; } @@ -203,7 +203,7 @@ ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id, } end: - if (err->set) { + if (ERROR_SET(err)) { for (size_t i = 0; i < rv.size; i++) { xfree(rv.items[i].data.string.data); } diff --git a/src/nvim/api/private/defs.h b/src/nvim/api/private/defs.h index a07422bd12..60bf38265f 100644 --- a/src/nvim/api/private/defs.h +++ b/src/nvim/api/private/defs.h @@ -8,9 +8,11 @@ #define ARRAY_DICT_INIT {.size = 0, .capacity = 0, .items = NULL} #define STRING_INIT {.data = NULL, .size = 0} #define OBJECT_INIT { .type = kObjectTypeNil } -#define ERROR_INIT { .set = false, .msg = NULL } +#define ERROR_INIT { .type = kErrorTypeNone, .msg = NULL } #define REMOTE_TYPE(type) typedef handle_T type +#define ERROR_SET(e) ((e)->type != kErrorTypeNone) + #ifdef INCLUDE_GENERATED_DECLARATIONS # define ArrayOf(...) Array # define DictionaryOf(...) Dictionary @@ -20,6 +22,7 @@ typedef int handle_T; // Basic types typedef enum { + kErrorTypeNone = -1, kErrorTypeException, kErrorTypeValidation } ErrorType; @@ -39,7 +42,6 @@ typedef enum { typedef struct { ErrorType type; char *msg; - bool set; } Error; typedef bool Boolean; diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index 3bf584ff2f..58534d78a0 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -69,7 +69,7 @@ bool try_end(Error *err) ET_ERROR, NULL, &should_free); - _api_set_error(err, err->type, "%s", msg); + _api_set_error(err, kErrorTypeException, "%s", msg); free_global_msglist(); if (should_free) { @@ -80,7 +80,7 @@ bool try_end(Error *err) discard_current_exception(); } - return err->set; + return ERROR_SET(err); } /// Recursively expands a vimscript value in a dict @@ -803,11 +803,12 @@ void api_free_dictionary(Dictionary value) void api_clear_error(Error *value) FUNC_ATTR_NONNULL_ALL { - if (!value->set) { + if (!ERROR_SET(value)) { return; } xfree(value->msg); value->msg = NULL; + value->type = kErrorTypeNone; } Dictionary api_metadata(void) @@ -953,7 +954,7 @@ static void set_option_value_for(char *key, break; } - if (err->set) { + if (ERROR_SET(err)) { return; } @@ -981,6 +982,7 @@ static void set_option_value_err(char *key, void _api_set_error(Error *err, ErrorType errType, const char *format, ...) FUNC_ATTR_NONNULL_ALL { + assert(kErrorTypeNone != errType); va_list args1; va_list args2; va_start(args1, format); @@ -994,6 +996,5 @@ void _api_set_error(Error *err, ErrorType errType, const char *format, ...) vsnprintf(err->msg, bufsize, format, args2); va_end(args2); - err->set = true; err->type = errType; } diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 534274db0f..4c39bc57eb 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -97,7 +97,7 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, for (size_t i = 0; i < options.size; i++) { ui_set_option(ui, options.items[i].key, options.items[i].value, err); - if (err->set) { + if (ERROR_SET(err)) { xfree(ui); return; } @@ -165,7 +165,7 @@ void nvim_ui_set_option(uint64_t channel_id, String name, UI *ui = pmap_get(uint64_t)(connected_uis, channel_id); ui_set_option(ui, name, value, error); - if (!error->set) { + if (!ERROR_SET(error)) { ui_refresh(); } } diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 2c78ffdec1..924ea419a1 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -165,7 +165,7 @@ String nvim_command_output(String str, Error *err) nvim_command(str, err); do_cmdline_cmd("redir END"); - if (err->set) { + if (ERROR_SET(err)) { return (String) STRING_INIT; } @@ -776,7 +776,7 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err) MsgpackRpcRequestHandler handler = msgpack_rpc_get_handler_for(name.data, name.size); Object result = handler.fn(channel_id, args, &nested_error); - if (nested_error.set) { + if (ERROR_SET(&nested_error)) { // error handled after loop break; } @@ -785,7 +785,7 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err) } ADD(rv, ARRAY_OBJ(results)); - if (nested_error.set) { + if (ERROR_SET(&nested_error)) { Array errval = ARRAY_DICT_INIT; ADD(errval, INTEGER_OBJ((Integer)i)); ADD(errval, INTEGER_OBJ(nested_error.type)); diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 1e174712a3..d7feed8bfd 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -6512,7 +6512,7 @@ static void api_wrapper(typval_T *argvars, typval_T *rettv, FunPtr fptr) Error err = ERROR_INIT; Object result = fn(INTERNAL_CALL, args, &err); - if (err.set) { + if (ERROR_SET(&err)) { nvim_err_writeln(cstr_as_string(err.msg)); goto end; } @@ -13784,7 +13784,7 @@ static void f_rpcrequest(typval_T *argvars, typval_T *rettv, FunPtr fptr) restore_funccal(save_funccalp); } - if (err.set) { + if (ERROR_SET(&err)) { nvim_err_writeln(cstr_as_string(err.msg)); goto end; } diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index bd7f84fed9..36a3210c70 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -397,7 +397,7 @@ static void handle_request(Channel *channel, msgpack_object *request) Error error = ERROR_INIT; msgpack_rpc_validate(&request_id, request, &error); - if (error.set) { + if (ERROR_SET(&error)) { // Validation failed, send response with error if (channel_write(channel, serialize_response(channel->id, diff --git a/src/nvim/msgpack_rpc/helpers.c b/src/nvim/msgpack_rpc/helpers.c index c273343b41..800f5edb85 100644 --- a/src/nvim/msgpack_rpc/helpers.c +++ b/src/nvim/msgpack_rpc/helpers.c @@ -475,7 +475,7 @@ Object msgpack_rpc_handle_missing_method(uint64_t channel_id, Array args, Error *error) { - _api_set_error(error, error->type, "Invalid method name"); + _api_set_error(error, kErrorTypeException, "Invalid method name"); return NIL; } @@ -484,7 +484,7 @@ Object msgpack_rpc_handle_invalid_arguments(uint64_t channel_id, Array args, Error *error) { - _api_set_error(error, error->type, "Invalid method arguments"); + _api_set_error(error, kErrorTypeException, "Invalid method arguments"); return NIL; } @@ -517,7 +517,7 @@ void msgpack_rpc_serialize_response(uint64_t response_id, msgpack_pack_int(pac, 1); msgpack_pack_uint64(pac, response_id); - if (err->set) { + if (ERROR_SET(err)) { // error represented by a [type, message] array msgpack_pack_array(pac, 2); msgpack_rpc_from_integer(err->type, pac); -- cgit From 3fbc660d57f4726044662bde1bf52c527e45fb98 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 23 Apr 2017 21:54:44 +0200 Subject: api_set_error(): rename --- src/nvim/api/buffer.c | 36 ++++++++++++------------ src/nvim/api/private/helpers.c | 62 +++++++++++++++++++++--------------------- src/nvim/api/ui.c | 18 ++++++------ src/nvim/api/vim.c | 26 +++++++++--------- src/nvim/api/window.c | 10 +++---- src/nvim/msgpack_rpc/channel.c | 12 ++++---- src/nvim/msgpack_rpc/helpers.c | 20 +++++++------- 7 files changed, 92 insertions(+), 92 deletions(-) (limited to 'src') diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index cffc7a2e38..4d6081bb5e 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -171,7 +171,7 @@ ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id, end = normalize_index(buf, end, &oob); if (strict_indexing && oob) { - _api_set_error(err, kErrorTypeValidation, _("Index out of bounds")); + api_set_error(err, kErrorTypeValidation, _("Index out of bounds")); return rv; } @@ -187,7 +187,7 @@ ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id, int64_t lnum = start + (int64_t)i; if (lnum > LONG_MAX) { - _api_set_error(err, kErrorTypeValidation, _("Line index is too high")); + api_set_error(err, kErrorTypeValidation, _("Line index is too high")); goto end; } @@ -283,13 +283,13 @@ void nvim_buf_set_lines(uint64_t channel_id, end = normalize_index(buf, end, &oob); if (strict_indexing && oob) { - _api_set_error(err, kErrorTypeValidation, _("Index out of bounds")); + api_set_error(err, kErrorTypeValidation, _("Index out of bounds")); return; } if (start > end) { - _api_set_error(err, + api_set_error(err, kErrorTypeValidation, _("Argument \"start\" is higher than \"end\"")); return; @@ -304,7 +304,7 @@ void nvim_buf_set_lines(uint64_t channel_id, for (size_t i = 0; i < new_len; i++) { if (replacement.items[i].type != kObjectTypeString) { - _api_set_error(err, + api_set_error(err, kErrorTypeValidation, _("All items in the replacement array must be strings")); goto end; @@ -317,7 +317,7 @@ void nvim_buf_set_lines(uint64_t channel_id, lines[i] = xmallocz(l.size); for (size_t j = 0; j < l.size; j++) { if (l.data[j] == '\n' && channel_id != INTERNAL_CALL) { - _api_set_error(err, kErrorTypeException, _("string cannot contain newlines")); + api_set_error(err, kErrorTypeException, _("string cannot contain newlines")); new_len = i + 1; goto end; } @@ -330,7 +330,7 @@ void nvim_buf_set_lines(uint64_t channel_id, switch_to_win_for_buf(buf, &save_curwin, &save_curtab, &save_curbuf); if (u_save((linenr_T)(start - 1), (linenr_T)end) == FAIL) { - _api_set_error(err, kErrorTypeException, _("Failed to save undo information")); + api_set_error(err, kErrorTypeException, _("Failed to save undo information")); goto end; } @@ -340,7 +340,7 @@ void nvim_buf_set_lines(uint64_t channel_id, size_t to_delete = (new_len < old_len) ? (size_t)(old_len - new_len) : 0; for (size_t i = 0; i < to_delete; i++) { if (ml_delete((linenr_T)start, false) == FAIL) { - _api_set_error(err, kErrorTypeException, _("Failed to delete line")); + api_set_error(err, kErrorTypeException, _("Failed to delete line")); goto end; } } @@ -357,12 +357,12 @@ void nvim_buf_set_lines(uint64_t channel_id, int64_t lnum = start + (int64_t)i; if (lnum > LONG_MAX) { - _api_set_error(err, kErrorTypeValidation, _("Index value is too high")); + api_set_error(err, kErrorTypeValidation, _("Index value is too high")); goto end; } if (ml_replace((linenr_T)lnum, (char_u *)lines[i], false) == FAIL) { - _api_set_error(err, kErrorTypeException, _("Failed to replace line")); + api_set_error(err, kErrorTypeException, _("Failed to replace line")); goto end; } // Mark lines that haven't been passed to the buffer as they need @@ -375,12 +375,12 @@ void nvim_buf_set_lines(uint64_t channel_id, int64_t lnum = start + (int64_t)i - 1; if (lnum > LONG_MAX) { - _api_set_error(err, kErrorTypeValidation, _("Index value is too high")); + api_set_error(err, kErrorTypeValidation, _("Index value is too high")); goto end; } if (ml_append((linenr_T)lnum, (char_u *)lines[i], 0, false) == FAIL) { - _api_set_error(err, kErrorTypeException, _("Failed to insert line")); + api_set_error(err, kErrorTypeException, _("Failed to insert line")); goto end; } @@ -627,7 +627,7 @@ void nvim_buf_set_name(Buffer buffer, String name, Error *err) } if (ren_ret == FAIL) { - _api_set_error(err, kErrorTypeException, _("Failed to rename buffer")); + api_set_error(err, kErrorTypeException, _("Failed to rename buffer")); } } @@ -680,7 +680,7 @@ ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err) } if (name.size != 1) { - _api_set_error(err, kErrorTypeValidation, _("Mark name must be a single character")); + api_set_error(err, kErrorTypeValidation, _("Mark name must be a single character")); return rv; } @@ -698,7 +698,7 @@ ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err) } if (posp == NULL) { - _api_set_error(err, kErrorTypeValidation, _("Invalid mark name")); + api_set_error(err, kErrorTypeValidation, _("Invalid mark name")); return rv; } @@ -753,11 +753,11 @@ Integer nvim_buf_add_highlight(Buffer buffer, } if (line < 0 || line >= MAXLNUM) { - _api_set_error(err, kErrorTypeValidation, _("Line number outside range")); + api_set_error(err, kErrorTypeValidation, _("Line number outside range")); return 0; } if (col_start < 0 || col_start > MAXCOL) { - _api_set_error(err, kErrorTypeValidation, _("Column value outside range")); + api_set_error(err, kErrorTypeValidation, _("Column value outside range")); return 0; } if (col_end < 0 || col_end > MAXCOL) { @@ -794,7 +794,7 @@ void nvim_buf_clear_highlight(Buffer buffer, } if (line_start < 0 || line_start >= MAXLNUM) { - _api_set_error(err, kErrorTypeValidation, _("Line number outside range")); + api_set_error(err, kErrorTypeValidation, _("Line number outside range")); return; } if (line_end < 0 || line_end > MAXLNUM) { diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index 58534d78a0..d7274920b6 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -61,7 +61,7 @@ bool try_end(Error *err) discard_current_exception(); } - _api_set_error(err, kErrorTypeException, _("Keyboard interrupt")); + api_set_error(err, kErrorTypeException, _("Keyboard interrupt")); got_int = false; } else if (msg_list != NULL && *msg_list != NULL) { int should_free; @@ -69,14 +69,14 @@ bool try_end(Error *err) ET_ERROR, NULL, &should_free); - _api_set_error(err, kErrorTypeException, "%s", msg); + api_set_error(err, kErrorTypeException, "%s", msg); free_global_msglist(); if (should_free) { xfree(msg); } } else if (did_throw) { - _api_set_error(err, kErrorTypeException, "%s", current_exception->value); + api_set_error(err, kErrorTypeException, "%s", current_exception->value); discard_current_exception(); } @@ -93,7 +93,7 @@ Object dict_get_value(dict_T *dict, String key, Error *err) dictitem_T *const di = tv_dict_find(dict, key.data, (ptrdiff_t)key.size); if (di == NULL) { - _api_set_error(err, kErrorTypeValidation, _("Key not found")); + api_set_error(err, kErrorTypeValidation, _("Key not found")); return (Object) OBJECT_INIT; } @@ -117,17 +117,17 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del, Object rv = OBJECT_INIT; if (dict->dv_lock) { - _api_set_error(err, kErrorTypeException, _("Dictionary is locked")); + api_set_error(err, kErrorTypeException, _("Dictionary is locked")); return rv; } if (key.size == 0) { - _api_set_error(err, kErrorTypeValidation, _("Empty variable names aren't allowed")); + api_set_error(err, kErrorTypeValidation, _("Empty variable names aren't allowed")); return rv; } if (key.size > INT_MAX) { - _api_set_error(err, kErrorTypeValidation, _("Key length is too high")); + api_set_error(err, kErrorTypeValidation, _("Key length is too high")); return rv; } @@ -135,13 +135,13 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del, if (di != NULL) { if (di->di_flags & DI_FLAGS_RO) { - _api_set_error(err, kErrorTypeException, _("Key is read-only: %s"), key.data); + api_set_error(err, kErrorTypeException, _("Key is read-only: %s"), key.data); return rv; } else if (di->di_flags & DI_FLAGS_FIX) { - _api_set_error(err, kErrorTypeException, _("Key is fixed: %s"), key.data); + api_set_error(err, kErrorTypeException, _("Key is fixed: %s"), key.data); return rv; } else if (di->di_flags & DI_FLAGS_LOCK) { - _api_set_error(err, kErrorTypeException, _("Key is locked: %s"), key.data); + api_set_error(err, kErrorTypeException, _("Key is locked: %s"), key.data); return rv; } } @@ -150,7 +150,7 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del, // Delete the key if (di == NULL) { // Doesn't exist, fail - _api_set_error(err, kErrorTypeValidation, _("Key \"%s\" doesn't exist"), key.data); + api_set_error(err, kErrorTypeValidation, _("Key \"%s\" doesn't exist"), key.data); } else { // Return the old value if (retval) { @@ -202,7 +202,7 @@ Object get_option_from(void *from, int type, String name, Error *err) Object rv = OBJECT_INIT; if (name.size == 0) { - _api_set_error(err, kErrorTypeValidation, _("Empty option name")); + api_set_error(err, kErrorTypeValidation, _("Empty option name")); return rv; } @@ -213,7 +213,7 @@ Object get_option_from(void *from, int type, String name, Error *err) type, from); if (!flags) { - _api_set_error(err, + api_set_error(err, kErrorTypeValidation, _("Invalid option name \"%s\""), name.data); @@ -232,13 +232,13 @@ Object get_option_from(void *from, int type, String name, Error *err) rv.data.string.data = stringval; rv.data.string.size = strlen(stringval); } else { - _api_set_error(err, + api_set_error(err, kErrorTypeException, _("Unable to get value for option \"%s\""), name.data); } } else { - _api_set_error(err, + api_set_error(err, kErrorTypeException, _("Unknown type for option \"%s\""), name.data); @@ -257,14 +257,14 @@ Object get_option_from(void *from, int type, String name, Error *err) void set_option_to(void *to, int type, String name, Object value, Error *err) { if (name.size == 0) { - _api_set_error(err, kErrorTypeValidation, _("Empty option name")); + api_set_error(err, kErrorTypeValidation, _("Empty option name")); return; } int flags = get_option_value_strict(name.data, NULL, NULL, type, to); if (flags == 0) { - _api_set_error(err, + api_set_error(err, kErrorTypeValidation, _("Invalid option name \"%s\""), name.data); @@ -273,13 +273,13 @@ void set_option_to(void *to, int type, String name, Object value, Error *err) if (value.type == kObjectTypeNil) { if (type == SREQ_GLOBAL) { - _api_set_error(err, + api_set_error(err, kErrorTypeException, _("Unable to unset option \"%s\""), name.data); return; } else if (!(flags & SOPT_GLOBAL)) { - _api_set_error(err, + api_set_error(err, kErrorTypeException, _("Cannot unset option \"%s\" " "because it doesn't have a global value"), @@ -295,7 +295,7 @@ void set_option_to(void *to, int type, String name, Object value, Error *err) if (flags & SOPT_BOOL) { if (value.type != kObjectTypeBoolean) { - _api_set_error(err, + api_set_error(err, kErrorTypeValidation, _("Option \"%s\" requires a boolean value"), name.data); @@ -306,7 +306,7 @@ void set_option_to(void *to, int type, String name, Object value, Error *err) set_option_value_for(name.data, val, NULL, opt_flags, type, to, err); } else if (flags & SOPT_NUM) { if (value.type != kObjectTypeInteger) { - _api_set_error(err, + api_set_error(err, kErrorTypeValidation, _("Option \"%s\" requires an integer value"), name.data); @@ -314,7 +314,7 @@ void set_option_to(void *to, int type, String name, Object value, Error *err) } if (value.data.integer > INT_MAX || value.data.integer < INT_MIN) { - _api_set_error(err, + api_set_error(err, kErrorTypeValidation, _("Value for option \"%s\" is outside range"), name.data); @@ -325,7 +325,7 @@ void set_option_to(void *to, int type, String name, Object value, Error *err) set_option_value_for(name.data, val, NULL, opt_flags, type, to, err); } else { if (value.type != kObjectTypeString) { - _api_set_error(err, + api_set_error(err, kErrorTypeValidation, _("Option \"%s\" requires a string value"), name.data); @@ -560,7 +560,7 @@ buf_T *find_buffer_by_handle(Buffer buffer, Error *err) buf_T *rv = handle_get_buffer(buffer); if (!rv) { - _api_set_error(err, kErrorTypeValidation, _("Invalid buffer id")); + api_set_error(err, kErrorTypeValidation, _("Invalid buffer id")); } return rv; @@ -575,7 +575,7 @@ win_T *find_window_by_handle(Window window, Error *err) win_T *rv = handle_get_window(window); if (!rv) { - _api_set_error(err, kErrorTypeValidation, _("Invalid window id")); + api_set_error(err, kErrorTypeValidation, _("Invalid window id")); } return rv; @@ -590,7 +590,7 @@ tabpage_T *find_tab_by_handle(Tabpage tabpage, Error *err) tabpage_T *rv = handle_get_tabpage(tabpage); if (!rv) { - _api_set_error(err, kErrorTypeValidation, _("Invalid tabpage id")); + api_set_error(err, kErrorTypeValidation, _("Invalid tabpage id")); } return rv; @@ -658,7 +658,7 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err) case kObjectTypeInteger: if (obj.data.integer > VARNUMBER_MAX || obj.data.integer < VARNUMBER_MIN) { - _api_set_error(err, kErrorTypeValidation, _("Integer value outside range")); + api_set_error(err, kErrorTypeValidation, _("Integer value outside range")); return false; } @@ -712,7 +712,7 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err) String key = item.key; if (key.size == 0) { - _api_set_error(err, kErrorTypeValidation, + api_set_error(err, kErrorTypeValidation, _("Empty dictionary keys aren't allowed")); // cleanup tv_dict_free(dict); @@ -936,7 +936,7 @@ static void set_option_value_for(char *key, if (try_end(err)) { return; } - _api_set_error(err, + api_set_error(err, kErrorTypeException, _("Problem while switching windows")); return; @@ -975,11 +975,11 @@ static void set_option_value_err(char *key, return; } - _api_set_error(err, kErrorTypeException, "%s", errmsg); + api_set_error(err, kErrorTypeException, "%s", errmsg); } } -void _api_set_error(Error *err, ErrorType errType, const char *format, ...) +void api_set_error(Error *err, ErrorType errType, const char *format, ...) FUNC_ATTR_NONNULL_ALL { assert(kErrorTypeNone != errType); diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 4c39bc57eb..26c0a8119b 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -55,12 +55,12 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (pmap_has(uint64_t)(connected_uis, channel_id)) { - _api_set_error(err, kErrorTypeException, _("UI already attached for channel")); + api_set_error(err, kErrorTypeException, _("UI already attached for channel")); return; } if (width <= 0 || height <= 0) { - _api_set_error(err, kErrorTypeValidation, + api_set_error(err, kErrorTypeValidation, _("Expected width > 0 and height > 0")); return; } @@ -126,7 +126,7 @@ void nvim_ui_detach(uint64_t channel_id, Error *err) FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (!pmap_has(uint64_t)(connected_uis, channel_id)) { - _api_set_error(err, kErrorTypeException, _("UI is not attached for channel")); + api_set_error(err, kErrorTypeException, _("UI is not attached for channel")); return; } remote_ui_disconnect(channel_id); @@ -138,12 +138,12 @@ void nvim_ui_try_resize(uint64_t channel_id, Integer width, FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (!pmap_has(uint64_t)(connected_uis, channel_id)) { - _api_set_error(err, kErrorTypeException, _("UI is not attached for channel")); + api_set_error(err, kErrorTypeException, _("UI is not attached for channel")); return; } if (width <= 0 || height <= 0) { - _api_set_error(err, kErrorTypeValidation, + api_set_error(err, kErrorTypeValidation, _("Expected width > 0 and height > 0")); return; } @@ -159,7 +159,7 @@ void nvim_ui_set_option(uint64_t channel_id, String name, FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (!pmap_has(uint64_t)(connected_uis, channel_id)) { - _api_set_error(error, kErrorTypeException, _("UI is not attached for channel")); + api_set_error(error, kErrorTypeException, _("UI is not attached for channel")); return; } UI *ui = pmap_get(uint64_t)(connected_uis, channel_id); @@ -173,19 +173,19 @@ void nvim_ui_set_option(uint64_t channel_id, String name, static void ui_set_option(UI *ui, String name, Object value, Error *error) { if (strcmp(name.data, "rgb") == 0) { if (value.type != kObjectTypeBoolean) { - _api_set_error(error, kErrorTypeValidation, _("rgb must be a Boolean")); + api_set_error(error, kErrorTypeValidation, _("rgb must be a Boolean")); return; } ui->rgb = value.data.boolean; } else if (strcmp(name.data, "popupmenu_external") == 0) { if (value.type != kObjectTypeBoolean) { - _api_set_error(error, kErrorTypeValidation, + api_set_error(error, kErrorTypeValidation, _("popupmenu_external must be a Boolean")); return; } ui->pum_external = value.data.boolean; } else { - _api_set_error(error, kErrorTypeValidation, _("No such ui option")); + api_set_error(error, kErrorTypeValidation, _("No such ui option")); } } diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 924ea419a1..16c630b0e6 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -188,7 +188,7 @@ Object nvim_eval(String expr, Error *err) typval_T rettv; if (eval0((char_u *)expr.data, &rettv, NULL, true) == FAIL) { - _api_set_error(err, kErrorTypeException, "Failed to evaluate expression"); + api_set_error(err, kErrorTypeException, "Failed to evaluate expression"); } if (!try_end(err)) { @@ -214,7 +214,7 @@ Object nvim_call_function(String fname, Array args, Error *err) { Object rv = OBJECT_INIT; if (args.size > MAX_FUNC_ARGS) { - _api_set_error(err, kErrorTypeValidation, + api_set_error(err, kErrorTypeValidation, _("Function called with too many arguments.")); return rv; } @@ -237,7 +237,7 @@ Object nvim_call_function(String fname, Array args, Error *err) curwin->w_cursor.lnum, curwin->w_cursor.lnum, &dummy, true, NULL, NULL); if (r == FAIL) { - _api_set_error(err, kErrorTypeException, _("Error calling function.")); + api_set_error(err, kErrorTypeException, _("Error calling function.")); } if (!try_end(err)) { rv = vim_to_object(&rettv); @@ -262,7 +262,7 @@ Integer nvim_strwidth(String str, Error *err) FUNC_API_SINCE(1) { if (str.size > INT_MAX) { - _api_set_error(err, kErrorTypeValidation, _("String length is too high")); + api_set_error(err, kErrorTypeValidation, _("String length is too high")); return 0; } @@ -318,7 +318,7 @@ void nvim_set_current_dir(String dir, Error *err) FUNC_API_SINCE(1) { if (dir.size >= MAXPATHL) { - _api_set_error(err, kErrorTypeValidation, _("Directory string is too long")); + api_set_error(err, kErrorTypeValidation, _("Directory string is too long")); return; } @@ -330,7 +330,7 @@ void nvim_set_current_dir(String dir, Error *err) if (vim_chdir((char_u *)string, kCdScopeGlobal)) { if (!try_end(err)) { - _api_set_error(err, kErrorTypeException, _("Failed to change directory")); + api_set_error(err, kErrorTypeException, _("Failed to change directory")); } return; } @@ -538,7 +538,7 @@ void nvim_set_current_buf(Buffer buffer, Error *err) try_start(); int result = do_buffer(DOBUF_GOTO, DOBUF_FIRST, FORWARD, buf->b_fnum, 0); if (!try_end(err) && result == FAIL) { - _api_set_error(err, + api_set_error(err, kErrorTypeException, _("Failed to switch to buffer %d"), buffer); @@ -591,7 +591,7 @@ void nvim_set_current_win(Window window, Error *err) try_start(); goto_tabpage_win(win_find_tabpage(win), win); if (!try_end(err) && win != curwin) { - _api_set_error(err, + api_set_error(err, kErrorTypeException, _("Failed to switch to window %d"), window); @@ -645,7 +645,7 @@ void nvim_set_current_tabpage(Tabpage tabpage, Error *err) try_start(); goto_tabpage_tp(tp, true, true); if (!try_end(err) && tp != curtab) { - _api_set_error(err, + api_set_error(err, kErrorTypeException, _("Failed to switch to tabpage %d"), tabpage); @@ -744,21 +744,21 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err) size_t i; // also used for freeing the variables for (i = 0; i < calls.size; i++) { if (calls.items[i].type != kObjectTypeArray) { - _api_set_error(err, + api_set_error(err, kErrorTypeValidation, _("All items in calls array must be arrays")); goto validation_error; } Array call = calls.items[i].data.array; if (call.size != 2) { - _api_set_error(err, + api_set_error(err, kErrorTypeValidation, _("All items in calls array must be arrays of size 2")); goto validation_error; } if (call.items[0].type != kObjectTypeString) { - _api_set_error(err, + api_set_error(err, kErrorTypeValidation, _("name must be String")); goto validation_error; @@ -766,7 +766,7 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err) String name = call.items[0].data.string; if (call.items[1].type != kObjectTypeArray) { - _api_set_error(err, + api_set_error(err, kErrorTypeValidation, _("args must be Array")); goto validation_error; diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c index b8326c1198..dd52b2d690 100644 --- a/src/nvim/api/window.c +++ b/src/nvim/api/window.c @@ -64,7 +64,7 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err) if (pos.size != 2 || pos.items[0].type != kObjectTypeInteger || pos.items[1].type != kObjectTypeInteger) { - _api_set_error(err, + api_set_error(err, kErrorTypeValidation, _("Argument \"pos\" must be a [row, col] array")); return; @@ -78,12 +78,12 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err) int64_t col = pos.items[1].data.integer; if (row <= 0 || row > win->w_buffer->b_ml.ml_line_count) { - _api_set_error(err, kErrorTypeValidation, _("Cursor position outside buffer")); + api_set_error(err, kErrorTypeValidation, _("Cursor position outside buffer")); return; } if (col > MAXCOL || col < 0) { - _api_set_error(err, kErrorTypeValidation, _("Column value outside range")); + api_set_error(err, kErrorTypeValidation, _("Column value outside range")); return; } @@ -132,7 +132,7 @@ void nvim_win_set_height(Window window, Integer height, Error *err) } if (height > INT_MAX || height < INT_MIN) { - _api_set_error(err, kErrorTypeValidation, _("Height value outside range")); + api_set_error(err, kErrorTypeValidation, _("Height value outside range")); return; } @@ -177,7 +177,7 @@ void nvim_win_set_width(Window window, Integer width, Error *err) } if (width > INT_MAX || width < INT_MIN) { - _api_set_error(err, kErrorTypeValidation, _("Width value outside range")); + api_set_error(err, kErrorTypeValidation, _("Width value outside range")); return; } diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index 36a3210c70..3cf85316d9 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -192,7 +192,7 @@ Object channel_send_call(uint64_t id, Channel *channel = NULL; if (!(channel = pmap_get(uint64_t)(channels, id)) || channel->closed) { - _api_set_error(err, kErrorTypeException, _("Invalid channel \"%" PRIu64 "\""), id); + api_set_error(err, kErrorTypeException, _("Invalid channel \"%" PRIu64 "\""), id); api_free_array(args); return NIL; } @@ -212,7 +212,7 @@ Object channel_send_call(uint64_t id, if (frame.errored) { if (frame.result.type == kObjectTypeString) { - _api_set_error(err, kErrorTypeException, "%s", frame.result.data.string.data); + api_set_error(err, kErrorTypeException, "%s", frame.result.data.string.data); } else if (frame.result.type == kObjectTypeArray) { // Should be an error in the form [type, message] Array array = frame.result.data.array; @@ -220,13 +220,13 @@ Object channel_send_call(uint64_t id, && (array.items[0].data.integer == kErrorTypeException || array.items[0].data.integer == kErrorTypeValidation) && array.items[1].type == kObjectTypeString) { - _api_set_error(err, (ErrorType)array.items[0].data.integer, "%s", + api_set_error(err, (ErrorType)array.items[0].data.integer, "%s", array.items[1].data.string.data); } else { - _api_set_error(err, kErrorTypeException, "%s", "unknown error"); + api_set_error(err, kErrorTypeException, "%s", "unknown error"); } } else { - _api_set_error(err, kErrorTypeException, "%s", "unknown error"); + api_set_error(err, kErrorTypeException, "%s", "unknown error"); } api_free_object(frame.result); @@ -512,7 +512,7 @@ static bool channel_write(Channel *channel, WBuffer *buffer) static void send_error(Channel *channel, uint64_t id, char *err) { Error e = ERROR_INIT; - _api_set_error(&e, kErrorTypeException, "%s", err); + api_set_error(&e, kErrorTypeException, "%s", err); channel_write(channel, serialize_response(channel->id, id, &e, diff --git a/src/nvim/msgpack_rpc/helpers.c b/src/nvim/msgpack_rpc/helpers.c index 800f5edb85..0ad1d9ae4b 100644 --- a/src/nvim/msgpack_rpc/helpers.c +++ b/src/nvim/msgpack_rpc/helpers.c @@ -475,7 +475,7 @@ Object msgpack_rpc_handle_missing_method(uint64_t channel_id, Array args, Error *error) { - _api_set_error(error, kErrorTypeException, "Invalid method name"); + api_set_error(error, kErrorTypeException, "Invalid method name"); return NIL; } @@ -484,7 +484,7 @@ Object msgpack_rpc_handle_invalid_arguments(uint64_t channel_id, Array args, Error *error) { - _api_set_error(error, kErrorTypeException, "Invalid method arguments"); + api_set_error(error, kErrorTypeException, "Invalid method arguments"); return NIL; } @@ -570,29 +570,29 @@ void msgpack_rpc_validate(uint64_t *response_id, *response_id = NO_RESPONSE; // Validate the basic structure of the msgpack-rpc payload if (req->type != MSGPACK_OBJECT_ARRAY) { - _api_set_error(err, kErrorTypeValidation, _("Message is not an array")); + api_set_error(err, kErrorTypeValidation, _("Message is not an array")); return; } if (req->via.array.size == 0) { - _api_set_error(err, kErrorTypeValidation, _("Message is empty")); + api_set_error(err, kErrorTypeValidation, _("Message is empty")); return; } if (req->via.array.ptr[0].type != MSGPACK_OBJECT_POSITIVE_INTEGER) { - _api_set_error(err, kErrorTypeValidation, _("Message type must be an integer")); + api_set_error(err, kErrorTypeValidation, _("Message type must be an integer")); return; } uint64_t type = req->via.array.ptr[0].via.u64; if (type != kMessageTypeRequest && type != kMessageTypeNotification) { - _api_set_error(err, kErrorTypeValidation, _("Unknown message type")); + api_set_error(err, kErrorTypeValidation, _("Unknown message type")); return; } if ((type == kMessageTypeRequest && req->via.array.size != 4) || (type == kMessageTypeNotification && req->via.array.size != 3)) { - _api_set_error(err, kErrorTypeValidation, _("Request array size should be 4 (request) " + api_set_error(err, kErrorTypeValidation, _("Request array size should be 4 (request) " "or 3 (notification)")); return; } @@ -600,19 +600,19 @@ void msgpack_rpc_validate(uint64_t *response_id, if (type == kMessageTypeRequest) { msgpack_object *id_obj = msgpack_rpc_msg_id(req); if (!id_obj) { - _api_set_error(err, kErrorTypeValidation, _("ID must be a positive integer")); + api_set_error(err, kErrorTypeValidation, _("ID must be a positive integer")); return; } *response_id = id_obj->via.u64; } if (!msgpack_rpc_method(req)) { - _api_set_error(err, kErrorTypeValidation, _("Method must be a string")); + api_set_error(err, kErrorTypeValidation, _("Method must be a string")); return; } if (!msgpack_rpc_args(req)) { - _api_set_error(err, kErrorTypeValidation, _("Parameters must be an array")); + api_set_error(err, kErrorTypeValidation, _("Parameters must be an array")); return; } } -- cgit From e2936ed39768c07e810cd3c3e6255cf48fba494f Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 23 Apr 2017 22:06:02 +0200 Subject: tui/input.c: Use default 'ttimeoutlen' if option get fails. Should never happen, but better to be explicit. Helped-by: oni-link --- src/nvim/tui/input.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c index be016668fc..b86ab8cf2f 100644 --- a/src/nvim/tui/input.c +++ b/src/nvim/tui/input.c @@ -223,10 +223,12 @@ static int get_key_code_timeout(void) { Integer ms = -1; // Check 'ttimeout' to determine if we should send ESC after 'ttimeoutlen'. - // See :help 'ttimeout' for more information Error err = ERROR_INIT; if (nvim_get_option(cstr_as_string("ttimeout"), &err).data.boolean) { - ms = nvim_get_option(cstr_as_string("ttimeoutlen"), &err).data.integer; + Object rv = nvim_get_option(cstr_as_string("ttimeoutlen"), &err); + if (!ERROR_SET(&err)) { + ms = rv.data.integer; + } } api_clear_error(&err); return (int)ms; -- cgit From 086c354a0aad2769042dc91bf5bad021109f56e4 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 23 Apr 2017 22:30:08 +0200 Subject: api: Do not translate error messages. Also re-word some error messages: - "Key does not exist: %s" - "Invalid channel: %" - "Request array size must be 4 (request) or 3 (notification)" - "String cannot contain newlines" References #6150 --- src/nvim/api/buffer.c | 38 +++++++++++++------------- src/nvim/api/private/helpers.c | 60 ++++++++++++++++++++++-------------------- src/nvim/api/ui.c | 18 ++++++------- src/nvim/api/vim.c | 26 +++++++++--------- src/nvim/api/window.c | 10 +++---- src/nvim/msgpack_rpc/channel.c | 7 ++--- src/nvim/msgpack_rpc/helpers.c | 18 ++++++------- src/nvim/po/fi.po | 6 ++--- src/nvim/po/uk.po | 6 ++--- 9 files changed, 97 insertions(+), 92 deletions(-) (limited to 'src') diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 4d6081bb5e..ae5728ee21 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -171,7 +171,7 @@ ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id, end = normalize_index(buf, end, &oob); if (strict_indexing && oob) { - api_set_error(err, kErrorTypeValidation, _("Index out of bounds")); + api_set_error(err, kErrorTypeValidation, "Index out of bounds"); return rv; } @@ -187,7 +187,7 @@ ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id, int64_t lnum = start + (int64_t)i; if (lnum > LONG_MAX) { - api_set_error(err, kErrorTypeValidation, _("Line index is too high")); + api_set_error(err, kErrorTypeValidation, "Line index is too high"); goto end; } @@ -283,7 +283,7 @@ void nvim_buf_set_lines(uint64_t channel_id, end = normalize_index(buf, end, &oob); if (strict_indexing && oob) { - api_set_error(err, kErrorTypeValidation, _("Index out of bounds")); + api_set_error(err, kErrorTypeValidation, "Index out of bounds"); return; } @@ -291,7 +291,7 @@ void nvim_buf_set_lines(uint64_t channel_id, if (start > end) { api_set_error(err, kErrorTypeValidation, - _("Argument \"start\" is higher than \"end\"")); + "Argument \"start\" is higher than \"end\""); return; } @@ -306,7 +306,7 @@ void nvim_buf_set_lines(uint64_t channel_id, if (replacement.items[i].type != kObjectTypeString) { api_set_error(err, kErrorTypeValidation, - _("All items in the replacement array must be strings")); + "All items in the replacement array must be strings"); goto end; } @@ -317,7 +317,8 @@ void nvim_buf_set_lines(uint64_t channel_id, lines[i] = xmallocz(l.size); for (size_t j = 0; j < l.size; j++) { if (l.data[j] == '\n' && channel_id != INTERNAL_CALL) { - api_set_error(err, kErrorTypeException, _("string cannot contain newlines")); + api_set_error(err, kErrorTypeException, + "String cannot contain newlines"); new_len = i + 1; goto end; } @@ -330,7 +331,7 @@ void nvim_buf_set_lines(uint64_t channel_id, switch_to_win_for_buf(buf, &save_curwin, &save_curtab, &save_curbuf); if (u_save((linenr_T)(start - 1), (linenr_T)end) == FAIL) { - api_set_error(err, kErrorTypeException, _("Failed to save undo information")); + api_set_error(err, kErrorTypeException, "Failed to save undo information"); goto end; } @@ -340,7 +341,7 @@ void nvim_buf_set_lines(uint64_t channel_id, size_t to_delete = (new_len < old_len) ? (size_t)(old_len - new_len) : 0; for (size_t i = 0; i < to_delete; i++) { if (ml_delete((linenr_T)start, false) == FAIL) { - api_set_error(err, kErrorTypeException, _("Failed to delete line")); + api_set_error(err, kErrorTypeException, "Failed to delete line"); goto end; } } @@ -357,12 +358,12 @@ void nvim_buf_set_lines(uint64_t channel_id, int64_t lnum = start + (int64_t)i; if (lnum > LONG_MAX) { - api_set_error(err, kErrorTypeValidation, _("Index value is too high")); + api_set_error(err, kErrorTypeValidation, "Index value is too high"); goto end; } if (ml_replace((linenr_T)lnum, (char_u *)lines[i], false) == FAIL) { - api_set_error(err, kErrorTypeException, _("Failed to replace line")); + api_set_error(err, kErrorTypeException, "Failed to replace line"); goto end; } // Mark lines that haven't been passed to the buffer as they need @@ -375,12 +376,12 @@ void nvim_buf_set_lines(uint64_t channel_id, int64_t lnum = start + (int64_t)i - 1; if (lnum > LONG_MAX) { - api_set_error(err, kErrorTypeValidation, _("Index value is too high")); + api_set_error(err, kErrorTypeValidation, "Index value is too high"); goto end; } if (ml_append((linenr_T)lnum, (char_u *)lines[i], 0, false) == FAIL) { - api_set_error(err, kErrorTypeException, _("Failed to insert line")); + api_set_error(err, kErrorTypeException, "Failed to insert line"); goto end; } @@ -627,7 +628,7 @@ void nvim_buf_set_name(Buffer buffer, String name, Error *err) } if (ren_ret == FAIL) { - api_set_error(err, kErrorTypeException, _("Failed to rename buffer")); + api_set_error(err, kErrorTypeException, "Failed to rename buffer"); } } @@ -680,7 +681,8 @@ ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err) } if (name.size != 1) { - api_set_error(err, kErrorTypeValidation, _("Mark name must be a single character")); + api_set_error(err, kErrorTypeValidation, + "Mark name must be a single character"); return rv; } @@ -698,7 +700,7 @@ ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err) } if (posp == NULL) { - api_set_error(err, kErrorTypeValidation, _("Invalid mark name")); + api_set_error(err, kErrorTypeValidation, "Invalid mark name"); return rv; } @@ -753,11 +755,11 @@ Integer nvim_buf_add_highlight(Buffer buffer, } if (line < 0 || line >= MAXLNUM) { - api_set_error(err, kErrorTypeValidation, _("Line number outside range")); + api_set_error(err, kErrorTypeValidation, "Line number outside range"); return 0; } if (col_start < 0 || col_start > MAXCOL) { - api_set_error(err, kErrorTypeValidation, _("Column value outside range")); + api_set_error(err, kErrorTypeValidation, "Column value outside range"); return 0; } if (col_end < 0 || col_end > MAXCOL) { @@ -794,7 +796,7 @@ void nvim_buf_clear_highlight(Buffer buffer, } if (line_start < 0 || line_start >= MAXLNUM) { - api_set_error(err, kErrorTypeValidation, _("Line number outside range")); + api_set_error(err, kErrorTypeValidation, "Line number outside range"); return; } if (line_end < 0 || line_end > MAXLNUM) { diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index d7274920b6..69cb19c14f 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -61,7 +61,7 @@ bool try_end(Error *err) discard_current_exception(); } - api_set_error(err, kErrorTypeException, _("Keyboard interrupt")); + api_set_error(err, kErrorTypeException, "Keyboard interrupt"); got_int = false; } else if (msg_list != NULL && *msg_list != NULL) { int should_free; @@ -93,8 +93,8 @@ Object dict_get_value(dict_T *dict, String key, Error *err) dictitem_T *const di = tv_dict_find(dict, key.data, (ptrdiff_t)key.size); if (di == NULL) { - api_set_error(err, kErrorTypeValidation, _("Key not found")); - return (Object) OBJECT_INIT; + api_set_error(err, kErrorTypeValidation, "Key not found"); + return (Object)OBJECT_INIT; } return vim_to_object(&di->di_tv); @@ -117,17 +117,18 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del, Object rv = OBJECT_INIT; if (dict->dv_lock) { - api_set_error(err, kErrorTypeException, _("Dictionary is locked")); + api_set_error(err, kErrorTypeException, "Dictionary is locked"); return rv; } if (key.size == 0) { - api_set_error(err, kErrorTypeValidation, _("Empty variable names aren't allowed")); + api_set_error(err, kErrorTypeValidation, + "Empty variable names aren't allowed"); return rv; } if (key.size > INT_MAX) { - api_set_error(err, kErrorTypeValidation, _("Key length is too high")); + api_set_error(err, kErrorTypeValidation, "Key length is too high"); return rv; } @@ -135,13 +136,13 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del, if (di != NULL) { if (di->di_flags & DI_FLAGS_RO) { - api_set_error(err, kErrorTypeException, _("Key is read-only: %s"), key.data); + api_set_error(err, kErrorTypeException, "Key is read-only: %s", key.data); return rv; } else if (di->di_flags & DI_FLAGS_FIX) { - api_set_error(err, kErrorTypeException, _("Key is fixed: %s"), key.data); + api_set_error(err, kErrorTypeException, "Key is fixed: %s", key.data); return rv; } else if (di->di_flags & DI_FLAGS_LOCK) { - api_set_error(err, kErrorTypeException, _("Key is locked: %s"), key.data); + api_set_error(err, kErrorTypeException, "Key is locked: %s", key.data); return rv; } } @@ -150,7 +151,8 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del, // Delete the key if (di == NULL) { // Doesn't exist, fail - api_set_error(err, kErrorTypeValidation, _("Key \"%s\" doesn't exist"), key.data); + api_set_error(err, kErrorTypeValidation, "Key does not exist: %s", + key.data); } else { // Return the old value if (retval) { @@ -202,7 +204,7 @@ Object get_option_from(void *from, int type, String name, Error *err) Object rv = OBJECT_INIT; if (name.size == 0) { - api_set_error(err, kErrorTypeValidation, _("Empty option name")); + api_set_error(err, kErrorTypeValidation, "Empty option name"); return rv; } @@ -215,7 +217,7 @@ Object get_option_from(void *from, int type, String name, Error *err) if (!flags) { api_set_error(err, kErrorTypeValidation, - _("Invalid option name \"%s\""), + "Invalid option name \"%s\"", name.data); return rv; } @@ -234,13 +236,13 @@ Object get_option_from(void *from, int type, String name, Error *err) } else { api_set_error(err, kErrorTypeException, - _("Unable to get value for option \"%s\""), + "Unable to get value for option \"%s\"", name.data); } } else { api_set_error(err, kErrorTypeException, - _("Unknown type for option \"%s\""), + "Unknown type for option \"%s\"", name.data); } @@ -257,7 +259,7 @@ Object get_option_from(void *from, int type, String name, Error *err) void set_option_to(void *to, int type, String name, Object value, Error *err) { if (name.size == 0) { - api_set_error(err, kErrorTypeValidation, _("Empty option name")); + api_set_error(err, kErrorTypeValidation, "Empty option name"); return; } @@ -266,7 +268,7 @@ void set_option_to(void *to, int type, String name, Object value, Error *err) if (flags == 0) { api_set_error(err, kErrorTypeValidation, - _("Invalid option name \"%s\""), + "Invalid option name \"%s\"", name.data); return; } @@ -275,14 +277,14 @@ void set_option_to(void *to, int type, String name, Object value, Error *err) if (type == SREQ_GLOBAL) { api_set_error(err, kErrorTypeException, - _("Unable to unset option \"%s\""), + "Unable to unset option \"%s\"", name.data); return; } else if (!(flags & SOPT_GLOBAL)) { api_set_error(err, kErrorTypeException, - _("Cannot unset option \"%s\" " - "because it doesn't have a global value"), + "Cannot unset option \"%s\" " + "because it doesn't have a global value", name.data); return; } else { @@ -297,7 +299,7 @@ void set_option_to(void *to, int type, String name, Object value, Error *err) if (value.type != kObjectTypeBoolean) { api_set_error(err, kErrorTypeValidation, - _("Option \"%s\" requires a boolean value"), + "Option \"%s\" requires a boolean value", name.data); return; } @@ -308,7 +310,7 @@ void set_option_to(void *to, int type, String name, Object value, Error *err) if (value.type != kObjectTypeInteger) { api_set_error(err, kErrorTypeValidation, - _("Option \"%s\" requires an integer value"), + "Option \"%s\" requires an integer value", name.data); return; } @@ -316,7 +318,7 @@ void set_option_to(void *to, int type, String name, Object value, Error *err) if (value.data.integer > INT_MAX || value.data.integer < INT_MIN) { api_set_error(err, kErrorTypeValidation, - _("Value for option \"%s\" is outside range"), + "Value for option \"%s\" is outside range", name.data); return; } @@ -327,7 +329,7 @@ void set_option_to(void *to, int type, String name, Object value, Error *err) if (value.type != kObjectTypeString) { api_set_error(err, kErrorTypeValidation, - _("Option \"%s\" requires a string value"), + "Option \"%s\" requires a string value", name.data); return; } @@ -560,7 +562,7 @@ buf_T *find_buffer_by_handle(Buffer buffer, Error *err) buf_T *rv = handle_get_buffer(buffer); if (!rv) { - api_set_error(err, kErrorTypeValidation, _("Invalid buffer id")); + api_set_error(err, kErrorTypeValidation, "Invalid buffer id"); } return rv; @@ -575,7 +577,7 @@ win_T *find_window_by_handle(Window window, Error *err) win_T *rv = handle_get_window(window); if (!rv) { - api_set_error(err, kErrorTypeValidation, _("Invalid window id")); + api_set_error(err, kErrorTypeValidation, "Invalid window id"); } return rv; @@ -590,7 +592,7 @@ tabpage_T *find_tab_by_handle(Tabpage tabpage, Error *err) tabpage_T *rv = handle_get_tabpage(tabpage); if (!rv) { - api_set_error(err, kErrorTypeValidation, _("Invalid tabpage id")); + api_set_error(err, kErrorTypeValidation, "Invalid tabpage id"); } return rv; @@ -658,7 +660,7 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err) case kObjectTypeInteger: if (obj.data.integer > VARNUMBER_MAX || obj.data.integer < VARNUMBER_MIN) { - api_set_error(err, kErrorTypeValidation, _("Integer value outside range")); + api_set_error(err, kErrorTypeValidation, "Integer value outside range"); return false; } @@ -713,7 +715,7 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err) if (key.size == 0) { api_set_error(err, kErrorTypeValidation, - _("Empty dictionary keys aren't allowed")); + "Empty dictionary keys aren't allowed"); // cleanup tv_dict_free(dict); return false; @@ -938,7 +940,7 @@ static void set_option_value_for(char *key, } api_set_error(err, kErrorTypeException, - _("Problem while switching windows")); + "Problem while switching windows"); return; } set_option_value_err(key, numval, stringval, opt_flags, err); diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c index 26c0a8119b..f0da0d1812 100644 --- a/src/nvim/api/ui.c +++ b/src/nvim/api/ui.c @@ -55,13 +55,13 @@ void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height, FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (pmap_has(uint64_t)(connected_uis, channel_id)) { - api_set_error(err, kErrorTypeException, _("UI already attached for channel")); + api_set_error(err, kErrorTypeException, "UI already attached for channel"); return; } if (width <= 0 || height <= 0) { api_set_error(err, kErrorTypeValidation, - _("Expected width > 0 and height > 0")); + "Expected width > 0 and height > 0"); return; } UI *ui = xcalloc(1, sizeof(UI)); @@ -126,7 +126,7 @@ void nvim_ui_detach(uint64_t channel_id, Error *err) FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (!pmap_has(uint64_t)(connected_uis, channel_id)) { - api_set_error(err, kErrorTypeException, _("UI is not attached for channel")); + api_set_error(err, kErrorTypeException, "UI is not attached for channel"); return; } remote_ui_disconnect(channel_id); @@ -138,13 +138,13 @@ void nvim_ui_try_resize(uint64_t channel_id, Integer width, FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (!pmap_has(uint64_t)(connected_uis, channel_id)) { - api_set_error(err, kErrorTypeException, _("UI is not attached for channel")); + api_set_error(err, kErrorTypeException, "UI is not attached for channel"); return; } if (width <= 0 || height <= 0) { api_set_error(err, kErrorTypeValidation, - _("Expected width > 0 and height > 0")); + "Expected width > 0 and height > 0"); return; } @@ -159,7 +159,7 @@ void nvim_ui_set_option(uint64_t channel_id, String name, FUNC_API_SINCE(1) FUNC_API_NOEVAL { if (!pmap_has(uint64_t)(connected_uis, channel_id)) { - api_set_error(error, kErrorTypeException, _("UI is not attached for channel")); + api_set_error(error, kErrorTypeException, "UI is not attached for channel"); return; } UI *ui = pmap_get(uint64_t)(connected_uis, channel_id); @@ -173,19 +173,19 @@ void nvim_ui_set_option(uint64_t channel_id, String name, static void ui_set_option(UI *ui, String name, Object value, Error *error) { if (strcmp(name.data, "rgb") == 0) { if (value.type != kObjectTypeBoolean) { - api_set_error(error, kErrorTypeValidation, _("rgb must be a Boolean")); + api_set_error(error, kErrorTypeValidation, "rgb must be a Boolean"); return; } ui->rgb = value.data.boolean; } else if (strcmp(name.data, "popupmenu_external") == 0) { if (value.type != kObjectTypeBoolean) { api_set_error(error, kErrorTypeValidation, - _("popupmenu_external must be a Boolean")); + "popupmenu_external must be a Boolean"); return; } ui->pum_external = value.data.boolean; } else { - api_set_error(error, kErrorTypeValidation, _("No such ui option")); + api_set_error(error, kErrorTypeValidation, "No such ui option"); } } diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 16c630b0e6..da00fbc6e3 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -166,7 +166,7 @@ String nvim_command_output(String str, Error *err) do_cmdline_cmd("redir END"); if (ERROR_SET(err)) { - return (String) STRING_INIT; + return (String)STRING_INIT; } return cstr_to_string((char *)get_vim_var_str(VV_COMMAND_OUTPUT)); @@ -215,7 +215,7 @@ Object nvim_call_function(String fname, Array args, Error *err) Object rv = OBJECT_INIT; if (args.size > MAX_FUNC_ARGS) { api_set_error(err, kErrorTypeValidation, - _("Function called with too many arguments.")); + "Function called with too many arguments."); return rv; } @@ -237,7 +237,7 @@ Object nvim_call_function(String fname, Array args, Error *err) curwin->w_cursor.lnum, curwin->w_cursor.lnum, &dummy, true, NULL, NULL); if (r == FAIL) { - api_set_error(err, kErrorTypeException, _("Error calling function.")); + api_set_error(err, kErrorTypeException, "Error calling function."); } if (!try_end(err)) { rv = vim_to_object(&rettv); @@ -262,7 +262,7 @@ Integer nvim_strwidth(String str, Error *err) FUNC_API_SINCE(1) { if (str.size > INT_MAX) { - api_set_error(err, kErrorTypeValidation, _("String length is too high")); + api_set_error(err, kErrorTypeValidation, "String length is too high"); return 0; } @@ -318,7 +318,7 @@ void nvim_set_current_dir(String dir, Error *err) FUNC_API_SINCE(1) { if (dir.size >= MAXPATHL) { - api_set_error(err, kErrorTypeValidation, _("Directory string is too long")); + api_set_error(err, kErrorTypeValidation, "Directory string is too long"); return; } @@ -330,7 +330,7 @@ void nvim_set_current_dir(String dir, Error *err) if (vim_chdir((char_u *)string, kCdScopeGlobal)) { if (!try_end(err)) { - api_set_error(err, kErrorTypeException, _("Failed to change directory")); + api_set_error(err, kErrorTypeException, "Failed to change directory"); } return; } @@ -540,7 +540,7 @@ void nvim_set_current_buf(Buffer buffer, Error *err) if (!try_end(err) && result == FAIL) { api_set_error(err, kErrorTypeException, - _("Failed to switch to buffer %d"), + "Failed to switch to buffer %d", buffer); } } @@ -593,7 +593,7 @@ void nvim_set_current_win(Window window, Error *err) if (!try_end(err) && win != curwin) { api_set_error(err, kErrorTypeException, - _("Failed to switch to window %d"), + "Failed to switch to window %d", window); } } @@ -647,7 +647,7 @@ void nvim_set_current_tabpage(Tabpage tabpage, Error *err) if (!try_end(err) && tp != curtab) { api_set_error(err, kErrorTypeException, - _("Failed to switch to tabpage %d"), + "Failed to switch to tabpage %d", tabpage); } } @@ -746,21 +746,21 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err) if (calls.items[i].type != kObjectTypeArray) { api_set_error(err, kErrorTypeValidation, - _("All items in calls array must be arrays")); + "All items in calls array must be arrays"); goto validation_error; } Array call = calls.items[i].data.array; if (call.size != 2) { api_set_error(err, kErrorTypeValidation, - _("All items in calls array must be arrays of size 2")); + "All items in calls array must be arrays of size 2"); goto validation_error; } if (call.items[0].type != kObjectTypeString) { api_set_error(err, kErrorTypeValidation, - _("name must be String")); + "Name must be String"); goto validation_error; } String name = call.items[0].data.string; @@ -768,7 +768,7 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err) if (call.items[1].type != kObjectTypeArray) { api_set_error(err, kErrorTypeValidation, - _("args must be Array")); + "Args must be Array"); goto validation_error; } Array args = call.items[1].data.array; diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c index dd52b2d690..859bf88398 100644 --- a/src/nvim/api/window.c +++ b/src/nvim/api/window.c @@ -66,7 +66,7 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err) || pos.items[1].type != kObjectTypeInteger) { api_set_error(err, kErrorTypeValidation, - _("Argument \"pos\" must be a [row, col] array")); + "Argument \"pos\" must be a [row, col] array"); return; } @@ -78,12 +78,12 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err) int64_t col = pos.items[1].data.integer; if (row <= 0 || row > win->w_buffer->b_ml.ml_line_count) { - api_set_error(err, kErrorTypeValidation, _("Cursor position outside buffer")); + api_set_error(err, kErrorTypeValidation, "Cursor position outside buffer"); return; } if (col > MAXCOL || col < 0) { - api_set_error(err, kErrorTypeValidation, _("Column value outside range")); + api_set_error(err, kErrorTypeValidation, "Column value outside range"); return; } @@ -132,7 +132,7 @@ void nvim_win_set_height(Window window, Integer height, Error *err) } if (height > INT_MAX || height < INT_MIN) { - api_set_error(err, kErrorTypeValidation, _("Height value outside range")); + api_set_error(err, kErrorTypeValidation, "Height value outside range"); return; } @@ -177,7 +177,7 @@ void nvim_win_set_width(Window window, Integer width, Error *err) } if (width > INT_MAX || width < INT_MIN) { - api_set_error(err, kErrorTypeValidation, _("Width value outside range")); + api_set_error(err, kErrorTypeValidation, "Width value outside range"); return; } diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index 3cf85316d9..59594357de 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -192,7 +192,7 @@ Object channel_send_call(uint64_t id, Channel *channel = NULL; if (!(channel = pmap_get(uint64_t)(channels, id)) || channel->closed) { - api_set_error(err, kErrorTypeException, _("Invalid channel \"%" PRIu64 "\""), id); + api_set_error(err, kErrorTypeException, "Invalid channel: %" PRIu64, id); api_free_array(args); return NIL; } @@ -212,7 +212,8 @@ Object channel_send_call(uint64_t id, if (frame.errored) { if (frame.result.type == kObjectTypeString) { - api_set_error(err, kErrorTypeException, "%s", frame.result.data.string.data); + api_set_error(err, kErrorTypeException, "%s", + frame.result.data.string.data); } else if (frame.result.type == kObjectTypeArray) { // Should be an error in the form [type, message] Array array = frame.result.data.array; @@ -221,7 +222,7 @@ Object channel_send_call(uint64_t id, || array.items[0].data.integer == kErrorTypeValidation) && array.items[1].type == kObjectTypeString) { api_set_error(err, (ErrorType)array.items[0].data.integer, "%s", - array.items[1].data.string.data); + array.items[1].data.string.data); } else { api_set_error(err, kErrorTypeException, "%s", "unknown error"); } diff --git a/src/nvim/msgpack_rpc/helpers.c b/src/nvim/msgpack_rpc/helpers.c index 0ad1d9ae4b..0228582d37 100644 --- a/src/nvim/msgpack_rpc/helpers.c +++ b/src/nvim/msgpack_rpc/helpers.c @@ -570,49 +570,49 @@ void msgpack_rpc_validate(uint64_t *response_id, *response_id = NO_RESPONSE; // Validate the basic structure of the msgpack-rpc payload if (req->type != MSGPACK_OBJECT_ARRAY) { - api_set_error(err, kErrorTypeValidation, _("Message is not an array")); + api_set_error(err, kErrorTypeValidation, "Message is not an array"); return; } if (req->via.array.size == 0) { - api_set_error(err, kErrorTypeValidation, _("Message is empty")); + api_set_error(err, kErrorTypeValidation, "Message is empty"); return; } if (req->via.array.ptr[0].type != MSGPACK_OBJECT_POSITIVE_INTEGER) { - api_set_error(err, kErrorTypeValidation, _("Message type must be an integer")); + api_set_error(err, kErrorTypeValidation, "Message type must be an integer"); return; } uint64_t type = req->via.array.ptr[0].via.u64; if (type != kMessageTypeRequest && type != kMessageTypeNotification) { - api_set_error(err, kErrorTypeValidation, _("Unknown message type")); + api_set_error(err, kErrorTypeValidation, "Unknown message type"); return; } if ((type == kMessageTypeRequest && req->via.array.size != 4) || (type == kMessageTypeNotification && req->via.array.size != 3)) { - api_set_error(err, kErrorTypeValidation, _("Request array size should be 4 (request) " - "or 3 (notification)")); + api_set_error(err, kErrorTypeValidation, + "Request array size must be 4 (request) or 3 (notification)"); return; } if (type == kMessageTypeRequest) { msgpack_object *id_obj = msgpack_rpc_msg_id(req); if (!id_obj) { - api_set_error(err, kErrorTypeValidation, _("ID must be a positive integer")); + api_set_error(err, kErrorTypeValidation, "ID must be a positive integer"); return; } *response_id = id_obj->via.u64; } if (!msgpack_rpc_method(req)) { - api_set_error(err, kErrorTypeValidation, _("Method must be a string")); + api_set_error(err, kErrorTypeValidation, "Method must be a string"); return; } if (!msgpack_rpc_args(req)) { - api_set_error(err, kErrorTypeValidation, _("Parameters must be an array")); + api_set_error(err, kErrorTypeValidation, "Parameters must be an array"); return; } } diff --git a/src/nvim/po/fi.po b/src/nvim/po/fi.po index d817144151..3551c07ff2 100644 --- a/src/nvim/po/fi.po +++ b/src/nvim/po/fi.po @@ -116,7 +116,7 @@ msgstr "merkkijono ei saa sisältää rivinvaihtoja" #. Doesn't exist, fail #, fuzzy, c-format -#~ msgid "Key \"%s\" doesn't exist" +#~ msgid "Key does not exist: %s" #~ msgstr "Tiedostoa %s ei ole" #, fuzzy @@ -3986,7 +3986,7 @@ msgid "Calling shell to execute: \"%s\"" msgstr "Kutsutaan kuorta suorittamaan: %s" #, c-format -#~ msgid "Invalid channel \"%\"" +#~ msgid "Invalid channel: %" #~ msgstr "" #~ msgid "Message is not an array" @@ -4003,7 +4003,7 @@ msgstr "Kutsutaan kuorta suorittamaan: %s" #~ msgid "Unknown message type" #~ msgstr "E574: Tuntematon rekisterityyppi %d" -#~ msgid "Request array size should be 4 (request) or 3 (notification)" +#~ msgid "Request array size must be 4 (request) or 3 (notification)" #~ msgstr "" #~ msgid "ID must be a positive integer" diff --git a/src/nvim/po/uk.po b/src/nvim/po/uk.po index cff140508b..2c203f808f 100644 --- a/src/nvim/po/uk.po +++ b/src/nvim/po/uk.po @@ -82,7 +82,7 @@ msgid "Key length is too high" msgstr "Довжина ключа завелика" #, c-format -msgid "Key \"%s\" doesn't exist" +msgid "Key does not exist: %s" msgstr "Ключ «%s» не існує" msgid "Empty option name" @@ -3719,7 +3719,7 @@ msgid "Calling shell to execute: \"%s\"" msgstr "Викликається оболонка щоб виконати: «%s»" #, c-format -msgid "Invalid channel \"%\"" +msgid "Invalid channel: %" msgstr "Некоректний канал «%»" msgid "Message is not an array" @@ -3734,7 +3734,7 @@ msgstr "Повідомлення має бути цілим числом" msgid "Unknown message type" msgstr "Невідомий тип повідомлення" -msgid "Request array size should be 4 (request) or 3 (notification)" +msgid "Request array size must be 4 (request) or 3 (notification)" msgstr "Розмір масиву запиту має бути 4 (запит) чи 3 (повідомлення)" msgid "ID must be a positive integer" -- cgit