Commit Graph

2240 Commits

Author SHA1 Message Date
Maxime Coste
7aa78d726a fix potential infinite loop in show_matching highlighter 2014-06-27 21:10:09 +01:00
Maxime Coste
63878b03c5 Style fixes 2014-06-26 19:01:39 +01:00
Maxime Coste
047488a8da Fix recursive string parsing, correct handling of escapes 2014-06-26 18:59:41 +01:00
Maxime Coste
5b27b956ad Rename utf8::utf8_iterator to utf8::iterator 2014-06-24 19:10:57 +01:00
Maxime Coste
b934c8ede5 Fix crash in Context::main_sel_register_value 2014-06-23 13:16:51 +01:00
Maxime Coste
df4983b6d4 Do not try to reload buffer if the buffer was deleted
Fixes #121
2014-06-22 11:09:44 +01:00
Maxime Coste
b89b7c754f Add \ in normal mode to disable user hooks on next normal command
Fixes #112
2014-06-21 22:06:02 +01:00
Maxime Coste
edd883ad18 Only user hooks can be disabled 2014-06-21 12:08:19 +01:00
Maxime Coste
7235180614 Use main selection index as default when accessing only one register value
Fixes #117
2014-06-21 11:31:08 +01:00
Maxime Coste
e202b7af50 Add a line_option highlighter that highlight the line stored in an int option
Use it to highlight the current error in the *make* buffer
2014-06-18 20:50:39 +01:00
Maxime Coste
6f2569ff30 Color Default now means 'keep as is' for most highlighters 2014-06-18 20:33:23 +01:00
Maxime Coste
54590f5d79 Minor code cleanup in highlighters 2014-06-18 20:31:49 +01:00
Maxime Coste
1c69764774 Merge branch 'master' into hierarchical-highlighters 2014-06-18 20:20:58 +01:00
Maxime Coste
9aa8c8a60a Add a %val{...} expand type
%val{name} gives access to values given in shell through $kak_<name>
2014-06-18 19:32:13 +01:00
Maxime Coste
b8a205b858 Use -group rather than -id in hooks to mirror highlighters closer 2014-06-16 20:42:12 +01:00
Maxime Coste
3ef5bf53d5 Add BufCloseFifo hook and use that to remove fifo directories 2014-06-16 19:50:20 +01:00
Maxime Coste
fc6a16a571 Fix corner cases in region highlighting 2014-06-16 19:41:07 +01:00
Maxime Coste
51da452dc4 Merge branch 'master' into hierarchical-highlighters 2014-06-16 01:06:09 +01:00
Maxime Coste
e78fd2d235 Do not merge overlapping selection when entering append mode
Fixes #163
2014-06-16 01:05:38 +01:00
Maxime Coste
2acfe85281 Highlight selection cursors in a second pass
This allows cursors to overlap on next selection and still be
visible.
2014-06-16 00:59:05 +01:00
Maxime Coste
c87e81e8de Use zstr instead of c_str in ncurses addutf8str 2014-06-16 00:53:25 +01:00
Maxime Coste
b5f5610cbe Share implementation in complete_id/complete_group_id 2014-06-16 00:49:39 +01:00
Maxime Coste
205e8b2889 Refactor highlighter command completions 2014-06-15 16:04:38 +01:00
Maxime Coste
89d30cbb21 Fix selection update 2014-06-14 14:07:42 +01:00
Maxime Coste
fa5b6b716d Fix crash in paragraph selection 2014-06-14 14:07:21 +01:00
Maxime Coste
e0cd8ad93c Fix crash in paragraph selection 2014-06-14 14:07:03 +01:00
Maxime Coste
9130f0334b Remove defhl, use addhl -group 2014-06-12 22:35:40 +01:00
Maxime Coste
af750ce186 Fix selection update 2014-06-12 21:23:49 +01:00
Maxime Coste
346de52633 add postfix increment to ParameterParser iterator 2014-06-12 20:03:17 +01:00
Maxime Coste
dac5e89e14 Add MultiRegionHighlighter
MultiRegionHighlighter provides a way to segment the buffer in
logical regions using the common left-most rule for finding the
next region. It then provides highlighting groups for each region
that can be filled.
2014-06-11 23:29:23 +01:00
Maxime Coste
0faf7ff5e6 Refactor region highlighter, extract code to helper classes 2014-06-11 23:29:15 +01:00
Alex Leferry 2
d5b1605df5 add ' ' for whitespaces object 2014-06-11 20:48:38 +01:00
Maxime Coste
0a76fe3040 Add support for recursion in region highlighter
An optional parameter defines the recursion regex, that match
potential closers.

