mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-28 01:00:28 +03:00
Window: empty_selections -> clear_selections
clear_selections also reset select_mode to Normal, most editing operations now do a clear_selections.
This commit is contained in:
parent
4ce349fa02
commit
ff730380ed
11
src/main.cc
11
src/main.cc
@ -314,6 +314,7 @@ void do_insert(Window& window, IncrementalInserter::Mode mode)
|
||||
}
|
||||
draw_window(window);
|
||||
}
|
||||
window.clear_selections();
|
||||
}
|
||||
|
||||
void do_go(Window& window, int count)
|
||||
@ -447,18 +448,19 @@ void do_search_next(Window& window)
|
||||
void do_yank(Window& window, int count)
|
||||
{
|
||||
RegisterManager::instance()['"'] = window.selection_content();
|
||||
window.clear_selections();
|
||||
}
|
||||
|
||||
void do_erase(Window& window, int count)
|
||||
{
|
||||
do_yank(window, 0);
|
||||
RegisterManager::instance()['"'] = window.selection_content();
|
||||
window.erase();
|
||||
window.empty_selections();
|
||||
window.clear_selections();
|
||||
}
|
||||
|
||||
void do_change(Window& window, int count)
|
||||
{
|
||||
do_yank(window, 0);
|
||||
RegisterManager::instance()['"'] = window.selection_content();
|
||||
do_insert(window, IncrementalInserter::Mode::Change);
|
||||
}
|
||||
|
||||
@ -469,6 +471,7 @@ void do_paste(Window& window, int count)
|
||||
window.append(RegisterManager::instance()['"']);
|
||||
else
|
||||
window.insert(RegisterManager::instance()['"']);
|
||||
window.clear_selections();
|
||||
}
|
||||
|
||||
std::unordered_map<char, std::function<void (Window& window, int count)>> keymap =
|
||||
@ -502,7 +505,7 @@ std::unordered_map<char, std::function<void (Window& window, int count)>> keymap
|
||||
{ return Selection(cursor.buffer().begin(), cursor.buffer().end()-1); }); } },
|
||||
|
||||
{ ':', [](Window& window, int count) { do_command(); } },
|
||||
{ ' ', [](Window& window, int count) { window.empty_selections(); } },
|
||||
{ ' ', [](Window& window, int count) { window.clear_selections(); } },
|
||||
{ 'w', [](Window& window, int count) { do { window.select(select_to_next_word); } while(--count > 0); } },
|
||||
{ 'e', [](Window& window, int count) { do { window.select(select_to_next_word_end); } while(--count > 0); } },
|
||||
{ 'b', [](Window& window, int count) { do { window.select(select_to_previous_word); } while(--count > 0); } },
|
||||
|
@ -222,13 +222,14 @@ WindowCoord Window::line_and_column_at(const BufferIterator& iterator) const
|
||||
return buffer_to_window(m_buffer.line_and_column_at(iterator));
|
||||
}
|
||||
|
||||
void Window::empty_selections()
|
||||
void Window::clear_selections()
|
||||
{
|
||||
check_invariant();
|
||||
Selection sel = Selection(m_selections.back().last(),
|
||||
m_selections.back().last());
|
||||
m_selections.clear();
|
||||
m_selections.push_back(std::move(sel));
|
||||
m_select_mode = SelectMode::Normal;
|
||||
}
|
||||
|
||||
void Window::select(const Selector& selector)
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
void move_cursor(const WindowCoord& offset);
|
||||
void move_cursor_to(const WindowCoord& new_pos);
|
||||
|
||||
void empty_selections();
|
||||
void clear_selections();
|
||||
void select(const Selector& selector);
|
||||
BufferString selection_content() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user