Alt-Space permits to remove a selection by index
This commit is contained in:
parent
3bfd774f49
commit
2c4bc5582a
|
@ -136,6 +136,14 @@ void Editor::keep_selection(int index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Editor::remove_selection(int index)
|
||||||
|
{
|
||||||
|
check_invariant();
|
||||||
|
|
||||||
|
if (selections().size() > 1 and index < selections().size())
|
||||||
|
m_selections.back().erase(m_selections.back().begin() + index);
|
||||||
|
}
|
||||||
|
|
||||||
void Editor::select(const BufferIterator& iterator)
|
void Editor::select(const BufferIterator& iterator)
|
||||||
{
|
{
|
||||||
m_selections.back().clear();
|
m_selections.back().clear();
|
||||||
|
|
|
@ -43,6 +43,7 @@ public:
|
||||||
void move_selections(const BufferCoord& offset, bool append = false);
|
void move_selections(const BufferCoord& offset, bool append = false);
|
||||||
void clear_selections();
|
void clear_selections();
|
||||||
void keep_selection(int index);
|
void keep_selection(int index);
|
||||||
|
void remove_selection(int index);
|
||||||
void select(const BufferIterator& iterator);
|
void select(const BufferIterator& iterator);
|
||||||
void select(const Selector& selector, bool append = false);
|
void select(const Selector& selector, bool append = false);
|
||||||
void multi_select(const MultiSelector& selector);
|
void multi_select(const MultiSelector& selector);
|
||||||
|
|
|
@ -388,6 +388,8 @@ std::unordered_map<Key, std::function<void (Editor& editor, int count)>> keymap
|
||||||
{ { Key::Modifiers::None, '|' }, do_pipe },
|
{ { Key::Modifiers::None, '|' }, do_pipe },
|
||||||
{ { Key::Modifiers::None, ' ' }, [](Editor& editor, int count) { if (count == 0) editor.clear_selections();
|
{ { Key::Modifiers::None, ' ' }, [](Editor& editor, int count) { if (count == 0) editor.clear_selections();
|
||||||
else editor.keep_selection(count-1); } },
|
else editor.keep_selection(count-1); } },
|
||||||
|
{ { Key::Modifiers::Alt, ' ' }, [](Editor& editor, int count) { if (count == 0) editor.clear_selections();
|
||||||
|
else editor.remove_selection(count-1); } },
|
||||||
{ { Key::Modifiers::None, 'w' }, [](Editor& editor, int count) { do { editor.select(select_to_next_word<false>); } while(--count > 0); } },
|
{ { Key::Modifiers::None, 'w' }, [](Editor& editor, int count) { do { editor.select(select_to_next_word<false>); } while(--count > 0); } },
|
||||||
{ { Key::Modifiers::None, 'e' }, [](Editor& editor, int count) { do { editor.select(select_to_next_word_end<false>); } while(--count > 0); } },
|
{ { Key::Modifiers::None, 'e' }, [](Editor& editor, int count) { do { editor.select(select_to_next_word_end<false>); } while(--count > 0); } },
|
||||||
{ { Key::Modifiers::None, 'b' }, [](Editor& editor, int count) { do { editor.select(select_to_previous_word<false>); } while(--count > 0); } },
|
{ { Key::Modifiers::None, 'b' }, [](Editor& editor, int count) { do { editor.select(select_to_previous_word<false>); } while(--count > 0); } },
|
||||||
|
|
Loading…
Reference in New Issue
Block a user