indent cleanup, correct erroneous 3 spaces indent

This commit is contained in:
Maxime Coste 2013-11-14 00:12:15 +00:00
parent 9679b17b16
commit 04ae48c346
7 changed files with 88 additions and 88 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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) {}
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; }
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); }
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; }
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()); }
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 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)

View File

@ -101,27 +101,27 @@ void test_utf8()
void test_string()
{
kak_assert(String("youpi ") + "matin" == "youpi matin");
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:");
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\\:");
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(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(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()

View File

@ -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>

View File

@ -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
};