Rename button_to_str() to the more idiomatic to_string()
Analogous to the parent commit. This returns StringView, but it's immortal so it's even better than String.
This commit is contained in:
parent
01f3d7cbda
commit
0eb4e68c40
|
@ -162,7 +162,7 @@ KeyList parse_keys(StringView str)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringView button_to_str(Key::MouseButton button)
|
StringView to_string(Key::MouseButton button)
|
||||||
{
|
{
|
||||||
switch (button)
|
switch (button)
|
||||||
{
|
{
|
||||||
|
@ -189,9 +189,9 @@ String to_string(Key key)
|
||||||
case Key::Modifiers::MousePos:
|
case Key::Modifiers::MousePos:
|
||||||
return format("<mouse:move:{}.{}>", coord.line, coord.column);
|
return format("<mouse:move:{}.{}>", coord.line, coord.column);
|
||||||
case Key::Modifiers::MousePress:
|
case Key::Modifiers::MousePress:
|
||||||
return format("<mouse:press:{}:{}.{}>", button_to_str(key.mouse_button()), coord.line, coord.column);
|
return format("<mouse:press:{}:{}.{}>", key.mouse_button(), coord.line, coord.column);
|
||||||
case Key::Modifiers::MouseRelease:
|
case Key::Modifiers::MouseRelease:
|
||||||
return format("<mouse:release:{}:{}.{}>", button_to_str(key.mouse_button()), coord.line, coord.column);
|
return format("<mouse:release:{}:{}.{}>", key.mouse_button(), coord.line, coord.column);
|
||||||
case Key::Modifiers::Scroll:
|
case Key::Modifiers::Scroll:
|
||||||
return format("<scroll:{}>", static_cast<int>(key.key));
|
return format("<scroll:{}>", static_cast<int>(key.key));
|
||||||
case Key::Modifiers::Resize:
|
case Key::Modifiers::Resize:
|
||||||
|
|
|
@ -103,7 +103,7 @@ class StringView;
|
||||||
|
|
||||||
KeyList parse_keys(StringView str);
|
KeyList parse_keys(StringView str);
|
||||||
String to_string(Key key);
|
String to_string(Key key);
|
||||||
StringView button_to_str(Key::MouseButton button);
|
StringView to_string(Key::MouseButton button);
|
||||||
Key::MouseButton str_to_button(StringView str);
|
Key::MouseButton str_to_button(StringView str);
|
||||||
|
|
||||||
constexpr Key shift(Key key)
|
constexpr Key shift(Key key)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user