diff options
| author | Maxime Coste <mawww@kakoune.org> | 2019-04-17 08:31:06 +0200 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2019-04-17 08:38:52 +0200 |
| commit | 02fc42a12a4025352b2da0f99728d5902a9c8448 (patch) | |
| tree | 0cc9026a6e163e525800301827085fe288c34a26 /src | |
| parent | ace499ecb1027ad24db32a76e53066e26d2c1cf6 (diff) | |
Rename info -placement to info -style and support modal style
Fixes #1375
Closes #1380
Diffstat (limited to 'src')
| -rw-r--r-- | src/commands.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/commands.cc b/src/commands.cc index 82b9175f..559fe90b 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -2075,9 +2075,9 @@ const CommandDesc info_cmd = { nullptr, "info [<switches>] <text>: display an info box containing <text>", ParameterDesc{ - { { "anchor", { true, "set info anchoring <line>.<column>" } }, - { "placement", { true, "set placement style (above, below, menu)" } }, - { "title", { true, "set info title" } } }, + { { "anchor", { true, "set info anchoring <line>.<column>" } }, + { "style", { true, "set info style (above, below, menu, modal)" } }, + { "title", { true, "set info title" } } }, ParameterDesc::Flags::None, 0, 1 }, CommandFlags::None, @@ -2088,18 +2088,19 @@ const CommandDesc info_cmd = { if (not context.has_client()) return; - context.client().info_hide(); + const InfoStyle style = parser.get_switch("style").map( + [](StringView style) -> Optional<InfoStyle> { + if (style == "above") return InfoStyle::InlineAbove; + if (style == "below") return InfoStyle::InlineBelow; + if (style == "menu") return InfoStyle::MenuDoc; + if (style == "modal") return InfoStyle::Modal; + throw runtime_error(format("invalid style: '{}'", style)); + }).value_or(parser.get_switch("anchor") ? InfoStyle::Inline : InfoStyle::Prompt); + + context.client().info_hide(style == InfoStyle::Modal); if (parser.positional_count() == 0) return; - const InfoStyle style = parser.get_switch("placement").map( - [](StringView placement) -> Optional<InfoStyle> { - if (placement == "above") return InfoStyle::InlineAbove; - if (placement == "below") return InfoStyle::InlineBelow; - if (placement == "menu") return InfoStyle::MenuDoc; - throw runtime_error(format("invalid placement: '{}'", placement)); - }).value_or(parser.get_switch("anchor") ? InfoStyle::Inline : InfoStyle::Prompt); - const BufferCoord pos = parser.get_switch("anchor").map( [](StringView anchor) { auto dot = find(anchor, '.'); |
