summaryrefslogtreecommitdiff
path: root/src/commands.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-11-10 13:28:06 +0000
committerMaxime Coste <frrrwww@gmail.com>2014-11-10 13:37:17 +0000
commit7d4c9c2ccf75f56e449dc28e91f960be144fdafd (patch)
tree54f7fd57122c9869b76727025086b1d7047315c5 /src/commands.cc
parent075e4985d79c81b23842ade9ccc1ac83ec312af3 (diff)
Support hinting if an inline info should be above or below the anchor
Used by ctags function info, we always want it *above* the opening parenthesis so that it does not hide multi line parameter lists.
Diffstat (limited to 'src/commands.cc')
-rw-r--r--src/commands.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/commands.cc b/src/commands.cc
index 7106df89..6e5a2836 100644
--- a/src/commands.cc
+++ b/src/commands.cc
@@ -1224,6 +1224,7 @@ const CommandDesc info_cmd = {
"info <switches> <params>...: display an info box with the params as content",
ParameterDesc{
SwitchMap{ { "anchor", { true, "set info anchoring <line>.<column>" } },
+ { "placement", { true, "set placement relative to anchor (above, below)" } },
{ "title", { true, "set info title" } } },
ParameterDesc::Flags::None, 0, 1
},
@@ -1247,6 +1248,16 @@ const CommandDesc info_cmd = {
str_to_int(anchor.substr(dotb+1))-1};
pos = context.window().display_position(coord);
style = InfoStyle::Inline;
+ if (parser.has_option("placement"))
+ {
+ auto placement = parser.option_value("placement");
+ if (placement == "above")
+ style = InfoStyle::InlineAbove;
+ else if (placement == "below")
+ style = InfoStyle::InlineBelow;
+ else
+ throw runtime_error("invalid placement " + placement);
+ }
}
const String& title = parser.has_option("title") ? parser.option_value("title") : "";
context.ui().info_show(title, parser[0], pos, get_face("Information"), style);