Maxime Coste
a4dd89f214
Improve code-generation for Strings
...
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-20 22:30:41 +10:00
Maxime Coste
c30a0e0ca2
Inline String::Data no-copy constructor
2021-07-09 17:03:22 +10:00
Maxime Coste
5378dabdec
Fix String::resize not zero-terminating
2019-11-17 09:50:18 +11:00
Maxime Coste
56611604b2
Make String able to reference external data without copying
...
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.
2019-03-19 22:00:57 +11:00
Maxime Coste
6ada6e6d77
Move all non-core string code to string_utils.{hh,cc}
2017-10-10 10:52:32 +08:00
Maxime Coste
ab6a999431
Rename containers.hh to ranges.hh (and Container to Range)
2017-08-29 15:23:03 +07:00
Maxime Coste
da227e48e9
Fix String::Data copying/moving from self
2017-08-23 18:13:42 +07:00
Maxime Coste
f41d78083a
Use the extra_word_chars option in word based normal commands
...
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-26 15:28:41 +01:00
Maxime Coste
4e7a357a47
Fix various undefined behaviours detected by UBSan
2017-06-26 11:27:18 +01:00
Maxime Coste
c6eddefb0d
Slight code refactoring and perf improvement in vector option to string
2017-06-24 12:24:24 +01:00
Maxime Coste
f0f2b1c383
Trim whitespaces surrounding docstrings
...
Closes #1439
2017-06-16 10:48:14 +01:00
Maxime Coste
1ccccbce04
Fix horrible leak in String::Data::operator=(String::Data&&)
...
And that, my friends, is why we recommend using standard containers
instead of rolling your own.
2016-11-23 01:09:09 +00:00
Maxime Coste
03dcfb2574
Small code tweak
2016-11-23 00:22:37 +00:00
Maxime Coste
ca0606017f
Small code refactoring
2016-11-22 23:51:09 +00:00
Maxime Coste
650a989c1e
Add to_string(long long int) overload to fix OSX compilation
2016-10-31 10:19:06 +00:00
Maxime Coste
249ec4835e
Rename get_width to codepoint_width
2016-10-01 13:45:00 +01:00
Maxime Coste
35559b65dd
Support codepoints of variable width
...
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-10-01 13:45:00 +01:00
Maxime Coste
e701254b02
Fix String::Data::reserve on big endian platforms, and document String::Data
...
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-28 19:06:25 +01:00
Maxime Coste
97e36233fb
Remove the to_string(unsigned) (it conflicts with to_string(size_t) on x86)
...
Just cast to int when we pass an unsigned.
2016-08-31 09:07:33 +01:00
Maxime Coste
2bf100bdd0
Add a to_string overload for unsigned int
2016-08-27 10:46:49 +01:00
Maxime Coste
7ac54b0b0f
Fix another bug in wrap_lines
2016-08-26 00:08:34 +01:00
Maxime Coste
b8908f2dc6
Add a String::resize method
2016-06-19 17:01:27 +01:00
Maxime Coste
61c155fc40
Fix wrap_lines
2016-04-27 13:55:32 +01:00
Maxime Coste
ab5daeb365
Refactor wrap_lines and add some unit tests
2016-04-04 13:42:58 +01:00
Maxime Coste
e5afacba70
Optimize split implementation, avoid growing strings char by char
2016-03-24 23:25:58 +00:00
Maxime Coste
8bd3395d4d
Do not allow / in highlighter names as it is used for hierachies
...
/ are replaced with <slash> in the highlighter names.
Fixes #553
2016-02-13 12:59:27 +00:00
Maxime Coste
8d37a716fb
Use a custom SSO aware string backend
2016-02-10 09:44:42 +00:00
Maxime Coste
ec91ea17fe
Add a static const String::ms_empty empty string
2015-11-25 21:07:41 +00:00
Maxime Coste
784ab635ee
Splitting an empty string now returns an empty vector
2015-11-19 00:17:18 +00:00
Filip Szczepański
47e6eed7c9
Add Haiku support.
2015-09-24 22:36:29 +00:00
Maxime Coste
27571a7716
Refactor utf8::iterator to be on the safe side
...
utf8::iterator now knows the iterator valid range, and pass
it to utf8 functions.
2015-09-23 19:39:21 +01:00
Maxime Coste
459d0baf79
Tweak string unit tests
2015-09-20 17:18:43 +01:00
Maxime Coste
ca2043d9f2
Fix unescape implementation
2015-09-20 11:47:20 +01:00
Maxime Coste
29b508a894
Avoid wrapping lines with negative max width
2015-09-07 23:29:01 +01:00
Maxime Coste
a33c8d9677
Smaller sizeof for in place strings
2015-08-18 21:06:53 +01:00
Maxime Coste
d2b82f507f
More performant escape/unescape
2015-08-13 22:04:21 +01:00
Maxime Coste
f87dbe410f
Add missing support for Codepoint in format
2015-07-14 13:47:51 +01:00
Maxime Coste
6870895374
Add support for hex formatting
2015-06-22 13:56:00 +01:00
Maxime Coste
6d23bb056a
Fix wrong exception type in str_to_int
2015-06-19 18:29:58 +01:00
Maxime Coste
dd25dcc361
Move unit test functions in next to the code they are testing
2015-05-22 13:58:56 +01:00
Maxime Coste
d7159a9af0
Add str_to_int_ifp that returns an Optional<int> instead of throwing
2015-05-01 18:47:22 +01:00
Maxime Coste
f6c7948c12
Add format_to allowing formating to an existing buffer
2015-04-22 13:19:46 +01:00
Maxime Coste
4c49583fed
small code tweak in format
2015-03-31 13:55:57 +01:00
Maxime Coste
758bfe7284
number to string conversion avoids memory allocations
2015-03-31 13:53:40 +01:00
Maxime Coste
335c73a09b
Use custom implementation rather the sscanf in str_to_int
2015-03-30 23:37:55 +01:00
Maxime Coste
13a5af70ae
Add a format function for printf like formatting
2015-03-30 23:05:24 +01:00
Maxime Coste
8439059758
Fix wrong implicit conversions from int/Codepoint to StringView
2015-03-30 13:33:46 +01:00
Maxime Coste
82833608c9
Allocate some data in advance in string algorithm
2015-03-14 11:46:53 +00:00
Maxime Coste
762643d320
Use correct %zu format string rather than cast
2015-03-12 20:43:21 +00:00
Maxime Coste
ecabfc67b7
fix warning on 32 bit compilation
2015-03-11 20:52:17 +00:00