summaryrefslogtreecommitdiff
path: root/src/string.hh
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-06-27Remove <algorithm> include from string.hhMaxime Coste
This was only used for std::min and std::equal, which can be replaced with custom code and memcmp, this removes a costly header from the often used string.hh and may improve compilation speed slightly
2025-05-11Fix compiler warning on space in string-literal suffix defJohannes Altmanninger
GCC complains: src/string.hh:376:39: warning: space between quotes and suffix is deprecated in C++23 [-Wdeprecated-literal-operator] 376 | inline constexpr StringView operator"" _sv(const char* str, size_t) | ^~
2025-05-11Update GDB pretty printer following SSO layout changeJohannes Altmanninger
Commit 2754e27cf (Increase SSO from 22 to 23 chars., 2024-06-07) changed they layout of SSO-strings. Specifically, is_long() no longer takes a bit away from the size field. Update the GDB pretty printer accordingly, making it work with small strings again.
2024-08-14Add missing include for non libstdc++ buildsMaxime Coste
2024-06-23Fix trailing whitespacesMaxime Coste
2024-06-12Add some static_asserts in SSO codeMaxime 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
2024-02-06Use different hash algorithms for strings and file hashingMaxime Coste
For hash map, using fnv1a is faster as it is a much simpler algorithm we can afford to inline. For files murmur3 should win as it processes bytes 4 by 4.
2023-11-03Replace std::lexicographical_compare_three_way with custom codeMaxime Coste
On latest MacOS this function is still not implemented
2023-10-25Remove redundant comparison operatorsMaxime Coste
Since C++20 (a != b) get automatically rewritten as !(a == b) if the != operator does not exist.
2022-12-15Support adding ByteCount to void/char pointers without castingMaxime Coste
2022-12-03Rework StringOps::substr implementationMaxime Coste
Avoid iterating over the whole string when the length is not provided just use the end iterator directly.
2022-03-06Add a complete-command command to configure command completionMaxime Coste
This makes it possible to change command completion in hooks and paves the way to more flexibility in how custom commands can be completed
2021-08-30Take a function SelectionList::insert to get string to insertMaxime Coste
This makes it unnecessary to allocate Vector<String> to insert and allows to remove the insert_pos pointer hack by passing it to the callback.
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
2020-03-29Fix empty strings not being zero terminatedMaxime 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.
2018-04-05Fix some trailing spaces and a tab that sneaked into the code baseMaxime Coste
2017-10-20Constexprify various hash functionsMaxime Coste
2017-10-10Move all non-core string code to string_utils.{hh,cc}Maxime Coste
2017-08-18Revert "Change HashCompatible trait to a variable template"Maxime Coste
This reverts commit b58f72315cbf7ee8921659dd129fd2f6a221bcfc. Unfortunately gcc-5.1 handling of variable template partial specializations is bugged.
2017-08-14Change HashCompatible trait to a variable templateMaxime Coste
2017-08-14Use decltype(auto) return type for some to_string functionsMaxime Coste
Remove explicit return type thats just duplicating the return expression.
2017-07-19Migrate code to c++14Maxime Coste
2017-07-09Remove assert in String::String(Codepoint, ColumnCount)Maxime Coste
codepoint_width is locale dependent, and we could end up with it returning a different value depending on the locale. It is better to return a string of the wrong column length than fail on assert in this case as we cannot fix it anyway. Fixes #1489
2017-06-26Formatting fixMaxime Coste
2017-06-23Use an HashMap to store options in option managerMaxime Coste
Turns out looking for options can get pretty slow, so O(1) lookup seems better. This should improve the performance of the #1460 issue
2017-06-16Trim whitespaces surrounding docstringsMaxime Coste
Closes #1439
2017-06-06Fix spurious copies being made when using the format functionMaxime Coste
We were not correctly forwarding the arguments, leading to copies of 'const String&' parameters.
2017-05-26Small code style tweakMaxime Coste
2017-03-06Introduce a custom HashMap implementation along with a quick benchmarkMaxime Coste
2017-01-29Make StringView and unit types trivial typesMaxime Coste
2017-01-08Apply clang-tidy modernize to the codebaseMaxime Coste
2016-12-17Fix join, we dont have a StringView from char array constructorMaxime Coste
2016-12-17Escape the backslash chars as well when joining stringsMaxime Coste
Fixes #1014
2016-12-14Handle correctly cases where codepoint_width returns -1Maxime Coste
Fixes #972
2016-11-28Cleanup include dependencies a bitMaxime 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-09-26Assert substr from parameter is within the stringMaxime Coste
Should catch #756 earlier if it happens again.
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-06Add information of types of optionsMaxime Coste
2016-07-27Ensure we cannot call StringView::StringView{Codepoint}Maxime Coste