For example, %sh{ ... } blocks support nested { }, so defining \{
as the recurse regex make the region highlighter correctly match
%sh{ ... { ... } ... } constructs
2014-06-11 00:23:44 +01:00
Maxime Coste
37d66b1e0b Convert Region highlighter to a HierarchicalHighlighter
add a region using addhl region <id> <begin_regex> <end_regex>
then fill the region with addhl -group <id>/content ...
2014-06-10 22:02:42 +01:00
Maxime Coste
4c942c4a3a ref highlighter tolerates unexisting reference 2014-06-10 22:02:08 +01:00
Maxime Coste
ca93ae807d Add a fill highlighter that just fills the display buffer 2014-06-10 21:46:16 +01:00
Maxime Coste
4bb62d63e6 Add HierachicalHighlighter class
HierachicalHighlighter contains a map of names to HighlighterGroup
and can wrap any highlighter that wants to access user settable
sub groups.
2014-06-10 21:35:03 +01:00
Maxime Coste
479c31b571 Replace FunctionGroup template with HighlighterGroup class 2014-06-10 19:58:02 +01:00
Maxime Coste
e6a9780490 Fix tabs-to-spaces an spaces-to-tabs with the selection refactor 2014-06-10 13:30:37 +01:00
Maxime Coste
5245f0073c Refactor InputMode::Insert::prepare 2014-06-09 23:23:49 +01:00
Maxime Coste
f54f8818c6 Merge branch 'master' into remove-buffer-change-listener 2014-06-09 19:29:40 +01:00
Maxime Coste
4834504508 Do not touch the reference line in copy_indent 2014-06-09 19:27:57 +01:00
Maxime Coste
cf2609de1c Tweak prompt completion behaviour
Always select the common prefix if we just updated the list of
completions. The previous behaviour was to ignore it if we had
it already typed. Do that only if it was already displayed.
2014-06-09 13:47:37 +01:00
Maxime Coste
052d877ee6 Safer implementation of signal handlers in ncurses.cc
On recent ncurses implementation on cygwin, the old method provoked
freezes. Avoid calling ncurses functions in signal handlers.

We still call an unsafe function (EventManager::force_signal)...
2014-06-09 13:47:36 +01:00
Maxime Coste
732d1c3bd1 Improve commands documentation 2014-06-06 13:58:35 +01:00
Maxime Coste
be8f875b4f Remove -env-var-params support in :def command
It is not used
2014-06-06 13:57:23 +01:00
Maxime Coste
d33554a1cc Add support for long names for registers
We can now access register / with the name slash, * with star,
and | with pipe

Fixes #23
2014-06-06 00:49:36 +01:00
Maxime Coste
1ffafa8650 Merge branch 'master' into remove-buffer-change-listener 2014-06-06 00:22:46 +01:00
Maxime Coste
2d5c730441 Replace CommandManager::register_command*s* with register_alias 2014-06-06 00:21:12 +01:00
Maxime Coste
ffd860c1da Use a id_map implementation for SwitchMap
That way parameter definition order is respected when writing
command doc strings.
2014-06-06 00:21:09 +01:00
Maxime Coste
c28a61187b Fix handling of empty insert 2014-06-05 19:44:56 +01:00
Maxime Coste
26f69b199e Rework and fix corner cases in selection updating code 2014-06-05 19:44:56 +01:00
Maxime Coste
1533a28394 Properly handle unicode in key parsing
Fixes #139
2014-06-05 19:42:27 +01:00
Maxime Coste
f7e89bc9f8 Fix selection updating, avoid overlapping selections 2014-06-02 17:36:46 +01:00
Maxime Coste
8d9ed5e8c7 Fix in region highlighter 2014-06-02 15:42:03 +01:00
Maxime Coste
c8354588c9 Remove undo group optimizer 2014-06-02 15:17:56 +01:00
Maxime Coste
d33c27acdf Move compute_modified_ranges to selection.cc and use an optimized approach 2014-06-02 15:13:56 +01:00
Maxime Coste
23a1914d7e Optimize SelectionList::update in the case where changes are backward
This case arise on undo, reverse sorted changes that are not overlapping.
2014-06-02 02:16:19 +01:00
Maxime Coste
a5e028e1b1 Add Context::set_selections(std::vector<Selection>)
This methods avoids updating the context selection needlessly as
they are going to get replaced anyway.
2014-06-01 16:01:38 +01:00
Maxime Coste
1b30c0f4fb Extract merge_overlapping as a free function template 2014-06-01 15:57:12 +01:00
Maxime Coste
5bcb55b6dd minor cleanups in insert_completer.cc 2014-05-31 18:18:29 +01:00
Maxime Coste
cf03cc97ef formatting fix 2014-05-31 18:12:54 +01:00
Maxime Coste
9006b31472 remove reverse iterator from SelectionList 2014-05-31 11:56:48 +01:00
Maxime Coste
49ab0c101a Use forward iteration on selections, and take advantage of it when updating
SelectionList::update now is optimized for the common case where changes
are sorted, the algorithm is O(m*n) with m the number of sorted ranges
in the changes. In the common case, m should be very small.
2014-05-29 05:48:40 +01:00
Maxime Coste
72d6ed3575 Add 'n' for number object (inner number does not recognise '.') 2014-05-27 09:50:12 +01:00
Maxime Coste
e1c9e42213 Merge branch 'master' into remove-buffer-change-listener
Conflicts:
	src/normal.cc
	src/selectors.cc
	src/selectors.hh
2014-05-27 00:35:12 +01:00
Maxime Coste
9aa38a1ea0 Rename select_whole_.* to just select_.* 2014-05-26 21:44:57 +01:00
Maxime Coste
c1a7759e7f Tweak inner indent object code
Inner indent is now the set of lines whose indent is >= current
line indent, triming lines containing only whitespaces at start
and end.

Fixes #140
2014-05-26 21:41:51 +01:00
Maxime Coste
9870ac22f6 Remove Modification
Lets consider that as a failed experiment.

You see, I learned something today, for a complicated problem, it
is important to keep as much knowledge of the exact problem as
possible. the Modification approach failed because it tried to
solve the general problem, which is quite complex. The new approach,
which keeps the knowledge that selections are sorted is much simpler
and faster (see f49bec8021).
2014-05-26 21:09:12 +01:00
Maxime Coste
ce469398c5 Revert "Use Modification for region highlighter"
This reverts commit aa64851de6.

Conflicts:
	src/highlighters.cc
2014-05-26 21:02:09 +01:00
Maxime Coste
19a5ed05a6 Revert "update Modification for WordDB"
This reverts commit 8f45623f98.

Conflicts:
	src/word_db.cc
2014-05-26 21:02:08 +01:00
Maxime Coste
fed2094e89 Revert "Remove line modification, replaced by modification"
This reverts commit a7540962cc.
2014-05-26 20:59:08 +01:00
Maxime Coste
f49bec8021 Go back to Buffer::Change based implementation for SelectionList::update
However take into account the ordering of selections in insert and erase
methods, so that we update selection position cheaply.
2014-05-26 20:57:10 +01:00
Maxime Coste
51eae8026b Use SelectionList::insert in InputModes::Insert 2014-05-25 22:59:29 +01:00
Maxime Coste
b2621ca140 Move insert/erase methods from normal.cc to member functions in SelectionList
It does look like the Editor class is attempting a sneaky comeback...
2014-05-25 20:28:32 +01:00
Maxime Coste
0a060b62a2 Merge branch 'master' into remove-buffer-change-listener 2014-05-25 20:01:55 +01:00
Maxime Coste
bf50a1c191 In normal mode, backspace can be used to edit count
Fix #125
2014-05-25 19:14:44 +01:00
Maxime Coste
1498fa9e4a Add kak_selections_desc en vars, containing : separated descs
descs are now <line>.<column>+<len>
Fixes #144
2014-05-25 18:27:51 +01:00
Maxime Coste
811f1c2d76 Rename Key::Erase to Key::Delete and add 'del' keyname
Fixes #145
Fixes #146
2014-05-25 17:41:28 +01:00
Maxime Coste
fe70add4b7 Disable 'interactive' options in :exec/:eval
Incremental search, automatic info and completion are
not needed in non interactive context.
2014-05-25 17:36:12 +01:00
Maxime Coste
fc0700d1fd Fix segfault in region highlighter 2014-05-24 17:17:14 +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
95200d1de1 Avoid buffer end line in word_db update 2014-05-24 14:10:27 +01:00
Maxime Coste
0aa5c4e779 Still more fixes for Modification 2014-05-24 13:15:59 +01:00
Maxime Coste
a6de024c1f Fix Modification 2014-05-24 02:35:08 +01:00
Maxime Coste
1544a006c9 Fix selection update in when doing a 'replace' insert 2014-05-24 02:14:51 +01:00
Maxime Coste
eba98ecad4 Clamp modified coord in Selection as it could be buffer end 2014-05-24 02:14:51 +01:00
Maxime Coste
695c85f451 Fix, cleanup and refactor compute_modifications 2014-05-24 02:14:28 +01:00
Maxime Coste
f08966197e Change # register to contain selection number
Using <c-r># in insert will allow easy numbering
2014-05-23 20:27:35 +01:00
Maxime Coste
a7540962cc Remove line modification, replaced by modification 2014-05-21 23:35:11 +01:00
Maxime Coste
aa64851de6 Use Modification for region highlighter 2014-05-21 23:35:11 +01:00
Maxime Coste
8f45623f98 update Modification for WordDB 2014-05-21 23:35:11 +01:00
Maxime Coste
2c52b8bca6 Add initial (and probably buggy) compute_modifications code
compute_modifications compiles a list of buffer change into
a list of Modifications that can be used for updating BufferCoord
2014-05-21 23:35:10 +01:00
Maxime Coste
152e46a6da Make utif_iterator more tolerant to invalid utf8 2014-05-21 00:25:24 +01:00
Maxime Coste
55959f2cb1 Make expand_unprintable more tolerant to invalid utf8 2014-05-21 00:24:58 +01:00
Maxime Coste
b29cae4d16 Remove duplicated logic and fix insert in Replace mode 2014-05-19 18:59:14 +01:00
Maxime Coste
2bb2c467b6 Fix filename/colalias/buffer completion when completing with trailing text 2014-05-18 14:14:37 +01:00
Maxime Coste
03e5264df4 Remove per lines timestamp in Buffer 2014-05-17 12:17:05 +01:00
Maxime Coste
079d34b82a Minor cleanup in SelectionList methods 2014-05-17 12:13:49 +01:00
Maxime Coste
211b78f536 Merge branch 'master' into remove-buffer-change-listener
Conflicts:
	src/highlighters.cc
2014-05-17 11:39:56 +01:00
Maxime Coste
9240cccf74 set Coords/Counts methods as always_inline
They are well tested, and we never want to step into them when debugging
2014-05-17 10:17:28 +01:00
Maxime Coste
c21368cac5 DisplayAtom::content returns a StringView 2014-05-16 19:29:39 +01:00
Maxime Coste
aa48179131 read all available text in fifo each time the fd is signaled 2014-05-15 19:11:59 +01:00
Maxime Coste
2f1388df7b replace LineChangeWatcher with a free function compute_line_modifications 2014-05-14 21:19:19 +01:00
Maxime Coste
0ec0f7c320 Remove unneeded vector for computing line modifications 2014-05-14 21:10:55 +01:00
Maxime Coste
4e280977a2 Iterate in reversed order on selections when modifing buffer
This way, update only needs to be called once everything is done
as we always modify after the next selection to be used.
2014-05-14 20:56:49 +01:00
Maxime Coste
c3f4ef9ba2 Remove BufferChangeListener 2014-05-14 19:49:04 +01:00
Maxime Coste
bf98b38afd Use a plain SelectionList for Context, remove DynamicSelectionList 2014-05-14 19:49:04 +01:00
Maxime Coste
db423e4a88 utf8::is_character_start takes directly the char value 2014-05-14 19:49:03 +01:00
Maxime Coste
34e1c2ddd5 Fix RegexColorizer cache handling 2014-05-14 19:22:42 +01:00
Maxime Coste
fbf7856e3e use plain SelectionList for regex_prompt 2014-05-14 00:27:41 +01:00
Maxime Coste
11d9b60766 Make it harder to have an invalid SelectionList 2014-05-13 23:22:54 +01:00
Maxime Coste
a06094b00e Use simple SelectionList for the Context::JumpList 2014-05-13 20:09:37 +01:00
Maxime Coste
ea3e92aa5e SelectionList know its buffer and timestamp 2014-05-13 20:09:06 +01:00
Maxime Coste
855357ee73 Fix :delbuf! not forcing buffer deletion
Fixes #116
2014-05-13 19:48:16 +01:00
Maxime Coste
016ede38d1 Fix show_matching highlighter when opening char is the first buffer char
Fixes #119
2014-05-13 19:45:32 +01:00
Maxime Coste
6b42c48c3f Refactor DynamicRegexHighlighter, search hl uses Search colalias
fixes #122
2014-05-13 19:35:28 +01:00
Maxime Coste
7bc73b7ef9 negative coordinates are invalid 2014-05-13 19:01:27 +01:00
Maxime Coste
8ab1f58594 Use a Buffer::changes_since based implementation for undo/redo 2014-05-13 19:01:27 +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
db8a4ca318 SelectionList no longer inherit from std::vector 2014-05-12 18:59:00 +01:00
Maxime Coste
5e47c503d9 use words=all rather than words=buffer for default insert word completion 2014-05-11 12:53:08 +01:00
Maxime Coste
daac1698d6 use StringView in word_db.cc 2014-05-11 12:51:37 +01:00
Maxime Coste
f4d338e605 String::substr now returns a StringView 2014-05-11 12:44:51 +01:00
Maxime Coste
05b79921a9 Minor code cleanups in buffer.{cc,hh} 2014-05-10 16:25:07 +01:00
Maxime Coste
c7d24ac7db Add a show_whitespaces highlighter 2014-05-09 13:50:12 +01:00
Maxime Coste
e4e609a35c Catch std::runtime_errors that can be thrown by regex_search
This handle the case where a regex matching gets too complex.
2014-05-08 19:33:14 +01:00
Maxime Coste
4010117c98 fix tabs_to_space on consecutive tabs 2014-05-08 19:30:10 +01:00
Maxime Coste
8356e44ad5 Improve error reporting when parsing commands
*debug* will contain line and column informations along
with the responsible command name.
2014-05-07 20:39:59 +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
24f6471431 Add '$' for keeping selections that passes a shell command
'$' pipes each selections through a given shell command, and
only keeps the one that have an exit code of 0

Fixes #36
2014-05-05 18:09:03 +01:00
Maxime Coste
e6bda60ca4 Use c++ code for 'gf' command rather than running a user :edit command 2014-05-05 13:09:59 +01:00
Maxime Coste
dfb1246697 Complete option values with the current value of the option
Fixes #32
2014-05-05 12:55:04 +01:00
Maxime Coste
36620f8cc8 Wrap command completion containing spaces, semicolons or quotes in double quotes 2014-05-05 12:54:23 +01:00
Maxime Coste
7f0e82dd81 minor style tweak 2014-05-04 11:48:39 +01:00
Maxime Coste
e92e6c775a Paragraph selection selects next paragraph when on previous end 2014-05-04 11:21:19 +01:00
Maxime Coste
8cc9454438 Add a -alias switch to the def command for defining an alias
Fixes #100
2014-05-03 16:00:10 +01:00
Maxime Coste
5db3b51843 Add command aliases in command info
Fixes #101
2014-05-03 16:00:03 +01:00
Maxime Coste
e83123de1f Add support for non-scrolling fifo buffers 2014-05-02 18:58:04 +01:00
Maxime Coste
26dd21706e Replace some typedefs with usings 2014-05-01 19:03:13 +01:00
Maxime Coste
67559daead file.cc: try more portable use of struct stat::st_mtime 2014-04-30 23:03:42 +01:00
Maxime Coste
3efeb67861 Fix Option destructor that was not virtual 2014-04-30 19:40:23 +01:00
Maxime Coste
4d45fa6588 Use StringView in UserInterface and NCursesUI 2014-04-30 19:39:52 +01:00
Maxime Coste
bd4df27f2b Use StringView in write_debug 2014-04-30 19:27:38 +01:00
Maxime Coste
c06f986a02 Add unistd.h to main, needed for dup 2014-04-30 19:08:06 +01:00
Maxime Coste
144a35be30 Fix clang compilation 2014-04-30 19:07:32 +01:00
Maxime Coste
b1ba7fc4d2 Fix word completion that replaced the whole current word
Only replace up to the cursor.
2014-04-29 23:48:46 +01:00
Maxime Coste
479c067a40 Add support for running Kakoune with redirected stdin
Will read to a *stdin* fifo buffer
2014-04-29 21:37:11 +01:00
Maxime Coste
f683946681 Extract insert completion code to insert_completer.{cc,hh} 2014-04-28 21:54:00 +01:00
Maxime Coste
512bfa0c65 Fix support for tabulation in insert completion candidates 2014-04-28 19:49:23 +01:00
Maxime Coste
53cb626f49 Add an expand_tabs string utility function 2014-04-28 19:49:00 +01:00
Maxime Coste
7190791927 Move some buffer related utility functions to buffer_utils.{cc,hh} 2014-04-28 19:48:23 +01:00
Maxime Coste
49bc7f8767 minor formatting cleanup 2014-04-27 12:37:58 +01:00
Maxime Coste
b370f91025 Add -init switch to :prompt to set the initial text
Fixes #97
2014-04-27 12:37:41 +01:00
Maxime Coste
0c1b27cfa7 Fix :map docs and add completion support 2014-04-26 09:40:26 +01:00
Maxime Coste
192e0c33f9 Cache commands in complete_commands
Iterating through all directories in path to find commands
can end up quite slow, so cache the result per directory and
update it only if the directory modification time changed.
2014-04-24 19:08:05 +01:00
Maxime Coste
418a04f49d Support reading strings more that 2048 bytes
fixes #95
2014-04-23 22:21:04 +01:00
Maxime Coste
389308dfd8 Preserve current word in word completion if found elsewhere
If occurence count in the buffer if greater that one, do not
remove it from the matches.
2014-04-22 19:32:12 +01:00
Maxime Coste
65c818b859 Use StringView in CommandManager 2014-04-21 21:49:25 +01:00
Maxime Coste
8beda67fae Use StringView in FunctionGroup and FunctionRegistry 2014-04-21 10:50:09 +01:00
Maxime Coste
a1ec45d91a Use StringView in id_map 2014-04-21 10:47:21 +01:00
Maxime Coste
5ebd588e5f remove unused memoryview<char> String::data 2014-04-21 00:26:20 +01:00
Maxime Coste
61619d82bf use StringView::zstr() in place of StringView::str().c_str() 2014-04-21 00:26:20 +01:00
Maxime Coste
7cdb94d5c7 Use StringView in shell manager 2014-04-21 00:26:20 +01:00
Maxime Coste
63a0b9d22a Add a zstr() method to StringView that returns a zero terminated string holder 2014-04-21 00:26:20 +01:00
Maxime Coste
c4295b7e30 Fix StringView::substr when passed a negative length 2014-04-20 12:03:57 +01:00
Maxime Coste
055eacd032 use StringView for parse_keys 2014-04-20 11:27:59 +01:00
Maxime Coste
b2123547df Use StringView in BufferManager 2014-04-19 09:53:37 +01:00
Maxime Coste
97b08a6f09 Use StringView for file functions 2014-04-18 14:03:08 +01:00
Maxime Coste
adde2fef75 Use StringView for completion functions 2014-04-18 14:02:14 +01:00
Maxime Coste
af2d82dfc1 Add StringView class for non owning string 2014-04-18 13:47:39 +01:00
Maxime Coste
a7e6e5b936 Remove unimplemented String::replace method 2014-04-18 13:19:07 +01:00
Maxime Coste
1d7a481e81 word completion ignore the word on which the cursor is present 2014-04-17 19:33:49 +01:00
Maxime Coste
2b997719c3 Rename BufferCompleter to InputCompleter 2014-04-16 19:08:44 +01:00
Maxime Coste
7af9863e51 Add an explicit refresh method to user interface
With this refresh method user interface can defer updating
the display until really needed.
2014-04-15 19:19:44 +01:00
Maxime Coste
98c6a6f17e RemoteClient process all available messages 2014-04-15 19:09:42 +01:00
Maxime Coste
374f97a592 fix exception being thrown in error in decl command 2014-04-14 19:01:00 +01:00
Maxime Coste
386813bbfd Add a 'prompt' command 2014-04-13 14:15:34 +01:00
Maxime Coste
7097fcf640 Allow unset completer function in Prompt input mode 2014-04-13 14:15:05 +01:00
Maxime Coste
9ff356cb2b Extract option descriptions in an shared OptionDesc class 2014-04-12 20:03:26 +01:00
Maxime Coste
e9276a0a85 Add a docstring to options 2014-04-11 18:43:25 +01:00
Maxime Coste
05d69f7f8e Use stat when listing files so that link to directories are handled as directories 2014-04-11 18:43:25 +01:00
Jimmy Thrasher
061264c039 Define extern char **environ for OSX, which doesn't define it in a header 2014-04-10 15:23:39 -04:00
Maxime Coste
30bdc8936b Fix select_whole_lines on empty buffer 2014-04-10 20:14:11 +01:00
Maxime Coste
19868f01c8 return a const String& in Option::name() 2014-04-09 19:33:37 +01:00
Maxime Coste
e0424ba017 Minor formatting fixes (very long lines) 2014-04-08 20:09:54 +01:00
Maxime Coste
20d20ae1dc formatting changes in command_manager.cc 2014-04-08 19:55:31 +01:00
Maxime Coste
203a7732f5 Add support for querying client environement variables
At connection, a remote client sends all its environement to the
server, which then provides access to client env through
kak_client_env_VAR_NAME variables in the shell.
2014-04-07 23:47:51 +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
a387e7a4c6 the 'def' commands now supports -(buffer|client)-completion switches 2014-04-07 23:47:50 +01:00
Maxime Coste
ca54909246 Add ClientManager::complete_client_name 2014-04-07 23:47:50 +01:00
Maxime Coste
a9b3a8b0d6 rename BufferManager::complete_buffername to complete_buffer_name 2014-04-07 23:47:50 +01:00
Maxime Coste
0df088be20 Code cleanup in list_files 2014-04-06 10:59:51 +01:00
Maxime Coste
b01ba59911 Merge remote-tracking branch 'jjthrash/fix-closedir-crash' 2014-04-06 02:58:34 +01:00
Jimmy Thrasher
fd5406282d Fix crash caused by attempting to close a nonexistent DIR* 2014-04-05 18:00:59 -04:00
Maxime Coste
9b7d8a93c8 code formatting tweak 2014-04-05 12:04:37 +01:00
Maxime Coste
39983e54d0 minor code style tweak 2014-04-04 00:00:06 +01:00
Maxime Coste
3c40ac50af Add %rec{...} string that recursively expand %block inside
the result is then used as one token
2014-04-03 23:57:14 +01:00
Maxime Coste
c4e694fb7b Merge remote-tracking branch 'jjthrash/osx-install-fixes' 2014-04-03 20:26:47 +01:00
Jimmy Thrasher
cd8fa49ad1 Remove redundant -D that was causing problems on OSX
The prior `mkdir -p` took care of what -D was supposed to do.
2014-04-03 14:55:59 -04:00
Maxime Coste
fb72effde8 Fix cygwin detection in Makefile 2014-04-03 19:12:29 +01:00
Jimmy Thrasher
43b395533f Use plain libncurses with Apple 2014-04-03 13:56:03 -04:00
Jimmy Thrasher
0bb46c8968 Detect Darwin in the Makefile and plan accordingly 2014-04-03 13:56:03 -04:00
Jimmy Thrasher
d2e9486f2d Fix some more constexpr issues for clang 2014-04-03 13:56:03 -04:00
Maxime Coste
e94a82ac98 More OSX fixes 2014-04-02 22:52:00 +01:00
Maxime Coste
bf84f5dcef Fix compilation with OSX C++ lib 2014-04-02 22:41:06 +01:00
Maxime Coste
e1a9d5f71e Fix clang compilation 2014-04-02 22:33:52 +01:00
Maxime Coste
84c30c4b8a Minor formatting changes 2014-04-01 18:54:46 +01:00
Maxime Coste
ac90839c3d Select previous sentence or paragraph if selecting backward from the first char
[s and [p on the first char of a sentence or paragraph will select the
previous sentence or paragraph.
2014-03-31 21:46:47 +01:00
Maxime Coste
968922055b debug command now serves as a frontend to get debug informations 2014-03-31 20:07:35 +01:00
Maxime Coste
60452d9745 echo command accepts -debug switch to write to the debug buffer 2014-03-31 20:07:02 +01:00
Maxime Coste
c3a1318ffd When selecting forward paragraph and we are on an end of line, select the next one.
Fixes #62. Thanks to alexherbo2.
2014-03-30 11:13:45 +01:00
Maxime Coste
5079d78747 minor cleanup in select_whole_sentence 2014-03-30 11:13:37 +01:00
Maxime Coste
cd908bf6a3 minor cleanup 2014-03-30 10:45:53 +01:00
Maxime Coste
2a7335edef Add basic support for colalias completion 2014-03-29 13:18:46 +00:00
Maxime Coste
0fe9683c0f Fix indent/deindent when only empty lines are selected 2014-03-29 09:02:09 +00:00
Maxime Coste
da9d099f3b Remove Range struct, merge it back in Selection 2014-03-29 08:55:45 +00:00
Maxime Coste
c38e14958f Change default menu colors
Distinguish menus from selection more easily
2014-03-29 08:54:45 +00:00
Maxime Coste
159e0d049d rotate selection content count parameter groups selections
the count parameter does not specify the rotation count, but
the size of the rotation groups. with 2 for exemple, selection
contents will be swapped for each pair (1 and 2, 3 and 4, ...)
2014-03-27 00:11:30 +00:00
Maxime Coste
b6e268500d notify buffer saved after closing the file descriptor 2014-03-26 19:11:04 +00:00
Maxime Coste
248e5ae6c0 fix file reload prompt displaying invalid message 2014-03-26 19:06:16 +00:00
Maxime Coste
58b4e29e81 ShellManager: Change the env var detection regex to find more uses
The regex is now just '\bkak_\w+\b', no need for it to be looking
like a shell variable use.

This allows other tools that the shell to access Kakoune vars as
long as the name appears directly in the shell string.
2014-03-25 19:43:56 +00:00
Maxime Coste
764e450fdd Remove the shell option, always use /bin/sh 2014-03-25 09:28:44 +00:00
Maxime Coste
b677f9da63 do not write the trailing nul char in send_commands
That triggered creation of a new client, followed by it's immediate
destruction due to the connection closing.
2014-03-25 09:23:11 +00:00
Maxime Coste
0bc57e43d2 Server: correctly handle Accepters lifetime
When exiting kakoune, ClientAccepters (now Server::Accepter) could
stay alive, which left an FDWatcher in the EventManager triggering
an assert. Now Server is handling their lifetime.
2014-03-25 09:21:20 +00:00
Maxime Coste
2a23ce1987 FDWatchers are non copiable and non movable 2014-03-25 09:15:56 +00:00
Maxime Coste
ba6f3b833b fix segfault in parameter parser 2014-03-25 08:21:16 +00:00
Maxime Coste
bbdb2494d1 Merge remote-tracking branch 'evertvp/master' 2014-03-24 21:44:14 +00:00
Evert Van Petegem
369728cd7f Push aborted commands to history 2014-03-24 22:11:19 +01:00
Maxime Coste
30d36c0f1d change ncurses menu scroll bar style 2014-03-24 19:36:34 +00:00
Maxime Coste
a4070d9037 Use an info box to prompt for reloading of modified files 2014-03-24 19:31:40 +00:00
Maxime Coste
93ecc3efd6 style tweak 2014-03-22 21:00:24 +00:00
Maxime Coste
459cb212e5 Correctly handle failing to connect to the given session in client mode 2014-03-21 13:42:37 +00:00
Maxime Coste
2cdf578834 Store key names in a constexpr array 2014-03-20 19:52:11 +00:00
Maxime Coste
0cdeb55968 Container utility functions now use the free begin/end functions 2014-03-20 19:51:25 +00:00
Maxime Coste
dc953197c3 Fix support for switches style option in user commands 2014-03-20 19:50:42 +00:00
Maxime Coste
c48bdbe4f1 exec and eval support the -no-hooks option
Hooks gets disabled during the execution of the commands
2014-03-20 08:29:41 +00:00
Maxime Coste
be417d3616 Remove dangling forward declaration of Editor class 2014-03-20 08:11:35 +00:00
Maxime Coste
86fd00d1ea Fix comment 2014-03-20 08:10:31 +00:00
Maxime Coste
0db39ccfd0 Automatic insert filename completion kicks in only if prefix contains slash 2014-03-19 08:05:28 +00:00
Maxime Coste
dc087b3b7c EventManager: fix busy loop when no timer events exists. 2014-03-18 18:53:35 +00:00
Maxime Coste
36b016226c Insert mode completion execute completers in order, and supports multiple option
The 'completions' option is gone, just add option=completion_option_name
in the completers list.
2014-03-15 03:17:17 +00:00
Maxime Coste
19f5eb65e8 Clamp cursor position on buffer reloading 2014-03-07 01:05:51 +00:00
Maxime Coste
8e0b5d67aa Fix segfault in get_until_delimiter 2014-03-05 20:57:12 +00:00
Maxime Coste
11c62e583c Add -p <session> option to kak, which forward commands on stdin to session
This allows using directly the kak binary in place of socat for piping commands
to a foreing session.
2014-03-02 02:01:09 +00:00
Maxime Coste
e9442ea307 Rename connect_to's pid parameter to session 2014-03-02 02:00:13 +00:00
Maxime Coste
aab390ab92 Add -docstring option to the 'def' command
used defined commands can have their own documentation strings
2014-03-02 01:08:11 +00:00
Maxime Coste
4b9d49d7ab Add support for -buffer <comma separated names> to eval and exec commands
fixes #47
2014-03-02 01:08:11 +00:00
Maxime Coste
15223cba1e tweak docstring 2014-03-02 01:08:11 +00:00
Maxime Coste
8aaeaa3187 Declare commands in a CommandDesc structure 2014-03-02 01:08:11 +00:00
Maxime Coste
8ac19edf67 Add a docstring to commands 2014-03-02 01:08:11 +00:00
Maxime Coste
e6f5b3c038 Display command info only when the autoinfo option is true 2014-03-02 01:08:11 +00:00
Maxime Coste
486d1269e0 Consistently name -foo things 'switches' 2014-03-02 01:08:11 +00:00
Maxime Coste
9451782648 Add command switches information, and automatically display it 2014-03-02 01:08:11 +00:00
Maxime Coste
7f9f887b4a All commands now take directly a parameter parser
The command parameters description are now stored in a ParameterDesc
structure.
2014-03-02 01:08:11 +00:00
Maxime Coste
bd331742d2 Add @ command for tabs to spaces and alt-@ for spaces to tabs 2014-03-02 01:06:13 +00:00
Maxime Coste
0cd82d0ebe Rename align indent to more correct copy indent 2014-03-02 01:06:05 +00:00
Maxime Coste
c49e79c9e8 Add buffile env var for getting the buffer filename 2014-02-27 06:44:22 +00:00
Maxime Coste
aceee75ed9 Tolerate invalid %...{} when completing 2014-02-27 06:44:14 +00:00
Maxime Coste
6d651c59d0 regionref highlighter just ignore invalid references
fixes #68
2014-02-25 00:19:31 +00:00
Maxime Coste
daeefe2f33 Add support for strings
fixes #53
2014-02-15 00:36:00 +00:00
Maxime Coste
14f91e7132 Use a scoped edition when pasting 2014-02-12 00:03:01 +00:00
Maxime Coste
410932330c EventManager now wakes up for next timer rather than running a 10Hz 2014-02-12 00:03:01 +00:00
Maxime Coste
938f66badd Check for buffer external change when entering insert mode 2014-02-12 00:03:00 +00:00
Maxime Coste
d2a1c5ce46 Prompt handles scrolling in the line being edited 2014-02-12 00:03:00 +00:00
Maxime Coste
209a4a3ddf ClientManager: use lifo behaviour for free windows 2014-02-12 00:03:00 +00:00
Maxime Coste
22f2f68d58 Fix LineChangeWatcher behaviour when inserting at buffer end 2014-01-28 19:07:36 +00:00
Maxime Coste
2159fc9563 Rename selections first,last to more explicit anchor,cursor 2014-01-28 19:06:52 +00:00
Maxime Coste
dbd194cea8 Fix autoinfo for angle bracket object 2014-01-27 21:11:45 +00:00
Maxime Coste
e364137196 Fix compilation with clang 3.4 2014-01-27 20:28:38 +00:00
Maxime Coste
2dd4761f89 remove unused Singleton::delete_instance 2014-01-27 19:53:33 +00:00
Maxime Coste
a6d14cecbe Remove session socket on error signal 2014-01-27 19:53:17 +00:00
Maxime Coste
bbf48e1d39 Honor incsearch option for select/split/keep
fixes #37
2014-01-27 19:51:58 +00:00
Maxime Coste
37b4eacdc8 Rework command completion to allow partial token completion
Implement hook completion.

fixes #44
2014-01-27 19:51:58 +00:00
Maxime Coste
a32cac2f66 update gdbinit 2014-01-27 19:51:58 +00:00
Maxime Coste
ad818853a2 WordDB now uses a LineChangeWatcher based implementation 2014-01-27 19:51:58 +00:00
Maxime Coste
a96b2d3cd2 Rework regions highlighter, refactor and extract line tracking 2014-01-27 19:51:58 +00:00
Maxime Coste
f6e5deae5a Add 'a' alias to angle brackets text object
fixes #39
2014-01-23 19:45:09 +00:00
Maxime Coste
cccb07c7cd Catch parameter errors on startup and display option informations 2014-01-23 19:36:07 +00:00
Maxime Coste
c0bc7b6644 write_debug: fallback to stderr if the BufferManager does not exists yet
fixes #40
2014-01-23 19:21:00 +00:00
Maxime Coste
4f4a626754 Fix adapt_view_pos when the cursor is not on a display atom by itself 2014-01-21 18:52:51 +00:00
Maxime Coste
2cbb0bb27f Add a show_matching highlighter 2014-01-20 21:02:43 +00:00
Maxime Coste
f6eaaf1e78 WordDB: use an ordered map for storing words
This way we can use lower_bound to find the first prefix match
in logarithm time and we know all other prefix matches will
follow.
2014-01-19 19:43:19 +00:00
Maxime Coste
2ac545d306 RegionHighlighter: correct coordinates that are one past end of line
As region highlighters store per lines matches, end of line ones
are not valid buffer coordinates and must be corrected as begining
of next line.
2014-01-18 11:47:18 +00:00
Maxime Coste
5cffc48efc Pass a HighlightFlags parameter to highlighters
When only highlighting for finding character position on screen
pass HighlightFlags::MoveOnly so that non moving highlighters do
not need to run.
2014-01-18 01:59:37 +00:00
Maxime Coste
e1eec8903a only highlight actually displayed regions 2014-01-17 23:39:01 +00:00
Maxime Coste
79c6d609c9 FunctionGroup: fix incorrect parameter for operator() 2014-01-17 13:13:08 +00:00
Maxime Coste
997aadd33f Word completion use a WordDB stored as a buffer value. 2014-01-16 22:07:42 +00:00
Maxime Coste
a6b386e9b8 RegionHighlighter: Find the lines to be reparsed using the changes 2014-01-15 20:28:58 +00:00
Maxime Coste
c2f18e6e78 Use inplace_merge for sorting matches in region highlighter 2014-01-14 19:42:57 +00:00
Maxime Coste
ab508ea3da Much faster implementation of SelectionList::merge_overlapping 2014-01-13 22:23:40 +00:00
Maxime Coste
86eaa64982 Optimization and code cleanup in the region highlighter. 2014-01-13 21:40:02 +00:00
Maxime Coste
219f4c9c19 minor code cleanup 2014-01-12 21:25:21 +00:00
Maxime Coste
737837216b minor code cleanup 2014-01-12 21:24:59 +00: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
faabd24e11 Region highlighters track line changes in the buffer
This way, region highlighters only need to regex-parse lines that
actually changed. matches on lines that just moved around but whose
content did not change can be updated simply by updating their line
coordinate.
2014-01-12 16:28:11 +00:00
Maxime Coste
4aed32d152 Store timestamp of last content modification in buffer lines
That means that lines that move around keep their timestamp.
2014-01-12 16:26:31 +00:00
Maxime Coste
ba5b21d43e Clear buffer values explicitely in destructor
Buffer values could be registered as a listener, so we need to
get rid of them before asserting that all listeners have been
unregistered.
2014-01-11 19:05:09 +00:00
Maxime Coste
1d51e6922a minor code cleanup 2014-01-10 13:36:40 +00:00
Maxime Coste
d466193ee7 Use a per line caching strategy for region highlighter 2014-01-09 22:52:39 +00:00
Maxime Coste
b247a05e43 Buffer: maintain a per line timestamp 2014-01-09 22:51:50 +00:00
Maxime Coste
d96b5aa04d Move highlighter cache logic to BufferSideCache template 2014-01-09 22:51:23 +00:00
Maxime Coste
85cc740de0 Use Buffer values for storing highlighting caches 2014-01-09 21:57:37 +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
560b4ab0b5 Fix DynamicSelectionList selecting buffer end on Buffer::reload 2014-01-08 19:36:18 +00:00
Maxime Coste
c8119885fa Use Win32 MessageBox for asserts on cygwin 2014-01-08 19:23:59 +00:00
Maxime Coste
518bc4e7f3 Use a single edition for -itersel
-itersel would not make sense with changing context buffer, so
it should be safe.

Fixes #14
2014-01-06 20:10:46 +00:00
Maxime Coste
9455303a1e Do not allow changing buffer when the context is editing 2014-01-06 20:07:08 +00:00
Maxime Coste
aadbd390c7 Use wide character function for categorizing codepoints
Previously we used the is... rather than isw...
These functions were not supporting non ascii characters correctly
2014-01-05 15:14:58 +00:00
Maxime Coste
1e6fbf548b Fix some tabs in the code 2014-01-05 14:30:26 +00:00
Maxime Coste
feaf197cae Add support for the erase key in prompt and insert mode
Fixes #18
2014-01-04 18:18:59 +00:00
Maxime Coste
8168cba1a3 Fix small misbehaviour in split_selections 2014-01-04 14:23:08 +00:00
Maxime Coste
540d82c452 shell_completion use command completion after | and &&
Fixes #21
2014-01-03 22:29:11 +00:00
Maxime Coste
3017531699 shell_completion uses command completion after semicolons 2014-01-03 20:47:49 +00:00
Maxime Coste
6c4c32eb59 Rewrite join_select_spaces
Stop using regex for selecting spaces at the begining of the line
2014-01-03 20:41:47 +00:00
Maxime Coste
26e8c45282 CommandManager: support completion of chained commands
Command completion now work after a command separator (;)

fixes #19
2014-01-03 20:07:40 +00:00
Maxime Coste
ae5115c31f Add support for absolute paths in find_file
fixes #11
2014-01-03 19:32:42 +00:00
Maxime Coste
3be77842db fix select_to_eol behaviour when on empty line
fixes #3
2014-01-03 19:00:19 +00:00
Maxime Coste
e12bf4978c Try prefix completion and then subsequence completion for option names
fixes #4
2014-01-03 19:00:05 +00:00
Maxime Coste
608098cdde InputHandler: selection first item when entering menu mode 2014-01-02 19:19:41 +00:00
Maxime Coste
ad7145dda4 Minor code cleanup in normal.cc 2014-01-01 18:45:28 +00:00
Maxime Coste
bcb53d8417 Add q and Q alias for single quote and double quote text object 2014-01-01 13:59:25 +00:00
Maxime Coste
d9b7eaef2b NCursesUI: no item is selected on menu_show 2013-12-30 22:41:08 +00:00
Maxime Coste
a34b943749 Support completing %opt{...} and %sh{...} in command manager 2013-12-30 14:22:18 +00:00
Maxime Coste
0b509735ca Extract shell_complete lambda as a proper function 2013-12-30 14:20:05 +00:00
Maxime Coste
56c3d9d137 Few cleanups in the command line parsing code 2013-12-29 18:37:48 +00:00
Maxime Coste
257f589e22 Add D for erasing with concatenated yanking 2013-12-26 10:40:22 +00:00
Maxime Coste
983abefc30 Add alt-| for piping and appending rather than replacing 2013-12-24 16:48:52 +00:00
Maxime Coste
fd17ea00dd CommandManager: use aliases for commands rather than duplicating data
Completion now only proposes full command names
2013-12-24 02:06:22 +00:00
Maxime Coste
22102951e2 make userconfig: install all kak scripts 2013-12-23 21:52:59 +00:00
Maxime Coste
fa72d27f9a Make kak more installable
* Kak relies on the kakrc file to be in ../share/kak/kakrc relative
to kak binary rather than in the same directory
* Added an install target to the Makefile
2013-12-23 21:36:05 +00:00
Maxime Coste
bcba5287ad Add complete_command for completing commands in PATH
use it for pipe completion
2013-12-23 20:43:55 +00:00
Maxime Coste
a0d4a44dd5 Fix prefix completion in prompt 2013-12-23 20:43:29 +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
cb324a4b88 highlighters: add some optimization flags to regexes 2013-12-17 20:03:54 +00:00
Maxime Coste
0e6bbbb8c4 remove useless code in Buffer constructor 2013-12-16 23:53:04 +00:00
Maxime Coste
d9c3de3fc0 small cleanup in context_wrap 2013-12-16 23:51:57 +00:00
Maxime Coste
d1ac813f61 Pass a Context rather than a Window to highlighters 2013-12-16 23:24:08 +00:00
Maxime Coste
ae75594d25 Window: refactor center_selection/display_selection_at
Take the line we are intersted in as a parameter rather than getting
the main selection last char line.
2013-12-16 19:08:19 +00:00
Maxime Coste
94c9e4e99b Fix select_coord that could select invalid positions 2013-12-16 13:39:02 +00:00
Maxime Coste
6641583a68 cleanup editor.hh, remove editor.cc... 2013-12-15 22:10:19 +00:00
Maxime Coste
f83d5672f8 Fix replace_with_char behaviour, keep the same selections 2013-12-15 20:52:57 +00:00
Maxime Coste
ea95632709 Move Editor::selections_content to Context 2013-12-15 20:37:07 +00:00
Maxime Coste
ad0682ec75 remove unused Editor::check_invariant 2013-12-15 20:32:58 +00:00
Maxime Coste
8047cc97d3 Move Editor::{undo,redo} to free functions in normal.cc 2013-12-15 20:23:02 +00:00
Maxime Coste
cb9384f8a7 move InsertMode to normal.hh 2013-12-15 20:23:02 +00:00
Maxime Coste
7267b8281f Move insert and erase to normal.cc, and move edition management to context 2013-12-15 20:23:02 +00:00