Maxime Coste
087a17eb24
Support for going backward/forward in buffer history with <a-u>/<a-U>
2016-07-24 21:25:05 +01:00
Maxime Coste
03a4b3c73f
Support counts for undo/redo
2016-07-24 21:25:05 +01:00
Maxime Coste
3edd2c127c
Support moving between arbitrary history nodes
2016-07-24 21:25:05 +01:00
Maxime Coste
b9c77e2f09
Store creation timepoint in HistoryNode
2016-07-24 21:25:05 +01:00
Maxime Coste
e391f93a9e
Set memory domains for Buffer::HistoryNode
2016-07-24 21:25:05 +01:00
Maxime Coste
2296b43299
Store buffer undo/redo information in a tree instead of a vector
2016-07-24 21:25:05 +01:00
Maxime Coste
003cb8dfea
Merge remote-tracking branch 'lenormf/readonly-mode'
2016-07-24 21:21:49 +01:00
Frank LENORMAND
8a4596bea9
Implement a readonly
mode
...
This commit introduces the `readonly` variable as well as the `-ro`
command line option which prevent buffers from being overwritten on
disk when the `write` command is used without arguments. Some buffers
can selectively be put in readonly mode by setting the `readonly`
variable on the `buffer` scope, the `global` mode will affect all
buffers (even those who will be open subsequently), using the `window`
scope will have no effect.
Closes #685
2016-07-23 10:03:21 +03:00
Maxime Coste
4ecdbea5c4
Make buffer iterator iteration/dereference faster
2016-07-15 19:48:13 +01:00
Maxime Coste
530ecf212e
Ensure buffer create/close hooks are run at appropriate times
...
They used to be ran before the buffer was added to the buffer list
we now run them afterwards.
2016-07-10 16:34:16 +01:00
Maxime Coste
a22b1b6bc8
Fix BufferIterator::difference_type, it should be signed
2016-04-21 20:42:16 +01:00
Maxime Coste
131b0a8298
Use ByteCoords directly for buffer insert/erase/replace
2016-03-16 13:59:30 +00:00
Maxime Coste
de1433d30a
Avoid the spurious newline insertion when replacing at end of buffer
...
Add a Buffer::replace method to handle the replacements properly
Fixes #633
2016-03-16 13:48:11 +00:00
Maxime Coste
06c1c5f28b
Do not include the debug buffer in word completion
2016-03-12 16:44:55 +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
966ac90fe7
Change eolformat and BOM options to be enums instead of strings
2015-12-06 12:51:55 +00:00
Maxime Coste
7335065d20
Update buffer display names after changing working directory
...
Fixes #501
2015-12-01 13:42:42 +00:00
Maxime Coste
67d1b7dcd1
Faster BufferIterator::operator++/--
2015-11-12 13:59:36 +00:00
Maxime Coste
6bb775241c
Optimize BufferIterator to avoid a lot of pointer chasing
2015-11-07 16:55:48 +00:00
Maxime Coste
04c8334c98
Avoid useless StringDataPtr copy
2015-11-07 16:55:20 +00:00
Maxime Coste
719997f0ab
Do not tag BufferIterator as random access
...
Boost regex considers that random access means fast distance
computation, which is not the case for BufferIterator where
Buffer::distance is O(num lines between them) which can get
big on large files.
Fixes #462
2015-11-04 01:01:52 +00:00
Maxime Coste
fe704b9b84
Move line parsing and to Buffer.cc directly
2015-10-17 11:33:09 +01:00
Maxime Coste
e2720f1fbe
Store timespec for buffer fs timestamps, not just time_t
...
time_t has a resolution of one second, which cause troubles when
a file changes multiple time during that same second.
2015-09-27 11:55:34 +01:00
Maxime Coste
e9d7d70e47
Cache buffer display name
2015-09-01 20:49:47 +01:00
Maxime Coste
6b06d77490
Small formatting fix
2015-07-27 20:43:18 +01:00
Maxime Coste
cc09c36fe0
Minor reorganisation in buffer.hh
2015-06-25 13:36:23 +01:00
Maxime Coste
95a14c5049
UndoGroupOptimizer disappeared long time ago
2015-04-18 14:17:17 +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
99996902de
Use a IdMap for storing hooks
...
The number of hook names is small (<20), using an UnorderedMap
is overkill, and prevents using StringView for key searching.
2015-03-05 14:59:27 +00:00
Maxime Coste
0eca3b5526
Use StringDataPtr alias for RefPtr<StringData>
2015-03-01 12:06:19 +00:00
Maxime Coste
98972c18b7
rename StringStorage to StringData
2015-03-01 12:03:08 +00:00
Maxime Coste
8df77121d7
Rename safe_ptr and ref_ptr to SafePtr and RefPtr
2015-02-19 13:58:25 +00:00
Maxime Coste
804a050c39
Tweak Buffer::Change layout
2015-01-29 22:44:07 +00:00
Maxime Coste
cc699faa54
Store direct ref_ptr<StringStorage> for WordDB lines
...
Storing a SharedString is a waste, we want the whole line.
2015-01-27 13:12:52 +00:00
Maxime Coste
cb197f57ba
Avoid temporary strings on buffer load/reload
...
Pass directly a Vector<ref_ptr<StringStorage>> to the buffer
2015-01-22 13:39:29 +00:00
Maxime Coste
b1281d225d
rename SharedString::Storage to StringStorage and use directly in Buffer
2015-01-19 19:31:56 +00:00
Maxime Coste
ef26b77aa7
buffer updates are in BufferMeta memory domain
2015-01-18 11:22:28 +00:00
Maxime Coste
76d806e98d
Replace InternedStrings with SharedString, shared_ptr based
2015-01-15 19:26:38 +00:00
Maxime Coste
da562e03a0
replace all std::vector with Vector
2015-01-12 13:58:41 +00:00
Maxime Coste
9adb97ea28
Track buffer lines memory
2015-01-10 12:56:09 +00:00
Maxime Coste
295a97f2a6
Rename memoryview to ArrayView
2015-01-06 13:43:37 +00:00
Maxime Coste
3a817e2f96
Cleanup includes
2014-11-12 21:27:07 +00:00
Maxime Coste
e38ba6ce3d
Add scope class and encapsulate Options, Keymaps, Aliases and Hooks in it
2014-10-30 14:04:57 +00:00
Maxime Coste
185b980718
Add scoped aliases
...
aliases are now stored in window, buffer, or globally.
2014-10-30 14:02:13 +00:00
Maxime Coste
3e797a3d15
centralize bit operation support for enum used as flags
2014-10-23 19:02:39 +01:00
Maxime Coste
fc4142178f
Port more code to StringView instead of const String&
2014-10-20 19:18:38 +01:00
Maxime Coste
b097bbbf52
WordDB: Use interned strings pointing directly into the buffer line data
2014-10-07 09:16:19 +01:00
Maxime Coste
d4a84125ef
Use InternedStrings for buffer contents
2014-10-03 13:39:13 +01:00
Maxime Coste
d55d041c6a
Add support for interned strings
...
Use interned strings for Modification contents and word database.
Interned strings are guaranteed not to move in memory and are
reference counted.
2014-10-01 00:20:12 +01:00
Maxime Coste
e440adbcf4
add a 'buffers' debug command to get info on alive buffers
2014-09-22 19:19:34 +01:00
Maxime Coste
5092494427
Add support for target column preservation
...
Fixes #64
2014-09-09 19:42:57 +01:00
Maxime Coste
d356ae2419
Make safe_ptr able to track callstacks
...
The code stays disabled, as the performance penalty is quite
high, but can be enabled to help debugging safe pointers.
2014-08-12 19:18:10 +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
c3f4ef9ba2
Remove BufferChangeListener
2014-05-14 19:49:04 +01:00
Maxime Coste
67a251ffd5
Pass a at_end param to BufferChangeListener::on_{insert,erase}
2014-05-13 19:01:27 +01:00
Maxime Coste
ddd8f8d392
LineChangeWatcher uses Buffer::changes_since rather than listening
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
05b79921a9
Minor code cleanups in buffer.{cc,hh}
2014-05-10 16:25:07 +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
33de42610d
Add g. command to go to the last buffer modification position
2014-04-07 23:47:50 +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
Maxime Coste
b247a05e43
Buffer: maintain a per line timestamp
2014-01-09 22:51:50 +00:00
Maxime Coste
85387b3efe
Buffers can hold arbitrary values for for other systems
2014-01-09 21:01:29 +00:00
Maxime Coste
e6884f989c
Style changes, replace typedefs with usings
2014-01-09 19:59:26 +00:00
Maxime Coste
c0973075fa
Get rid of Editor for good
...
ClientManager now stores only the free windows, clients take
ownership of its own.
2013-12-20 20:14:57 +00:00
Maxime Coste
9b6639eb27
Remove Editor::move_selections
2013-12-15 14:14:52 +00:00
Maxime Coste
1b1031627c
Add Buffer::run_hook_in_own_context helper method
2013-12-11 13:57:10 +00:00
Maxime Coste
db5050fab0
Add BufSetOption hook support
2013-11-12 20:36:42 +00:00
Maxime Coste
2c09da50be
Add key mapping support
2013-10-25 00:30:46 +01:00
Maxime Coste
60dbec4949
Add Buffer::reload for reloading buffers without loosing options and hooks
2013-10-21 18:57:19 +01:00
Maxime Coste
44281c8fed
More robust Buffer filesystem timestamp handling
2013-10-17 18:47:09 +01:00
Maxime Coste
03c74b7a88
Detect file external modification and ask the user whether to reload or not
...
* Buffer now store a m_fs_timestamp field.
* Client in Normal mode checks current buffer file every 500 ms, or
each time it goes back to Normal mode.
2013-10-15 18:51:31 +01:00
Maxime Coste
a2577b4180
buffer: move Buffer::Flags operator as friends defined inside Buffer
2013-08-01 00:28:01 +02:00
Maxime Coste
3862b5cbb8
LineAndColumns: always pass by value
2013-07-26 01:50:09 +02:00
Maxime Coste
2a74b0e9e2
Buffer: insert and erase go back to taking iterators, and return iterators
2013-06-06 19:44:08 +02:00
Maxime Coste
bd504058d9
remove unused Buffer::char_at
2013-06-06 19:44:07 +02:00
Maxime Coste
70bf71e51f
remove Buffer:char_{distance,advance} use line access instead
2013-06-06 19:44:07 +02:00
Maxime Coste
580749a91d
Buffer: remove line_length and replace line_content with operator[]
2013-06-06 19:44:07 +02:00
Maxime Coste
6b667bc803
remove BufferIterator conversion to/from BufferCoord
2013-06-06 19:44:07 +02:00
Maxime Coste
777158e86d
remove BufferIterator::is_valid()
2013-06-04 18:56:28 +02:00
Maxime Coste
a23aa10797
remove BufferIterator::buffer()
2013-06-04 18:55:06 +02:00
Maxime Coste
9fb4d42408
remove BufferIterator::is_{begin,end}
2013-06-04 18:53:56 +02:00
Maxime Coste
51acd456cc
remove BufferIterator::{line,column}()
2013-06-04 18:53:28 +02:00
Maxime Coste
c4f9253634
Remove Buffer::iterator_at_line_{begin,end}, use iterator_at(line{,+1})
2013-06-04 14:21:07 +02:00
Maxime Coste
02b33c7d8f
Buffer: add methods for char access instead of byte access
2013-06-03 18:56:48 +02:00
Maxime Coste
3453ebbd52
BufferChangeListener: pass buffer to on_{inser,erase}
2013-06-01 00:48:46 +02:00
Maxime Coste
28e127a48a
remove avoid_eol parameter from Buffer::{iterator_at,clamp}
2013-05-30 14:23:25 +02:00
Maxime Coste
07c8379313
BufferIterator are Random Access iterators
2013-05-30 14:05:05 +02:00
Maxime Coste
d2df6a9f15
remove BufferIterator::clamp
2013-05-30 14:00:41 +02:00
Maxime Coste
ae947b456d
remove BufferIterator::offset
2013-05-30 13:59:38 +02:00
Maxime Coste
a07fde181a
Add Buffer::{next,prev,at}(BufferCoord) methods and use them in iterators
2013-05-30 13:59:38 +02:00
Maxime Coste
7f17644a6b
Buffer insert and erase takes coord rather than iterators
2013-05-30 13:59:38 +02:00
Maxime Coste
2902cc3275
BufferIterator convert implicitly to const BufferCoord&
2013-05-30 13:59:38 +02:00
Maxime Coste
d5b190369a
DisplayBuffer: use coords rather than iterators
2013-05-30 13:59:38 +02:00
Maxime Coste
6c290eff9a
Buffer::do_{erase,insert} takes coord parameters rather than iterators
...
BufferChangeListeners do as well use coord rather than iterators
2013-05-29 18:58:20 +02:00
Maxime Coste
f23f48172f
Buffer: add some method to work directly with coord instead of iterators
2013-05-29 18:58:20 +02:00
Maxime Coste
7ce3212fb2
When committing an undo group, run an optimization pass on it
...
With incremntal insertion, undo groups tends to be a lot of single
character insertion/deletions at the same point, but the end
result is most of the time a single string insertion. Buffer
now tries to optimize the undo group.
2013-04-26 18:48:31 +02:00