Commit Graph

31 Commits

Author SHA1 Message Date
Maxime Coste
6fce8050ee Use BufferCoord sentinel type for regex matching on BufferIterators
BufferIterators are large-ish, and need to check the buffer pointer
on comparison. Checking against a coord is just a 64 bit comparison.
2018-11-01 21:51:10 +11:00
Maxime Coste
9fec1b3faf Buffer: Remove m_line_count field from BufferIterator
It seems unlikely this would give performance gain, as buffer
lines are always accessed when we read that field, leading to
all the necessary data already being in memory. Removing it
reduces the size of a BufferIterator, which are already pretty
hefty objects.
2018-10-30 23:18:41 +11:00
Maxime Coste
208b28cbe7 Simplify a bit buffer iteration functions
Dont try to ensure the returned value is valid, incrementing past
the end/decrementing before begin is the caller's error.
2017-06-12 06:10:18 +01:00
Maxime Coste
63a791d651 Fix the Buffer::end() madness
Until now, buffer had multiple recognized end coordinates, either
{ line_count, 0 } or { line_count - 1, line[line_count - 1].length }.

Now the only correct end coord is { line_count, 0 }, removing the need
for various special cases.
2017-06-11 12:01:40 +01:00
Maxime Coste
cb6ef4afb6 noexept-ify BufferIterator methods 2017-06-07 10:58:01 +01:00
Maxime Coste
fe2d0fab71 Fix performance of word completion with many different selections
Fixes #1228
2017-02-20 19:28:02 +00: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
4ecdbea5c4 Make buffer iterator iteration/dereference faster 2016-07-15 19:48:13 +01:00
Maxime Coste
e01a658cea Make use of strongly typed number to size_t conversion 2016-04-27 09:46:53 +01:00
Maxime Coste
de033d2915 Allow equality comparison between buffer iterators from differnt buffers 2016-04-21 20:42:23 +01:00
Maxime Coste
90d446b2f4 It can happen during an undo/redo that the buffer be temporarily empty
Fix is_end in that case.
2016-03-09 23:16:14 +00:00
Maxime Coste
f8106690b1 Make BufferIterator::operator* return a const ref to be more compatible 2016-01-27 08:27:23 +00:00
Maxime Coste
80b1d88bb0 Fix Buffer::changes_since if we get passed an invalid timestamp 2015-12-12 23:50:01 +00:00
Maxime Coste
67d1b7dcd1 Faster BufferIterator::operator++/-- 2015-11-12 13:59:36 +00:00
Maxime Coste
7bd3f4306d Remove useless checks, buffer has always at list one line 2015-11-10 23:06:57 +00:00
Maxime Coste
6bb775241c Optimize BufferIterator to avoid a lot of pointer chasing 2015-11-07 16:55:48 +00:00
Maxime Coste
6273aa9443 Rework Buffer::distance implementation 2015-11-04 01:01:52 +00:00
Maxime Coste
26cfd6af9b Style tweak 2015-06-24 13:44:47 +01:00
Maxime Coste
1cec8df45e ArrayView content is not const anymore
As in upcoming std c++ array_view, ArrayView<T> points to mutable
data, use ArrayView<const T> or alias ConstArrayView<T> for const
data.
2015-03-09 13:54:09 +00:00
Maxime Coste
b480d6b419 Tweak BufferIterator::{+=,-=} implementation 2015-02-26 21:58:56 +00:00
Maxime Coste
295a97f2a6 Rename memoryview to ArrayView 2015-01-06 13:43:37 +00:00
Maxime Coste
d29419bcd6 Fix invalid memory access when applying modifications on an empty buffer
That can happen when undoing/redoing accross a buffer reload
boundary.
2014-10-28 21:55:08 +00:00
Maxime Coste
6ba3017a8e Always inline a few more methods 2014-08-17 15:36:12 +01:00
Maxime Coste
50abc18c8e Add some more force inlines to some buffer methods 2014-07-19 00:18:16 +01:00
Maxime Coste
b6b646e9a2 Remove use of 'offset' in buffer iterators, lines are just String
No need to maintain line offsets anymore.
2014-05-24 17:08:01 +01:00
Maxime Coste
03e5264df4 Remove per lines timestamp in Buffer 2014-05-17 12:17:05 +01:00
Maxime Coste
7bc73b7ef9 negative coordinates are invalid 2014-05-13 19:01:27 +01:00
Maxime Coste
a510276025 Maintain an append-only list of changes in Buffer 2014-05-12 19:03:13 +01:00
Maxime Coste
8546788b43 Refactor LineAndColumn coordinates
BufferCoord -> ByteCoord
DisplayCoord -> CharCoord

Moved their definition along with LineAndColumn into coord.hh
2014-05-07 19:53:45 +01:00
Maxime Coste
84c30c4b8a Minor formatting changes 2014-04-01 18:54:46 +01:00
Maxime Coste
3248829f5b rename buffer_iterator.inl.hh as buffer.inl.hh and inline some more methods 2014-01-12 17:19:05 +00:00