diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-11-23 18:48:04 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-11-23 18:48:04 +0100 |
| commit | dca05ecc73f6ff8801e718fb4f957de5e821f201 (patch) | |
| tree | d9e0a04e5a6f778a7548ff475ee8e8d997cc3e3b /src | |
| parent | 9c99c238e8994376049bdafc41e6460d8ffad278 (diff) | |
small code tweak
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cc | 5 | ||||
| -rw-r--r-- | src/string.hh | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/main.cc b/src/main.cc index 25357773..9f252c5b 100644 --- a/src/main.cc +++ b/src/main.cc @@ -236,9 +236,8 @@ void do_join(Context& context) void do_indent(Context& context) { - const char* spaces = " "; - int width = std::min(context.options()["indentwidth"].as_int(), 16); - String indent(spaces, spaces + width); + size_t width = context.options()["indentwidth"].as_int(); + String indent(' ', width); Editor& editor = context.editor(); SelectionAndCapturesList sels = editor.selections(); diff --git a/src/string.hh b/src/string.hh index e735444e..ef30195d 100644 --- a/src/string.hh +++ b/src/string.hh @@ -23,7 +23,7 @@ public: String(std::string content) : m_content(std::move(content)) {} String(const String& string) = default; String(String&& string) = default; - explicit String(char content) : m_content(std::string() + content) {} + explicit String(char content, size_t count = 1) : m_content(count, content) {} template<typename Iterator> String(Iterator begin, Iterator end) : m_content(begin, end) {} |
