summaryrefslogtreecommitdiff
path: root/src/string.cc
AgeCommit message (Collapse)Author
2025-06-28Move some String constructors out of the headerMaxime Coste
Those do not really need to get inlined and pull std::max which really wants <algorithm> which is an expensive header.
2025-05-23Fix out-of-bounds write in short strings when reaching capacityMaxime Coste
When we reach capacity for Short strings, we re-use the field past the buffer (remaining_capacity) to hold the terminal null character, this works well but the code was trying to set it twice: when computing the remaining capacity (which is 0 when we hit capacity), and when setting the null character. While this second operation should be fine in practice, it is technically undefined behaviour as we overwrite it by accessing past the end of the buffer.
2024-06-23Fix trailing whitespacesMaxime Coste
2024-06-11Switch to bitfield.Ben Judd
2024-06-07Fix build by moving include.Ben Judd
2024-06-07Increase SSO from 22 to 23 chars.Ben Judd
2021-07-20Improve code-generation for StringsMaxime Coste
Make String::Data use trivial copy of the short/long union to avoid unnecessary branching there, inline release() as it can be elided by the compiler on moved-from Strings.
2021-07-09Inline String::Data no-copy constructorMaxime Coste
2019-11-17Fix String::resize not zero-terminatingMaxime Coste
2019-03-19Make String able to reference external data without copyingMaxime Coste
Sometimes we really need to have a String instead of a StringView, but some of those strings might not need to own their data. Make it possible to explicitely construct a String that does not own the underlying buffer. Use it when parsing balanced strings.
2017-10-10Move all non-core string code to string_utils.{hh,cc}Maxime Coste
2017-08-29Rename containers.hh to ranges.hh (and Container to Range)Maxime Coste
2017-08-23Fix String::Data copying/moving from selfMaxime Coste
2017-06-26Use the extra_word_chars option in word based normal commandsMaxime Coste
the completion_extra_word_chars is now gone, superseeded by extra_word_chars that gets used both for completion and for normal mode. Fixes #1304
2017-06-26Fix various undefined behaviours detected by UBSanMaxime Coste
2017-06-24Slight code refactoring and perf improvement in vector option to stringMaxime Coste
2017-06-16Trim whitespaces surrounding docstringsMaxime Coste
Closes #1439
2016-11-23Fix horrible leak in String::Data::operator=(String::Data&&)Maxime Coste
And that, my friends, is why we recommend using standard containers instead of rolling your own.
2016-11-23Small code tweakMaxime Coste
2016-11-22Small code refactoringMaxime Coste
2016-10-31Add to_string(long long int) overload to fix OSX compilationMaxime Coste
2016-10-01Rename get_width to codepoint_widthMaxime Coste
2016-10-01Support codepoints of variable widthMaxime Coste
Add a ColumnCount type and use it in place of CharCount whenever more appropriate, take column size of codepoints into account for vertical movements and docstring wrapping. Fixes #811
2016-09-28Fix String::Data::reserve on big endian platforms, and document String::DataMaxime Coste
reserve was not ensuring the capacity would be pair, which is needed on big endian machines, as we use its least significant bit to flag short string optimizations. On little endian the bit we use is the 8th most significant (the least significant bit of the last byte), so we were not hitting any problems. Fixes #828
2016-08-31Remove the to_string(unsigned) (it conflicts with to_string(size_t) on x86)Maxime Coste
Just cast to int when we pass an unsigned.
2016-08-27Add a to_string overload for unsigned intMaxime Coste
2016-08-26Fix another bug in wrap_linesMaxime Coste
2016-06-19Add a String::resize methodMaxime Coste
2016-04-27Fix wrap_linesMaxime Coste
2016-04-04Refactor wrap_lines and add some unit testsMaxime Coste
2016-03-24Optimize split implementation, avoid growing strings char by charMaxime Coste
2016-02-13Do not allow / in highlighter names as it is used for hierachiesMaxime Coste
/ are replaced with <slash> in the highlighter names. Fixes #553
2016-02-10Use a custom SSO aware string backendMaxime Coste
2015-11-25Add a static const String::ms_empty empty stringMaxime Coste
2015-11-19Splitting an empty string now returns an empty vectorMaxime Coste
2015-09-24Add Haiku support.Filip SzczepaƄski
2015-09-23Refactor utf8::iterator to be on the safe sideMaxime Coste
utf8::iterator now knows the iterator valid range, and pass it to utf8 functions.
2015-09-20Tweak string unit testsMaxime Coste
2015-09-20Fix unescape implementationMaxime Coste
2015-09-07Avoid wrapping lines with negative max widthMaxime Coste
2015-08-18Smaller sizeof for in place stringsMaxime Coste
2015-08-13More performant escape/unescapeMaxime Coste
2015-07-14Add missing support for Codepoint in formatMaxime Coste
2015-06-22Add support for hex formattingMaxime Coste
2015-06-19Fix wrong exception type in str_to_intMaxime Coste
2015-05-22Move unit test functions in next to the code they are testingMaxime Coste
2015-05-01Add str_to_int_ifp that returns an Optional<int> instead of throwingMaxime Coste
2015-04-22Add format_to allowing formating to an existing bufferMaxime Coste
2015-03-31small code tweak in formatMaxime Coste
2015-03-31number to string conversion avoids memory allocationsMaxime Coste