This commit is contained in:
Justin M. Keyes 2017-11-27 09:33:12 +01:00
parent c8b40930c0
commit 6cf186edb5
2 changed files with 13 additions and 14 deletions

View File

@ -4619,10 +4619,10 @@ static int findoption(const char *const arg)
/// Hidden Number or Toggle option: -1. /// Hidden Number or Toggle option: -1.
/// hidden String option: -2. /// hidden String option: -2.
/// unknown option: -3. /// unknown option: -3.
int get_option_value ( int get_option_value(
char_u *name, char_u *name,
long *numval, long *numval,
char_u **stringval, /* NULL when only checking existence */ char_u **stringval, ///< NULL when only checking existence
int opt_flags int opt_flags
) )
{ {
@ -4630,32 +4630,31 @@ int get_option_value (
return 0; return 0;
} }
int opt_idx; int opt_idx = findoption((const char *)name);
char_u *varp;
opt_idx = findoption((const char *)name);
if (opt_idx < 0) { // Unknown option. if (opt_idx < 0) { // Unknown option.
return -3; return -3;
} }
varp = get_varp_scope(&(options[opt_idx]), opt_flags); char_u *varp = get_varp_scope(&(options[opt_idx]), opt_flags);
if (options[opt_idx].flags & P_STRING) { if (options[opt_idx].flags & P_STRING) {
if (varp == NULL) /* hidden option */ if (varp == NULL) { // hidden option
return -2; return -2;
}
if (stringval != NULL) { if (stringval != NULL) {
*stringval = vim_strsave(*(char_u **)(varp)); *stringval = vim_strsave(*(char_u **)(varp));
} }
return 0; return 0;
} }
if (varp == NULL) /* hidden option */ if (varp == NULL) { // hidden option
return -1; return -1;
if (options[opt_idx].flags & P_NUM) }
if (options[opt_idx].flags & P_NUM) {
*numval = *(long *)varp; *numval = *(long *)varp;
else { } else {
/* Special case: 'modified' is b_changed, but we also want to consider // Special case: 'modified' is b_changed, but we also want to consider
* it set when 'ff' or 'fenc' changed. */ // it set when 'ff' or 'fenc' changed.
if ((int *)varp == &curbuf->b_changed) { if ((int *)varp == &curbuf->b_changed) {
*numval = curbufIsChanged(); *numval = curbufIsChanged();
} else { } else {

View File

@ -4,7 +4,7 @@ local os = require('os')
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local command = helpers.command local command = helpers.command
local eval, exc_exec = helpers.eval, helpers.exc_exec local eval, exc_exec = helpers.eval, helpers.exc_exec
local feed_command, request, eq = helpers.feed_command, helpers.request, helpers.eq local feed_command, eq = helpers.feed_command, helpers.eq
local curbufmeths = helpers.curbufmeths local curbufmeths = helpers.curbufmeths
describe('colorscheme compatibility', function() describe('colorscheme compatibility', function()