From b5186a5a724649e9eb71fdfbaf3c2a84b36d7c9c Mon Sep 17 00:00:00 2001 From: seivarya Date: Sat, 20 Jun 2026 18:46:10 +0530 Subject: [fix]: fixed incorrect rendering of words due to missing delimeters --- src/reader.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/reader.cpp') diff --git a/src/reader.cpp b/src/reader.cpp index dd293db..508205d 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -115,17 +115,15 @@ void editor_refresh_scrn(editor_cfg *cfg) { append_buffer::instance().remove(); } -size_t split(const std::string &txt, std::vector &strings, char ch) { - size_t pos = txt.find(ch); - size_t initial_pos = 0; +size_t split(const std::string &txt, std::vector &strings, const std::string &delims) { + size_t initial_pos = txt.find_first_not_of(delims, 0); + size_t pos = txt.find_first_of(delims, initial_pos); - while (pos != std::string::npos) { + while (initial_pos != std::string::npos) { strings.push_back(txt.substr(initial_pos, pos - initial_pos)); - initial_pos = pos + 1; - pos = txt.find(ch, initial_pos); + initial_pos = txt.find_first_not_of(delims, pos); + pos = txt.find_first_of(delims, initial_pos); } - - strings.push_back(txt.substr(initial_pos)); return strings.size(); } -- cgit v1.2.3