diff options
| author | seivarya <[email protected]> | 2026-06-20 18:46:10 +0530 |
|---|---|---|
| committer | seivarya <[email protected]> | 2026-06-20 18:46:10 +0530 |
| commit | b5186a5a724649e9eb71fdfbaf3c2a84b36d7c9c (patch) | |
| tree | ac664730e758ef50f8472831fada93c6e8f7c5d7 /src/reader.cpp | |
| parent | 8798eafd4cc4b32c590a40c276c09b830c5d62da (diff) | |
[fix]: fixed incorrect rendering of words due to missing delimeters
Diffstat (limited to 'src/reader.cpp')
| -rw-r--r-- | src/reader.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
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<std::string> &strings, char ch) { - size_t pos = txt.find(ch); - size_t initial_pos = 0; +size_t split(const std::string &txt, std::vector<std::string> &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(); } |
