alt-r rotates selections

This commit is contained in:
Maxime Coste 2013-01-05 18:26:57 +01:00
parent fadc2b7b6d
commit f3640a2d03

View File

@ -366,6 +366,17 @@ void do_scroll(Context& context)
window.set_position(position); window.set_position(position);
} }
void do_rotate_selections(Context& context)
{
int count = context.numeric_param();
if (count == 0)
count = 1;
SelectionList sels = context.editor().selections();
count %= sels .size();
std::rotate(sels.begin(), sels.begin() + count, sels.end());
context.editor().select(std::move(sels));
};
template<typename T> template<typename T>
class Repeated class Repeated
{ {
@ -555,6 +566,8 @@ std::unordered_map<Key, std::function<void (Context& context)>> keymap =
{ { Key::Modifiers::Control, 'i' }, jump<JumpDirection::Forward> }, { { Key::Modifiers::Control, 'i' }, jump<JumpDirection::Forward> },
{ { Key::Modifiers::Control, 'o' }, jump<JumpDirection::Backward> }, { { Key::Modifiers::Control, 'o' }, jump<JumpDirection::Backward> },
{ { Key::Modifiers::Alt, 'r' }, do_rotate_selections },
}; };
} }