comparison src/ex_docmd.c @ 13575:4df23d9bad47 v8.0.1660

patch 8.0.1660: the terminal API "drop" command doesn't support options commit https://github.com/vim/vim/commit/333b80acf3a44e462456e6d5730e47ffa449c83d Author: Bram Moolenaar <Bram@vim.org> Date: Wed Apr 4 22:57:29 2018 +0200 patch 8.0.1660: the terminal API "drop" command doesn't support options Problem: The terminal API "drop" command doesn't support options. Solution: Implement the options.
author Christian Brabandt <cb@256bit.org>
date Wed, 04 Apr 2018 23:00:07 +0200
parents 04019fc3de93
children 82390bf72374
comparison
equal deleted inserted replaced
13574:73c69063091f 13575:4df23d9bad47
5306 MB_PTR_ADV(p); 5306 MB_PTR_ADV(p);
5307 } 5307 }
5308 return p; 5308 return p;
5309 } 5309 }
5310 5310
5311 int
5312 get_bad_opt(char_u *p, exarg_T *eap)
5313 {
5314 if (STRICMP(p, "keep") == 0)
5315 eap->bad_char = BAD_KEEP;
5316 else if (STRICMP(p, "drop") == 0)
5317 eap->bad_char = BAD_DROP;
5318 else if (MB_BYTE2LEN(*p) == 1 && p[1] == NUL)
5319 eap->bad_char = *p;
5320 return FAIL;
5321 }
5322
5311 /* 5323 /*
5312 * Get "++opt=arg" argument. 5324 * Get "++opt=arg" argument.
5313 * Return FAIL or OK. 5325 * Return FAIL or OK.
5314 */ 5326 */
5315 static int 5327 static int
5385 if (pp == &eap->force_ff) 5397 if (pp == &eap->force_ff)
5386 { 5398 {
5387 #endif 5399 #endif
5388 if (check_ff_value(eap->cmd + eap->force_ff) == FAIL) 5400 if (check_ff_value(eap->cmd + eap->force_ff) == FAIL)
5389 return FAIL; 5401 return FAIL;
5402 eap->force_ff = eap->cmd[eap->force_ff];
5390 #ifdef FEAT_MBYTE 5403 #ifdef FEAT_MBYTE
5391 } 5404 }
5392 else if (pp == &eap->force_enc) 5405 else if (pp == &eap->force_enc)
5393 { 5406 {
5394 /* Make 'fileencoding' lower case. */ 5407 /* Make 'fileencoding' lower case. */
5397 } 5410 }
5398 else 5411 else
5399 { 5412 {
5400 /* Check ++bad= argument. Must be a single-byte character, "keep" or 5413 /* Check ++bad= argument. Must be a single-byte character, "keep" or
5401 * "drop". */ 5414 * "drop". */
5402 p = eap->cmd + bad_char_idx; 5415 if (get_bad_opt(eap->cmd + bad_char_idx, eap) == FAIL)
5403 if (STRICMP(p, "keep") == 0)
5404 eap->bad_char = BAD_KEEP;
5405 else if (STRICMP(p, "drop") == 0)
5406 eap->bad_char = BAD_DROP;
5407 else if (MB_BYTE2LEN(*p) == 1 && p[1] == NUL)
5408 eap->bad_char = *p;
5409 else
5410 return FAIL; 5416 return FAIL;
5411 } 5417 }
5412 #endif 5418 #endif
5413 5419
5414 return OK; 5420 return OK;