Mercurial > vim
comparison src/textprop.c @ 30811:c02b74b87608 v9.0.0740
patch 9.0.0740: prop_add_list() gives multiple errors for invalid argument
Commit: https://github.com/vim/vim/commit/4997f2a605e15261c4f825494324371f271ef6a8
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Oct 13 14:00:45 2022 +0100
patch 9.0.0740: prop_add_list() gives multiple errors for invalid argument
Problem: prop_add_list() gives multiple errors for invalid argument.
Solution: Only give one error message.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 13 Oct 2022 15:15:07 +0200 |
parents | 43d942ff32ce |
children | f4956427ee9e |
comparison
equal
deleted
inserted
replaced
30810:d44a91de374e | 30811:c02b74b87608 |
---|---|
351 linenr_T start_lnum; | 351 linenr_T start_lnum; |
352 colnr_T start_col; | 352 colnr_T start_col; |
353 linenr_T end_lnum; | 353 linenr_T end_lnum; |
354 colnr_T end_col; | 354 colnr_T end_col; |
355 int error = FALSE; | 355 int error = FALSE; |
356 int prev_did_emsg = did_emsg; | |
356 | 357 |
357 if (check_for_dict_arg(argvars, 0) == FAIL | 358 if (check_for_dict_arg(argvars, 0) == FAIL |
358 || check_for_list_arg(argvars, 1) == FAIL) | 359 || check_for_list_arg(argvars, 1) == FAIL) |
359 return; | 360 return; |
360 | 361 |
387 return; | 388 return; |
388 } | 389 } |
389 | 390 |
390 pos_list = li->li_tv.vval.v_list; | 391 pos_list = li->li_tv.vval.v_list; |
391 start_lnum = list_find_nr(pos_list, 0L, &error); | 392 start_lnum = list_find_nr(pos_list, 0L, &error); |
392 start_col = list_find_nr(pos_list, 1L, &error); | 393 if (!error) |
393 end_lnum = list_find_nr(pos_list, 2L, &error); | 394 start_col = list_find_nr(pos_list, 1L, &error); |
394 end_col = list_find_nr(pos_list, 3L, &error); | 395 if (!error) |
396 end_lnum = list_find_nr(pos_list, 2L, &error); | |
397 if (!error) | |
398 end_col = list_find_nr(pos_list, 3L, &error); | |
395 if (error || start_lnum <= 0 || start_col <= 0 | 399 if (error || start_lnum <= 0 || start_col <= 0 |
396 || end_lnum <= 0 || end_col <= 0) | 400 || end_lnum <= 0 || end_col <= 0) |
397 { | 401 { |
398 emsg(_(e_invalid_argument)); | 402 if (prev_did_emsg == did_emsg) |
403 emsg(_(e_invalid_argument)); | |
399 return; | 404 return; |
400 } | 405 } |
401 if (prop_add_one(buf, type_name, id, NULL, 0, 0, start_lnum, end_lnum, | 406 if (prop_add_one(buf, type_name, id, NULL, 0, 0, start_lnum, end_lnum, |
402 start_col, end_col) == FAIL) | 407 start_col, end_col) == FAIL) |
403 return; | 408 return; |