fix(options): use a union for def_val (#27169)

Problem:
APIs get wrong boolean option default values on big-endian platforms.

Solution:
Use a union for def_val.
Cannot use OptVal or OptValData yet as it needs to have the same types
as option variables.
This commit is contained in:
zeertzjq
2024-01-24 12:27:38 +08:00
committed by GitHub
parent 65bfa86efe
commit c8a27bae3f
4 changed files with 55 additions and 59 deletions

View File

@@ -61,7 +61,7 @@ end
--- @return fun(): string
local function macros(s)
return function()
return s
return '.string=' .. s
end
end
@@ -69,7 +69,7 @@ end
--- @return fun(): string
local function imacros(s)
return function()
return '(intptr_t)' .. s
return '.number=' .. s
end
end
@@ -1271,7 +1271,7 @@ return {
abbreviation = 'co',
cb = 'did_set_lines_or_columns',
defaults = {
if_true = macros('DFLT_COLS'),
if_true = imacros('DFLT_COLS'),
doc = '80 or terminal width',
},
desc = [=[
@@ -4024,7 +4024,7 @@ return {
{
abbreviation = 'imi',
cb = 'did_set_iminsert',
defaults = { if_true = macros('B_IMODE_NONE') },
defaults = { if_true = imacros('B_IMODE_NONE') },
desc = [=[
Specifies whether :lmap or an Input Method (IM) is to be used in
Insert mode. Valid values:
@@ -4050,7 +4050,7 @@ return {
},
{
abbreviation = 'ims',
defaults = { if_true = macros('B_IMODE_USE_INSERT') },
defaults = { if_true = imacros('B_IMODE_USE_INSERT') },
desc = [=[
Specifies whether :lmap or an Input Method (IM) is to be used when
entering a search pattern. Valid values:
@@ -4747,7 +4747,7 @@ return {
{
cb = 'did_set_lines_or_columns',
defaults = {
if_true = macros('DFLT_ROWS'),
if_true = imacros('DFLT_ROWS'),
doc = '24 or terminal height',
},
desc = [=[