Commit Graph

60 Commits

Author SHA1 Message Date
Maxime Coste
e4a23a64fa Support opening files bigger than 2 GiB
The real technical limit is with lines bigger than 2 GiB and buffers
with more than 2 Gi lines, refactor buffer loading to make it possible
to load those files.

Fix an overflow with the hash_data function at the same time
2021-05-28 17:03:41 +10:00
Maxime Coste
3ae2a5c2f6 Fix performance issue with word completion
When pasting many words with <a-p> we can end-up with a huge
concatenated word and many selections, the previous code ended
up iterating from each selection cursor to that word start and
end to find the word under the cursor.

This could lead to performance issue as each selection would
trigger iteration on that huge word. This is unnecessary as
word completion has a word length limit, so we now take it into
account to avoid iterating to far from the cursor position.
2020-11-07 10:42:51 +11:00
Maxime Coste
b24be99fa3 Limit the amounts of calls to get_extra_word_chars
This is a relatively expensive function as it needs to resolve
an option, which uses dynamic_cast.
2019-08-31 13:14:46 +10:00
Maxime Coste
ad882c3370 Limit WordDB word length to 50 bytes
Should improve both performance and relevancy of the word completions.
2019-03-22 18:03:49 +11:00
Maxime Coste
346c78f5e0 Header and dependency cleanup 2019-01-24 21:22:20 +11:00
Maxime Coste
1553d91d27 Make '_' the default extra_word_chars, and remove built-in support
Fixes #2599
2018-11-27 18:16:21 +11:00
Maxime Coste
eef2ea5136 Lazily iterate over words instead of gathering them in a vector 2018-07-26 23:05:00 +10:00
Maxime Coste
54b62cbef7 Do not expose C++ typeid().name to user facing errors on wrong option type
Fixes #2079
2018-05-26 10:01:26 +10:00
Maxime Coste
f545ff7727 Move get_word_db to word_db.cc 2018-04-19 07:58:42 +10:00
Maxime Coste
71a1893a5e Fix some trailing spaces and a tab that sneaked into the code base 2018-04-05 08:52:33 +10: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
268c214f56 Change completion_extra_word_char to be a list of codepoints instead of a string 2017-06-26 14:39:17 +01:00
Maxime Coste
e44f95820e Fixes some clang-tidy warning and add a few missing meta.hh include 2017-03-16 23:34:02 +00:00
Maxime Coste
6373338c50 Replace uses of UnorderedMap with HashMap 2017-03-07 01:03:26 +00:00
Maxime Coste
55f6ca238f Refactor get_words to be simpler and faster 2017-02-23 00:51:54 +00:00
Maxime Coste
73bb260e6c Fix support for non ascii chars in completion_extra_word_char 2017-02-23 00:35:27 +00:00
Maxime Coste
a39f2b0c71 Refactor WordDB::add_words to be slightly faster 2017-02-23 00:26:24 +00:00
Maxime Coste
3f0415c765 Introduce the 'completion_extra_word_chars' option
This string option is used to get all the additional characters
that should be considered as "word" character for the purpose of
insert mode completion.

Fixes #758
2016-08-24 23:47:09 +01:00
Maxime Coste
f51ba6089c Use variadic macros for kak_assert to remove the need for COMMA 2016-05-17 19:39:55 +01:00
Maxime Coste
bff9d45bdb Make utf8_iterator codepoint type and difference type configurable 2016-05-09 21:56:08 +01:00
Maxime Coste
7dd05d675c RankedMatch constructor handles empty query just fine 2016-03-29 13:48:01 +01:00
Maxime Coste
c756f8f124 Move UsedLetters with RankedMatch 2016-03-25 20:38:27 +00:00
Maxime Coste
131b0a8298 Use ByteCoords directly for buffer insert/erase/replace 2016-03-16 13:59:30 +00:00
Maxime Coste
263ef0b149 Get rid of SharedString 2016-02-05 09:38:33 +00:00
Maxime Coste
ff6eacffa3 dont intern SharedStrings but StringDataPtr 2016-02-05 00:20:45 +00:00
Maxime Coste
89d22f3335 Move more logic into RankedMatch 2015-10-27 21:25:18 +00:00
Maxime Coste
c77cb7c777 Extract WordDB::RankedWord as RankedMatch in its own file 2015-10-22 19:49:08 +01:00
Maxime Coste
019b3235b0 Remove legacy WordDB::find_matching method 2015-10-21 20:16:36 +01:00
Maxime Coste
4f2584a091 Experiment with ranked word completion depending on word boundaries 2015-10-18 16:55:21 +01:00
Maxime Coste
fe704b9b84 Move line parsing and to Buffer.cc directly 2015-10-17 11:33:09 +01: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
dd25dcc361 Move unit test functions in next to the code they are testing 2015-05-22 13:58:56 +01:00
Maxime Coste
a0cf75ec39 Tweak WordDB implementation 2015-03-10 13:50:25 +00:00
Maxime Coste
87125e2707 Fix too strict assert and unneeded (lets hope) check 2015-02-03 23:39:04 +00:00
Maxime Coste
0b4ecef2d2 Rewrite line modifications, hopefully with easier to comprehend code 2015-01-31 23:50:24 +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
b1281d225d rename SharedString::Storage to StringStorage and use directly in Buffer 2015-01-19 19:31:56 +00:00
Maxime Coste
4fd92127c3 Add a no copy shared string constructor, used for map lookup, and intern words 2015-01-15 19:58:08 +00:00
Maxime Coste
8eef019cf8 Do not store lines to word in word db, just keep the old lines alive 2015-01-15 19:26:38 +00:00
Maxime Coste
76d806e98d Replace InternedStrings with SharedString, shared_ptr based 2015-01-15 19:26:38 +00:00
Maxime Coste
dedb16bc73 Track some more memory 2015-01-11 19:28:03 +00:00
Maxime Coste
79de7ee717 Code refactoring in WordDB 2014-12-23 19:32:42 +00:00
Maxime Coste
ff1f4dcb5c Minor cleanup 2014-12-22 20:08:53 +00:00
Maxime Coste
35e7a67c6a Do not sort results of WordDB, simplify code 2014-12-11 13:14:57 +00:00
Maxime Coste
fa886ffaac Refactor word_db, use an unordered map 2014-10-28 19:23:02 +00: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
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
5fc063c520 Insert word completion: Use subsequence matching if prefix failed 2014-07-30 19:58:34 +01:00
Maxime Coste
ed68d1ff28 utf8: use end of sequence iterators for more security 2014-07-05 12:10:06 +01:00
Maxime Coste
5b27b956ad Rename utf8::utf8_iterator to utf8::iterator 2014-06-24 19:10:57 +01:00