diff --git a/src/buffer_utils.cc b/src/buffer_utils.cc index c02a283f..76884cda 100644 --- a/src/buffer_utils.cc +++ b/src/buffer_utils.cc @@ -138,7 +138,7 @@ Buffer* create_fifo_buffer(String name, int fd, bool scroll) if (prevent_scrolling) ++pos; - buffer->insert(pos, String(data, data+count)); + buffer->insert(pos, StringView(data, data+count)); if (count > 0 and prevent_scrolling) { diff --git a/src/face_registry.cc b/src/face_registry.cc index a9166af4..8f2cfbea 100644 --- a/src/face_registry.cc +++ b/src/face_registry.cc @@ -28,7 +28,7 @@ static Face parse_face(StringView facedesc) case 'b': res.attributes |= Attribute::Bold; break; case 'B': res.attributes |= Attribute::Blink; break; case 'd': res.attributes |= Attribute::Dim; break; - default: throw runtime_error("unknown face attribute '" + String(*attr_it) + "'"); + default: throw runtime_error("unknown face attribute '" + StringView(*attr_it) + "'"); } } } diff --git a/src/file.cc b/src/file.cc index 4c5f5a0e..38dd8d41 100644 --- a/src/file.cc +++ b/src/file.cc @@ -120,7 +120,7 @@ String read_fd(int fd) if (size == -1 or size == 0) break; - content += String(buf, buf + size); + content += StringView(buf, buf + size); } return content; } diff --git a/src/highlighters.cc b/src/highlighters.cc index f938a880..04e7783a 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -276,7 +276,7 @@ public: } catch (RegexError& err) { - throw runtime_error(String("regex error: ") + err.what()); + throw runtime_error(StringView{"regex error: "} + err.what()); } } @@ -1121,7 +1121,7 @@ public: } catch (RegexError& err) { - throw runtime_error(String("regex error: ") + err.what()); + throw runtime_error(StringView{"regex error: "} + err.what()); } } diff --git a/src/main.cc b/src/main.cc index 75610ca5..fdc05ca0 100644 --- a/src/main.cc +++ b/src/main.cc @@ -519,7 +519,7 @@ int run_pipe(StringView session) write_stderr("error while reading stdin\n"); return -1; } - command += String{buf, buf + count}; + command += StringView{buf, buf + count}; } try { diff --git a/src/normal.cc b/src/normal.cc index 9632108a..765c7017 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -656,7 +656,7 @@ void use_selection_as_search_pattern(Context& context, NormalParams) { auto begin = utf8::make_iterator(buffer.iterator_at(sel.min())); auto end = utf8::make_iterator(buffer.iterator_at(sel.max()))+1; - auto content = "\\Q" + String{begin.base(), end.base()} + "\\E"; + auto content = "\\Q" + buffer.string(begin.base().coord(), end.base().coord()) + "\\E"; if (smart) { if (begin == buffer.begin() or (is_word(*begin) and not is_word(*(begin-1)))) diff --git a/src/regex.cc b/src/regex.cc index 23916036..4df06dc6 100644 --- a/src/regex.cc +++ b/src/regex.cc @@ -8,7 +8,7 @@ namespace Kakoune String option_to_string(const Regex& re) { const auto& str = re.str(); - return String{str.begin(), str.end()}; + return {str.begin(), str.end()}; } void option_from_string(StringView str, Regex& re) diff --git a/src/shell_manager.cc b/src/shell_manager.cc index cf7d6cf3..283b1029 100644 --- a/src/shell_manager.cc +++ b/src/shell_manager.cc @@ -55,7 +55,7 @@ std::pair ShellManager::eval( size_t size = read(watcher.fd(), buffer, 1024); if (size <= 0) watcher.close_fd(); - output += String(buffer, buffer+size); + output += StringView{buffer, buffer+size}; }; };