diff options
| author | Johannes Altmanninger <aclopte@gmail.com> | 2022-08-04 10:54:55 +0200 |
|---|---|---|
| committer | Johannes Altmanninger <aclopte@gmail.com> | 2022-08-17 00:38:58 +0200 |
| commit | 0eb4e68c402bcd77ad542e2c6113cb3abcd498d6 (patch) | |
| tree | 918cbe720f40d9dcdd6b72c66a74d5e37df94cd3 /src | |
| parent | 01f3d7cbda4b9667fd2e65c6786a0e9140e2890b (diff) | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keys.cc | 6 | ||||
| -rw-r--r-- | src/keys.hh | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/keys.cc b/src/keys.cc index 24dfe0dd..db87e48f 100644 --- a/src/keys.cc +++ b/src/keys.cc @@ -162,7 +162,7 @@ KeyList parse_keys(StringView str) return result; } -StringView button_to_str(Key::MouseButton button) +StringView to_string(Key::MouseButton button) { switch (button) { @@ -189,9 +189,9 @@ String to_string(Key key) case Key::Modifiers::MousePos: return format("<mouse:move:{}.{}>", coord.line, coord.column); 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: - 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: return format("<scroll:{}>", static_cast<int>(key.key)); case Key::Modifiers::Resize: diff --git a/src/keys.hh b/src/keys.hh index 78c24b59..2914de41 100644 --- a/src/keys.hh +++ b/src/keys.hh @@ -103,7 +103,7 @@ class StringView; KeyList parse_keys(StringView str); 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); constexpr Key shift(Key key) |
