Commit Graph

96 Commits

Author SHA1 Message Date
aver-d
29a7cd3ab4 Insert complete: Remove path info with one buffer
This change is useful when using `set scope completers word=buffer`,
instead of the default word=all.

If candidates all come from the same buffer, then the path/filename
information is the same and therefore unnecessary. This change
prevents the same path from being repeated, and the buffer's
source code is less obscured.

More generally, there could be an option to disable the path
information entirely in all cases, but for now this change seems
a reasonable solution until any such option exists.
2018-01-25 17:49:02 +00:00
Maxime Coste
9b83589b18 Completion: Use a heap to gather the best matches instead of sorting
Generalize the behaviour of `shell-candidates` to insert completion,
gather the best 100 matches by using a heap and poping max a hundred
times.
2017-12-21 12:55:29 +11:00
Maxime Coste
0033491d69 InsertCompleter: Respected ignored_filename option in filename completer 2017-12-09 22:03:19 +11:00
Maxime Coste
70e2122ae6 InsertCompleter: only accept words matching the target buffer word definition
The words we store in the WordDB are dependent on the extra_word_chars
options, which can be different for different buffers. When completing
words in a buffer based on the WordDB from another buffer, some candidates
might contains characters that are not considered word character for
the target buffer, ignore those words.
2017-12-06 14:15:36 +08:00
Maxime Coste
ec6ecd5772 Add an InsertCompletionSelect hook
InsertCompletionSelect will be called whenever the selected insert
completion changes. If the original text is selected back, the hook
parameter will be empty. If another candidate is selected, the hook
parameter will be its text content.

Fixes #1676
2017-11-25 13:57:47 +08:00
fsub
66ca53466f Remove unused lambda captures
This eliminates some warnings emitted by clang++.
2017-11-22 18:43:54 +01:00
Delapouite
d5b6669a83 Add distinct w (curr buf) / W (all buf) word completion for <c-x> 2017-10-24 22:47:43 +02:00
Delapouite
6bfc99bf08 Add 'line' in completers option as a way to force explicit <c-x>f 2017-10-02 18:45:11 +02: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
3612eb50e5 Fix bug in word completer
A bug could be triggered in the word completer when a multiselection
would trigger word completion with one selection being at buffer first
character.
2017-06-09 14:21:18 +01:00
Maxime Coste
64aa6f3fb4 Proper linear time insert completion insertion
The previous solution, ad9b090ddf, was
failing when completion was not replacing any text, as going through
SelectionList was not permitting to replace empty ranges.

Handle replacement as first a deletion then an insert to get fast
update, as having a list of forward deletions and then a list
for forwad insertion is much faster to update than a list of
interleaved delete/insert.
2017-06-09 14:13:43 +01:00
Maxime Coste
ad9b090ddf Fix quadratic behaviour in when selecting an insert completion
Use the fast, linear time SelectionList::insert algorithm instead of
an ad-hoc one that needs to call SelectionList::update after each
modification of the buffer.

Fixes #1417
2017-06-08 09:55:34 +01:00
Maxime Coste
b7982c6ee3 Use range based accumulate wrapper instead of std::accumulate 2017-06-07 13:36:47 +01:00
Maxime Coste
6373338c50 Replace uses of UnorderedMap with HashMap 2017-03-07 01:03:26 +00:00
Maxime Coste
e5e705e151 Fix clang warnings about uninitialized timestamp field
Closes #1241
2017-02-27 20:29:53 +00: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
192ea9a9d9 Fix explicit insert completion menu/info not hiding
Fixes #1168
2017-01-30 10:32:29 +00:00
Maxime Coste
753f3a50d1 Make StringView and unit types trivial types 2017-01-29 13:49:45 +00:00
Maxime Coste
dcd8f6ef01 Apply clang-tidy modernize to the codebase 2017-01-08 22:39:01 +00:00
Maxime Coste
4d538fb423 Only hide menu/info if the insert completer did display it
Avoid hiding info boxes opened by other places in the code.
2016-12-04 13:37:33 +00:00
Maxime Coste
bc8c5522e2 Change ValueId to just be an enum class, it does not need any operators 2016-12-03 13:17:42 +00:00
Maxime Coste
2fd1414b05 Clean up includes of user_interface.hh 2016-11-29 19:53:11 +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
532e3758fe Add InsertCompletionShow/InsertCompletionHide hooks 2016-09-21 13:43:06 +01: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
365887539b Reject '//' as a file completion prefix to avoid cygwin network hosts listing 2016-05-19 21:46:27 +01:00
Maxime Coste
c51ca6b3fa Fix is_word ambiguous overload 2016-04-09 07:57:55 +01:00
Maxime Coste
0a863c21e4 fix word completion taking the words being edited as candidates 2016-04-09 01:03:24 +01:00
Maxime Coste
a36ee22760 Pass the selection list to insert mode completer functions 2016-04-09 01:03:24 +01:00
Maxime Coste
b5a68307ba Use a specific option type completions for insert completion
Fix escaping in jedi.kak as well
2016-04-04 13:42:58 +01:00
Maxime Coste
131b0a8298 Use ByteCoords directly for buffer insert/erase/replace 2016-03-16 13:59:30 +00:00
Maxime Coste
b53f1271a2 Support ~/ in insert mode filename completion 2016-03-14 13:59:54 +00:00
Maxime Coste
7ecd65e1af Code cleanups 2016-03-14 13:41:20 +00:00
Maxime Coste
06c1c5f28b Do not include the debug buffer in word completion 2016-03-12 16:44:55 +00:00
Maxime Coste
548e10597c Code cleanup 2016-02-28 18:30:35 +00:00
Maxime Coste
3987463e75 Remove direct access to ui, go through client
Client can now update menu/info positions when the window move
around.
2016-02-27 17:23:13 +00:00
Maxime Coste
c9f01e2168 Hide info box when selecting empty insert completion 2016-02-17 23:03:22 +00:00
Maxime Coste
a8eddd03f0 String usage cleanups 2016-02-04 23:54:22 +00:00
Maxime Coste
e938040e35 Cleanup InsertCompleter get rid of unneeded candidate vector copy 2015-12-28 00:18:38 +00:00
Maxime Coste
c39a4d5879 Add a static_words str-list option always considered for word completion
Fixes #313
2015-12-27 08:53:31 +00:00
Maxime Coste
2bf44b6b49 Make word insert completion work better with unicode char 2015-10-30 13:57:46 +00:00
Maxime Coste
f556ef12c4 Fix preservation of entered text in option insert completer 2015-10-30 13:08:07 +00:00
Maxime Coste
34d7bdbc01 Minor code cleanup in insert_completer.cc 2015-10-30 13:07:48 +00:00
Maxime Coste
32b51e2cc3 Use ranked matches for option completion as well 2015-10-29 13:57:50 +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
2bf391f36d Sort insert completer words by name favoring lower case and then stable sort by rank 2015-10-20 13:50:55 +01:00
Maxime Coste
9449f763e0 Fix removal of duplicated words in insert completion 2015-10-19 19:39:05 +01:00
Maxime Coste
73e438be07 Fix handling of explicit insert completers 2015-10-19 13:43:23 +01:00