summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-05-26 21:44:57 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-05-26 21:44:57 +0100
commit9aa38a1ea072f78cb5a1f099b7b4db241de6d96d (patch)
treef40b93fda750c7840792604d39f8716b296d9ca6 /src
parentc1a7759e7faa298f613a43f69689568df9cf059e (diff)
Rename select_whole_.* to just select_.*
Diffstat (limited to 'src')
-rw-r--r--src/normal.cc14
-rw-r--r--src/selectors.cc12
-rw-r--r--src/selectors.hh26
3 files changed, 30 insertions, 22 deletions
diff --git a/src/normal.cc b/src/normal.cc
index 062f512c..882fbc3a 100644
--- a/src/normal.cc
+++ b/src/normal.cc
@@ -913,11 +913,11 @@ void select_object(Context& context, int param)
Codepoint key;
Selection (*func)(const Buffer&, const Selection&, ObjectFlags);
} selectors[] = {
- { 'w', select_whole_word<Word> },
- { 'W', select_whole_word<WORD> },
- { 's', select_whole_sentence },
- { 'p', select_whole_paragraph },
- { 'i', select_whole_indent },
+ { 'w', select_word<Word> },
+ { 'W', select_word<WORD> },
+ { 's', select_sentence },
+ { 'p', select_paragraph },
+ { 'i', select_indent },
};
for (auto& sel : selectors)
{
@@ -1387,7 +1387,7 @@ KeyMap keymap =
{ '.', repeat_last_insert },
- { '%', [](Context& context, int) { select_whole_buffer(context.buffer(), context.selections()); } },
+ { '%', [](Context& context, int) { select_buffer(context.buffer(), context.selections()); } },
{ ':', command },
{ '|', pipe<InsertMode::Replace> },
@@ -1417,7 +1417,7 @@ KeyMap keymap =
{ 'x', repeated(make_select<SelectMode::Replace>(select_line)) },
{ 'X', repeated(make_select<SelectMode::Extend>(select_line)) },
- { alt('x'), make_select<SelectMode::Replace>(select_whole_lines) },
+ { alt('x'), make_select<SelectMode::Replace>(select_lines) },
{ alt('X'), make_select<SelectMode::Replace>(trim_partial_lines) },
{ 'm', make_select<SelectMode::Replace>(select_matching) },
diff --git a/src/selectors.cc b/src/selectors.cc
index 20e4440e..94c4fac7 100644
--- a/src/selectors.cc
+++ b/src/selectors.cc
@@ -223,7 +223,7 @@ static bool is_end_of_sentence(char c)
return c == '.' or c == ';' or c == '!' or c == '?';
}
-Selection select_whole_sentence(const Buffer& buffer, const Selection& selection, ObjectFlags flags)
+Selection select_sentence(const Buffer& buffer, const Selection& selection, ObjectFlags flags)
{
BufferIterator first = buffer.iterator_at(selection.cursor());
@@ -284,7 +284,7 @@ Selection select_whole_sentence(const Buffer& buffer, const Selection& selection
: Selection{last.coord(), first.coord()};
}
-Selection select_whole_paragraph(const Buffer& buffer, const Selection& selection, ObjectFlags flags)
+Selection select_paragraph(const Buffer& buffer, const Selection& selection, ObjectFlags flags)
{
BufferIterator first = buffer.iterator_at(selection.cursor());
@@ -360,7 +360,7 @@ static bool is_only_whitespaces(const String& str)
return it == str.end();
}
-Selection select_whole_indent(const Buffer& buffer, const Selection& selection, ObjectFlags flags)
+Selection select_indent(const Buffer& buffer, const Selection& selection, ObjectFlags flags)
{
int tabstop = buffer.options()["tabstop"].get<int>();
LineCount line = selection.cursor().line;
@@ -394,7 +394,7 @@ Selection select_whole_indent(const Buffer& buffer, const Selection& selection,
return Selection{begin_line, {end_line, buffer[end_line].length() - 1}};
}
-Selection select_whole_lines(const Buffer& buffer, const Selection& selection)
+Selection select_lines(const Buffer& buffer, const Selection& selection)
{
// no need to be utf8 aware for is_eol as we only use \n as line seperator
BufferIterator first = buffer.iterator_at(selection.anchor());
@@ -419,7 +419,7 @@ Selection select_whole_lines(const Buffer& buffer, const Selection& selection)
Selection trim_partial_lines(const Buffer& buffer, const Selection& selection)
{
- // same as select_whole_lines
+ // same as select_lines
BufferIterator first = buffer.iterator_at(selection.anchor());
BufferIterator last = buffer.iterator_at(selection.cursor());
BufferIterator& to_line_start = first <= last ? first : last;
@@ -433,7 +433,7 @@ Selection trim_partial_lines(const Buffer& buffer, const Selection& selection)
return Selection(first.coord(), last.coord());
}
-void select_whole_buffer(const Buffer& buffer, SelectionList& selections)
+void select_buffer(const Buffer& buffer, SelectionList& selections)
{
selections = SelectionList{ Selection({0,0}, buffer.back_coord()) };
}
diff --git a/src/selectors.hh b/src/selectors.hh
index b28febef..e6a3022a 100644
--- a/src/selectors.hh
+++ b/src/selectors.hh
@@ -159,7 +159,7 @@ constexpr ObjectFlags operator|(ObjectFlags lhs, ObjectFlags rhs)
{ return (ObjectFlags)((int)lhs | (int) rhs); }
template<WordType word_type>
-Selection select_whole_word(const Buffer& buffer, const Selection& selection, ObjectFlags flags)
+Selection select_word(const Buffer& buffer, const Selection& selection, ObjectFlags flags)
{
Utf8Iterator first = buffer.iterator_at(selection.cursor());
Utf8Iterator last = first;
@@ -200,16 +200,24 @@ Selection select_whole_word(const Buffer& buffer, const Selection& selection, Ob
: utf8_range(last, first);
}
-Selection select_whole_sentence(const Buffer& buffer, const Selection& selection,
- ObjectFlags flags);
-Selection select_whole_paragraph(const Buffer& buffer, const Selection& selection,
- ObjectFlags flags);
-Selection select_whole_indent(const Buffer& buffer, const Selection& selection,
- ObjectFlags flags);
-Selection select_whole_lines(const Buffer& buffer, const Selection& selection);
-void select_whole_buffer(const Buffer& buffer, SelectionList& selections);
+Selection select_sentence(const Buffer& buffer,
+ const Selection& selection,
+ ObjectFlags flags);
+
+Selection select_paragraph(const Buffer& buffer,
+ const Selection& selection,
+ ObjectFlags flags);
+
+Selection select_indent(const Buffer& buffer,
+ const Selection& selection,
+ ObjectFlags flags);
+
+Selection select_lines(const Buffer& buffer, const Selection& selection);
+
Selection trim_partial_lines(const Buffer& buffer, const Selection& selection);
+void select_buffer(const Buffer& buffer, SelectionList& selections);
+
enum Direction { Forward, Backward };
using MatchResults = boost::match_results<BufferIterator>;