diff --git a/src/client.cc b/src/client.cc index f47f31895..6c3523ad5 100644 --- a/src/client.cc +++ b/src/client.cc @@ -96,7 +96,7 @@ bool Client::process_pending_inputs() catch (Kakoune::runtime_error& error) { write_to_debug_buffer(format("Error: {}", error.what())); - context().print_status({ error.what().str(), get_face("Error") }); + context().print_status({ fix_atom_text(error.what().str()), get_face("Error") }); context().hooks().run_hook("RuntimeError", error.what(), context()); } } diff --git a/src/client_manager.cc b/src/client_manager.cc index bec1b2ea3..fd4cfe1a2 100644 --- a/src/client_manager.cc +++ b/src/client_manager.cc @@ -64,7 +64,7 @@ Client* ClientManager::create_client(std::unique_ptr&& ui, int pi } catch (Kakoune::runtime_error& error) { - client->context().print_status({ error.what().str(), get_face("Error") }); + client->context().print_status({ fix_atom_text(error.what().str()), get_face("Error") }); client->context().hooks().run_hook("RuntimeError", error.what(), client->context()); } diff --git a/src/commands.cc b/src/commands.cc index 848d4406e..1e583adb2 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -1101,7 +1101,7 @@ const CommandDesc echo_cmd = { CommandCompleter{}, [](const ParametersParser& parser, Context& context, const ShellContext&) { - String message = join(parser, ' ', false); + String message = fix_atom_text(join(parser, ' ', false)); if (parser.get_switch("debug")) write_to_debug_buffer(message); else if (parser.get_switch("markup")) diff --git a/src/display_buffer.cc b/src/display_buffer.cc index 3694839a1..e6ae2a345 100644 --- a/src/display_buffer.cc +++ b/src/display_buffer.cc @@ -303,4 +303,22 @@ DisplayLine parse_display_line(StringView line, const HashMap& builtins = {}); class DisplayBuffer : public UseMemoryDomain diff --git a/src/input_handler.cc b/src/input_handler.cc index 797719f9c..debae2d8f 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -500,23 +500,6 @@ public: DisplayLine build_display_line(ColumnCount in_width) { - auto cleanup = [](StringView str) { - String res; - auto pos = str.begin(); - for (auto it = str.begin(), end = str.end(); it != end; ++it) - { - char c = *it; - if (c == '\n' or c == '\r') - { - res += StringView{pos, it}; - res += c == '\n' ? "␤" : "␍"; - pos = it+1; - } - } - res += StringView{pos, str.end()}; - return res; - }; - CharCount width = (int)in_width; // Todo: proper handling of char/column kak_assert(m_cursor_pos <= m_line.char_length()); if (m_cursor_pos < m_display_pos) @@ -525,12 +508,12 @@ public: m_display_pos = m_cursor_pos + 1 - width; if (m_cursor_pos == m_line.char_length()) - return DisplayLine{{ { cleanup(m_line.substr(m_display_pos, width-1)), get_face("StatusLine") }, + return DisplayLine{{ { fix_atom_text(m_line.substr(m_display_pos, width-1)), get_face("StatusLine") }, { " "_str, get_face("StatusCursor")} } }; else - return DisplayLine({ { cleanup(m_line.substr(m_display_pos, m_cursor_pos - m_display_pos)), get_face("StatusLine") }, - { cleanup(m_line.substr(m_cursor_pos,1)), get_face("StatusCursor") }, - { cleanup(m_line.substr(m_cursor_pos+1, width - m_cursor_pos + m_display_pos - 1)), get_face("StatusLine") } }); + return DisplayLine({ { fix_atom_text(m_line.substr(m_display_pos, m_cursor_pos - m_display_pos)), get_face("StatusLine") }, + { fix_atom_text(m_line.substr(m_cursor_pos,1)), get_face("StatusCursor") }, + { fix_atom_text(m_line.substr(m_cursor_pos+1, width - m_cursor_pos + m_display_pos - 1)), get_face("StatusLine") } }); } private: CharCount m_cursor_pos = 0; diff --git a/src/normal.cc b/src/normal.cc index 78b134cf9..bc8d955be 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -842,7 +842,7 @@ void use_selection_as_search_pattern(Context& context, NormalParams params) const char reg = to_lower(params.reg ? params.reg : '/'); context.print_status({ - format("register '{}' set to '{}'", reg, patterns[sels.main_index()]), + format("register '{}' set to '{}'", reg, fix_atom_text(patterns[sels.main_index()])), get_face("Information") }); RegisterManager::instance()[reg].set(context, patterns);