summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-11-14 00:12:15 +0000
committerMaxime Coste <frrrwww@gmail.com>2013-11-14 00:12:15 +0000
commit04ae48c346d0c2c6d6bcd4bbb7f6ff0ab88c1bd8 (patch)
tree31609f0e6d9159f0e0c1c416e392f380c51a67e0 /src
parent9679b17b16fb971de2e048a1abf2d63fe83ad3ee (diff)
indent cleanup, correct erroneous 3 spaces indent
Diffstat (limited to 'src')
-rw-r--r--src/buffer.cc6
-rw-r--r--src/command_manager.cc2
-rw-r--r--src/normal.cc2
-rw-r--r--src/string.hh82
-rw-r--r--src/unit_tests.cc42
-rw-r--r--src/units.hh2
-rw-r--r--src/utils.hh58
7 files changed, 97 insertions, 97 deletions
diff --git a/src/buffer.cc b/src/buffer.cc
index 2422e7ac..cd45273f 100644
--- a/src/buffer.cc
+++ b/src/buffer.cc
@@ -731,9 +731,9 @@ ByteCount Buffer::offset(BufferCoord c) const
bool Buffer::is_valid(BufferCoord c) const
{
- return (c.line < line_count() and c.column < m_lines[c.line].length()) or
- (c.line == line_count() - 1 and c.column == m_lines.back().length()) or
- (c.line == line_count() and c.column == 0);
+ return (c.line < line_count() and c.column < m_lines[c.line].length()) or
+ (c.line == line_count() - 1 and c.column == m_lines.back().length()) or
+ (c.line == line_count() and c.column == 0);
}
bool Buffer::is_end(BufferCoord c) const
diff --git a/src/command_manager.cc b/src/command_manager.cc
index 74468c06..ac3a5a20 100644
--- a/src/command_manager.cc
+++ b/src/command_manager.cc
@@ -78,7 +78,7 @@ bool is_command_separator(char c)
bool is_horizontal_blank(char c)
{
- return c == ' ' or c == '\t';
+ return c == ' ' or c == '\t';
}
struct unterminated_string : parse_error
diff --git a/src/normal.cc b/src/normal.cc
index 932488f5..b837a0f5 100644
--- a/src/normal.cc
+++ b/src/normal.cc
@@ -745,7 +745,7 @@ void select_to_next_char(Context& context, int param)
std::bind(flags & SelectFlags::Reverse ? select_to_reverse : select_to,
_1, _2, key.key, param, flags & SelectFlags::Inclusive),
flags & SelectFlags::Extend ? SelectMode::Extend : SelectMode::Replace);
- }, "select to next char","enter char to select to");
+ }, "select to next char","enter char to select to");
}
void start_or_end_macro_recording(Context& context, int)
diff --git a/src/string.hh b/src/string.hh
index 68317901..176c7269 100644
--- a/src/string.hh
+++ b/src/string.hh
@@ -16,47 +16,47 @@ typedef boost::regex Regex;
class String : public std::string
{
public:
- String() {}
- String(const char* content) : std::string(content) {}
- String(std::string content) : std::string(std::move(content)) {}
- explicit String(char content, CharCount count = 1) : std::string((size_t)(int)count, content) {}
- explicit String(Codepoint cp, CharCount count = 1)
- {
- while (count-- > 0)
- utf8::dump(back_inserter(*this), cp);
- }
- template<typename Iterator>
- String(Iterator begin, Iterator end) : std::string(begin, end) {}
-
- std::string& stdstr() { return *this; }
- const std::string& stdstr() const { return *this; }
-
- char operator[](ByteCount pos) const { return std::string::operator[]((int)pos); }
- char& operator[](ByteCount pos) { return std::string::operator[]((int)pos); }
- ByteCount length() const { return ByteCount{(int)std::string::length()}; }
- CharCount char_length() const { return utf8::distance(begin(), end()); }
- ByteCount byte_count_to(CharCount count) const { return utf8::advance(begin(), end(), (int)count) - begin(); }
- CharCount char_count_to(ByteCount count) const { return utf8::distance(begin(), begin() + (int)count); }
-
- String operator+(const String& other) const { return String{stdstr() + other.stdstr()}; }
- String& operator+=(const String& other) { std::string::operator+=(other); return *this; }
- String operator+(const char* other) const { return String{stdstr() + other}; }
- String& operator+=(const char* other) { std::string::operator+=(other); return *this; }
- String operator+(char other) const { return String{stdstr() + other}; }
- String& operator+=(char other) { std::string::operator+=(other); return *this; }
- String operator+(Codepoint cp) const { String res = *this; utf8::dump(back_inserter(res), cp); return res; }
- String& operator+=(Codepoint cp) { utf8::dump(back_inserter(*this), cp); return *this; }
-
- memoryview<char> data() const { return memoryview<char>(std::string::data(), size()); }
-
- String substr(ByteCount pos, ByteCount length = -1) const { return String{std::string::substr((int)pos, (int)length)}; }
- String substr(CharCount pos, CharCount length = INT_MAX) const
- {
- auto b = utf8::advance(begin(), end(), (int)pos);
- auto e = utf8::advance(b, end(), (int)length);
- return String(b,e);
- }
- String replace(const Regex& expression, const String& replacement) const;
+ String() {}
+ String(const char* content) : std::string(content) {}
+ String(std::string content) : std::string(std::move(content)) {}
+ explicit String(char content, CharCount count = 1) : std::string((size_t)(int)count, content) {}
+ explicit String(Codepoint cp, CharCount count = 1)
+ {
+ while (count-- > 0)
+ utf8::dump(back_inserter(*this), cp);
+ }
+ template<typename Iterator>
+ String(Iterator begin, Iterator end) : std::string(begin, end) {}
+
+ std::string& stdstr() { return *this; }
+ const std::string& stdstr() const { return *this; }
+
+ char operator[](ByteCount pos) const { return std::string::operator[]((int)pos); }
+ char& operator[](ByteCount pos) { return std::string::operator[]((int)pos); }
+ ByteCount length() const { return ByteCount{(int)std::string::length()}; }
+ CharCount char_length() const { return utf8::distance(begin(), end()); }
+ ByteCount byte_count_to(CharCount count) const { return utf8::advance(begin(), end(), (int)count) - begin(); }
+ CharCount char_count_to(ByteCount count) const { return utf8::distance(begin(), begin() + (int)count); }
+
+ String operator+(const String& other) const { return String{stdstr() + other.stdstr()}; }
+ String& operator+=(const String& other) { std::string::operator+=(other); return *this; }
+ String operator+(const char* other) const { return String{stdstr() + other}; }
+ String& operator+=(const char* other) { std::string::operator+=(other); return *this; }
+ String operator+(char other) const { return String{stdstr() + other}; }
+ String& operator+=(char other) { std::string::operator+=(other); return *this; }
+ String operator+(Codepoint cp) const { String res = *this; utf8::dump(back_inserter(res), cp); return res; }
+ String& operator+=(Codepoint cp) { utf8::dump(back_inserter(*this), cp); return *this; }
+
+ memoryview<char> data() const { return memoryview<char>(std::string::data(), size()); }
+
+ String substr(ByteCount pos, ByteCount length = -1) const { return String{std::string::substr((int)pos, (int)length)}; }
+ String substr(CharCount pos, CharCount length = INT_MAX) const
+ {
+ auto b = utf8::advance(begin(), end(), (int)pos);
+ auto e = utf8::advance(b, end(), (int)length);
+ return String(b,e);
+ }
+ String replace(const Regex& expression, const String& replacement) const;
};
inline String operator+(const char* lhs, const String& rhs)
diff --git a/src/unit_tests.cc b/src/unit_tests.cc
index 4a6b149d..1294c0be 100644
--- a/src/unit_tests.cc
+++ b/src/unit_tests.cc
@@ -101,27 +101,27 @@ void test_utf8()
void test_string()
{
- kak_assert(String("youpi ") + "matin" == "youpi matin");
-
- std::vector<String> splited = split("youpi:matin::tchou\\:kanaky:hihi\\:", ':', '\\');
- kak_assert(splited[0] == "youpi");
- kak_assert(splited[1] == "matin");
- kak_assert(splited[2] == "");
- kak_assert(splited[3] == "tchou:kanaky");
- kak_assert(splited[4] == "hihi:");
-
- String escaped = escape("youpi:matin:tchou:", ':', '\\');
- kak_assert(escaped == "youpi\\:matin\\:tchou\\:");
-
- kak_assert(prefix_match("tchou kanaky", "tchou"));
- kak_assert(prefix_match("tchou kanaky", "tchou kanaky"));
- kak_assert(prefix_match("tchou kanaky", "t"));
- kak_assert(not prefix_match("tchou kanaky", "c"));
-
- kak_assert(subsequence_match("tchou kanaky", "tknky"));
- kak_assert(subsequence_match("tchou kanaky", "knk"));
- kak_assert(subsequence_match("tchou kanaky", "tchou kanaky"));
- kak_assert(not subsequence_match("tchou kanaky", "tchou kanaky"));
+ kak_assert(String("youpi ") + "matin" == "youpi matin");
+
+ std::vector<String> splited = split("youpi:matin::tchou\\:kanaky:hihi\\:", ':', '\\');
+ kak_assert(splited[0] == "youpi");
+ kak_assert(splited[1] == "matin");
+ kak_assert(splited[2] == "");
+ kak_assert(splited[3] == "tchou:kanaky");
+ kak_assert(splited[4] == "hihi:");
+
+ String escaped = escape("youpi:matin:tchou:", ':', '\\');
+ kak_assert(escaped == "youpi\\:matin\\:tchou\\:");
+
+ kak_assert(prefix_match("tchou kanaky", "tchou"));
+ kak_assert(prefix_match("tchou kanaky", "tchou kanaky"));
+ kak_assert(prefix_match("tchou kanaky", "t"));
+ kak_assert(not prefix_match("tchou kanaky", "c"));
+
+ kak_assert(subsequence_match("tchou kanaky", "tknky"));
+ kak_assert(subsequence_match("tchou kanaky", "knk"));
+ kak_assert(subsequence_match("tchou kanaky", "tchou kanaky"));
+ kak_assert(not subsequence_match("tchou kanaky", "tchou kanaky"));
}
void test_keys()
diff --git a/src/units.hh b/src/units.hh
index 99e2db45..430971e8 100644
--- a/src/units.hh
+++ b/src/units.hh
@@ -85,7 +85,7 @@ public:
explicit constexpr operator ValueType() const { return m_value; }
explicit constexpr operator bool() const { return m_value; }
private:
- ValueType m_value;
+ ValueType m_value;
};
struct LineCount : public StronglyTypedNumber<LineCount, int>
diff --git a/src/utils.hh b/src/utils.hh
index 0500b203..ef0cf3d5 100644
--- a/src/utils.hh
+++ b/src/utils.hh
@@ -96,52 +96,52 @@ public:
#endif
m_ptr = other.m_ptr;
return *this;
- }
+ }
- safe_ptr& operator=(safe_ptr&& other)
- {
- #ifdef KAK_DEBUG
- if (m_ptr)
- m_ptr->dec_safe_count();
- #endif
- m_ptr = other.m_ptr;
- other.m_ptr = nullptr;
- return *this;
- }
+ safe_ptr& operator=(safe_ptr&& other)
+ {
+ #ifdef KAK_DEBUG
+ if (m_ptr)
+ m_ptr->dec_safe_count();
+ #endif
+ m_ptr = other.m_ptr;
+ other.m_ptr = nullptr;
+ return *this;
+ }
- void reset(T* ptr)
- {
- *this = safe_ptr(ptr);
- }
+ void reset(T* ptr)
+ {
+ *this = safe_ptr(ptr);
+ }
- bool operator== (const safe_ptr& other) const { return m_ptr == other.m_ptr; }
- bool operator!= (const safe_ptr& other) const { return m_ptr != other.m_ptr; }
- bool operator== (T* ptr) const { return m_ptr == ptr; }
- bool operator!= (T* ptr) const { return m_ptr != ptr; }
+ bool operator== (const safe_ptr& other) const { return m_ptr == other.m_ptr; }
+ bool operator!= (const safe_ptr& other) const { return m_ptr != other.m_ptr; }
+ bool operator== (T* ptr) const { return m_ptr == ptr; }
+ bool operator!= (T* ptr) const { return m_ptr != ptr; }
- T& operator* () const { return *m_ptr; }
- T* operator-> () const { return m_ptr; }
+ T& operator* () const { return *m_ptr; }
+ T* operator-> () const { return m_ptr; }
- T* get() const { return m_ptr; }
+ T* get() const { return m_ptr; }
- explicit operator bool() const { return m_ptr; }
+ explicit operator bool() const { return m_ptr; }
private:
- T* m_ptr;
+ T* m_ptr;
};
class SafeCountable
{
public:
#ifdef KAK_DEBUG
- SafeCountable() : m_count(0) {}
- ~SafeCountable() { kak_assert(m_count == 0); }
+ SafeCountable() : m_count(0) {}
+ ~SafeCountable() { kak_assert(m_count == 0); }
- void inc_safe_count() const { ++m_count; }
- void dec_safe_count() const { --m_count; kak_assert(m_count >= 0); }
+ void inc_safe_count() const { ++m_count; }
+ void dec_safe_count() const { --m_count; kak_assert(m_count >= 0); }
private:
- mutable int m_count;
+ mutable int m_count;
#endif
};