Commit Graph

3634 Commits

Author SHA1 Message Date
Maxime Coste
9a879262a2 Use a POSIX guaranteed way of getting the shell path 2016-12-15 23:04:53 +00:00
Maxime Coste
4fd12164dd Merge remote-tracking branch 'Delapouite/prompt' 2016-12-15 13:50:12 +00:00
Delapouite
99f38c99ec Fix :prompt command description 2016-12-15 14:42:46 +01:00
Maxime Coste
71cc9f1011 Fix reentrancy in InputeModes::Normal::on_key 2016-12-15 09:46:10 +00:00
Maxime Coste
9ad1c19f69 Validate user text object desc more thorougly
Fixes #992
Fixes #993
Fixes #994
2016-12-15 09:29:38 +00:00
Maxime Coste
430ff37bd6 Fix regex.hh compilation
Repeat after me: I will not blindly push commits that I havent
compiled.

Fixes #990
2016-12-14 23:50:29 +00:00
Maxime Coste
fd82d3e258 Make Regex a class rather than a struct to avoid mismatched tags warnings 2016-12-14 20:59:39 +00:00
Maxime Coste
377046e315 Handle correctly cases where codepoint_width returns -1
Fixes #972
2016-12-14 13:53:30 +00:00
Maxime Coste
dfb030da6e Make container wrapper callback functions mutable
It seems at least std::mem_fn callable wrapper type call operator
is not guaranteed to be const, so we need to be able to call on
a non const object. This should do for now.

Fixes #978
2016-12-14 13:25:55 +00:00
Maxime Coste
85a534fb8a Support inserting esc characters through <c-v>
As requested in #960
2016-12-14 00:34:53 +00:00
Maxime Coste
735b1e1dc5 Add support for readline like <c-k> and <c-u> in prompts 2016-12-14 00:28:46 +00:00
Maxime Coste
e44129577a Fix one definition rule violation in ncurses_ui.hh
The memory domain of Vector<DisplayBuffer> was different depending
on if display_buffer.hh has been included or not.
2016-12-10 13:43:41 +00:00
Maxime Coste
5d9f3b7f3f Ensure the line is correctly clamped in scroll_window
Seems like the previous implementation was not always doing that
correctly, so just use an obviously correct method.

Fixes #951
2016-12-10 13:33:42 +00:00
Maxime Coste
03eb128536 Ensure content of expanded strings in modelinefmt is not interpreted as markup 2016-12-07 20:07:32 +00:00
Maxime Coste
bc8b30c988 Replace some string concatenations with a format call 2016-12-07 13:57:16 +00:00
Maxime Coste
1383614a5f Fix markup parsing handling of antislash escapes
Antislashes did not need to immediately precede a face spec to
escape it, it could be in any characters before it.
2016-12-07 13:43:27 +00:00
Maxime Coste
2f704eab16 Small command parsing refactoring 2016-12-07 13:26:11 +00:00
Maxime Coste
d9679db9b6 Fix scrolling generating invalid buffer coordinates 2016-12-07 00:08:41 +00:00
Maxime Coste
a320dcec28 Small formating fix 2016-12-06 23:08:18 +00:00
Maxime Coste
e9349cdc92 Ensure timers are still alive when trying to run them 2016-12-06 13:55:53 +00:00
Maxime Coste
b3ac733f33 Fix buffer reload info box not being shown anymore 2016-12-05 23:40:23 +00:00
Maxime Coste
9a986b8d47 Hide eventual info box when returning to normal mode 2016-12-04 23:27:04 +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
e2fae522e5 Small include fix 2016-12-03 13:18:11 +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
8a74ef9804 Read as much as possible data from shell processes on each read event
We were reading at most 1024 bytes every time, going back to the event
loop.
2016-12-03 12:41:36 +00:00
Maxime Coste
75986911f8 Refactor RefPtr handling to use a policy class
THe previous overload based system was pretty complex for no good
reason.
2016-12-03 12:32:16 +00:00
Maxime Coste
5ff8245cc8 Display non breaking spaces with ⍽ in show_whitespaces hihglighter
Fixes #167
2016-12-02 13:59:34 +00:00
Maxime Coste
089ee8ac0a Fix crash when quitting the first client while another client is connected 2016-12-01 20:55:28 +00:00
Maxime Coste
a65e8142f3 Rework handling of initial coordinates so that init commands can change them
Fixes #944
2016-12-01 20:55:20 +00:00
Maxime Coste
8c862c4eea Only write to remote socket when we know they are writable
Buffer data (in an horribly innefficient way for now), and use the
event manager to watch for the socket being ready for a write.

Fixes #945
2016-12-01 20:11:09 +00:00
Maxime Coste
95c1528342 Fix crash when a client sends a packet advertising a wrong size
If the given size is less than the header size, the message is
clearly invalid, disconnect the client in that case.
2016-12-01 19:45:23 +00:00
Maxime Coste
7defdd3039 Make FDWatcher support Read, Write and Except events, instead of just Read 2016-12-01 19:44:07 +00:00
Maxime Coste
99a3388e41 Hide the waiting for shell message once the shell returns 2016-11-30 13:46:20 +00:00
Maxime Coste
61b3dfd184 Use a Timer for Shell waiting notification
Without a timer we were relying on other event sources to wake us
up to display the information, which was usually a NormalIdle or
a filesystem check timer.
2016-11-30 09:55:05 +00:00
Maxime Coste
540e504e68 Ensure all available input is handled before going back to main loop
We were not handling keys that could have been generated while handling
other keys (like during a shell evaluation).
2016-11-30 09:47:38 +00:00
Maxime Coste
3a81260917 Simplify greatly UI input handling
This round trip through an input callback expected to call
is_key_available and get_key was overcomplicated, just send the
keys as they arrive, the client is already buffering due to urgent
event mode.
2016-11-29 21:59:36 +00:00
Maxime Coste
2fd1414b05 Clean up includes of user_interface.hh 2016-11-29 19:53:11 +00:00
Maxime Coste
0dff8a7d3f Small remote code cleanup 2016-11-29 19:52:57 +00:00
Maxime Coste
db86c6cbc9 Small cleanup in BufferManager code 2016-11-29 19:12:10 +00:00
Maxime Coste
12856066b1 Cleanup include dependencies a bit 2016-11-28 23:58:08 +00:00
Maxime Coste
da6d7f4530 Always consider end of selection is not and eol for keep
Fixes #921
2016-11-28 21:07:24 +00:00
Maxime Coste
719eb16a5e Fix matching flags not being forwarded to regex_search
Still does not fully fix #921
2016-11-28 20:02:40 +00:00
Maxime Coste
2f3a7112ea Add more memory domains to certain data 2016-11-28 13:59:55 +00:00
Maxime Coste
54d540021c Add support for mouse in insert mode
Fixes #940
2016-11-28 13:15:12 +00:00
Maxime Coste
a4738ace5f :prompt and :onkey (renamed :on-key) now use values instead of registers
:prompt provides the entered text in the `text` value, :on-key provides
the entered key in the `key` value.

Closes #938
2016-11-27 20:57:04 +00:00
Maxime Coste
b337f99ca7 Add a 'keys' debug flag, showing the keystrokes comming to clients 2016-11-26 13:29:17 +00:00
Maxime Coste
e340e0ed39 Forward client name to contexts created for write-all
Fixes #937
2016-11-24 13:35:42 +00:00
Maxime Coste
8f2c6eb586 Fix write_all_buffers when BufWrite... hooks create/delete buffers
The buffer list can be mutated during iteration, so it is no safe
to directly iterate on the BufferManager, we need to first create
our own copy of the buffer list.

Fixes #935
2016-11-23 23:51:16 +00:00
Maxime Coste
b884b499dd Rework ensure_all_buffers_are_saved to remove an unneeded Vector 2016-11-23 23:39:42 +00:00
Maxime Coste
1ccccbce04 Fix horrible leak in String::Data::operator=(String::Data&&)
And that, my friends, is why we recommend using standard containers
instead of rolling your own.
2016-11-23 01:09:09 +00:00
Maxime Coste
03dcfb2574 Small code tweak 2016-11-23 00:22:37 +00:00
Maxime Coste
ca0606017f Small code refactoring 2016-11-22 23:51:09 +00:00
Maxime Coste
3f3ed0b333 Fix literal type that must be 64 bits 2016-11-22 22:20:30 +00:00
Maxime Coste
d15cc02c01 Remove some unneeded headers from ncurses_ui.cc 2016-11-22 09:49:55 +00:00
Maxime Coste
0b806cd4f1 Add missing hooks to completion list and validate hook name in hook cmd 2016-11-21 09:51:47 +00:00
Maxime Coste
be03fdce2a Support completing hook names
Fixes #879
2016-11-20 11:17:13 +00:00
Maxime Coste
cd8d51af34 Fix PerArgumentCommandCompleter when completing the non first arg
The actualy query passed was always the first argument.
2016-11-20 11:16:34 +00:00
Maxime Coste
47a82b9855 Make ArrayView::subrange size arguement optional 2016-11-20 11:15:15 +00:00
Maxime Coste
67eb19c6d2 Only rely on ignored_files option to remove hidden files, no built in logic
Fixes #929
2016-11-18 09:38:48 +00:00
Maxime Coste
4a2fea8c9e Continue command renaming to improve consistency 2016-11-15 13:49:06 +00:00
Maxime Coste
6d79ade019 Tweak RankedMatch behaviour and fix bug in its comparison function
casting TestableFlag<T> to UnderlyingType<T> was going through bool
conversion... Not sure how things worked earlier.
2016-11-14 19:39:35 +00:00
Maxime Coste
b3ba769220 Propagate the hooks disabled state through prompt, menu, and command execution
Maintain it as well during buffer creation even if the hooks are not executed
in client context.

Fixes #818
2016-11-14 19:39:35 +00:00
Maxime Coste
c2989704d5 More correct handling of SIGHUP while suspended
Fixes #833
2016-11-14 00:49:34 +00:00
Maxime Coste
5249df78d4 Do not include aliases in command completion candidates anymore
Fuzzy matching makes it redundant.
Closes #817
2016-11-14 00:29:43 +00:00
Maxime Coste
dcd733e5fa Do a first phase of command renaming 2016-11-14 00:27:14 +00:00
Maxime Coste
9d9beb7e3a Pass regex flags on keep matching/not matching
Related to #921
2016-11-12 18:03:54 +00:00
Maxime Coste
8490caa0d7 Add support for <a-Z> appending current selections to the given register 2016-11-09 13:57:05 +00:00
Maxime Coste
9153663dfa Add -save-regs defaults in the context wrap docstring 2016-11-08 09:49:48 +00:00
Maxime Coste
6889494869 Emit an OSC 104 on quit to reset color palette on supporting terminals
xterm and vte based terminals support it, unfortunately rxvt-unicode
does not yet.

Fixes #914
2016-11-05 11:43:25 +00:00
Maxime Coste
8e5f491d3f Support deleting a buffer even if another client is in insert mode on it 2016-11-05 11:29:47 +00:00
Maxime Coste
bc2d79d302 Run WinDisplay hook on creation of clients
Fixes #913
2016-11-03 19:09:52 +00:00
Maxime Coste
6347787cf2 Propagate NormalParams to user mappings
Closes #896
2016-11-02 23:12:57 +00:00
Maxime Coste
4d222bbb33 Add experimental static linking support to the makefile 2016-11-02 22:28:05 +00:00
Nikolaus Wittenstein
e7970232d3 Fix typo in write_cmd's desc
Should be possessive "its".
2016-10-31 12:42:10 -04:00
Maxime Coste
650a989c1e Add to_string(long long int) overload to fix OSX compilation 2016-10-31 10:19:06 +00:00
Maxime Coste
a7cac87753 Display a status line message when Kakoune is waiting on a shell to complete
If a shell commands takes more than 1s to execute, a message will appear
on the status line notifying the user, along with the time Kakoune has
been waiting for.
2016-10-29 11:25:58 +01:00
Maxime Coste
965cd8e0c3 Fix align support with aligntab = true 2016-10-28 09:50:25 +01:00
Maxime Coste
7c6c6871ce BufferRange option syntax support <line>.<column>+<len> and is inclusive
Fixes #864
2016-10-26 22:58:12 +01:00
Maxime Coste
dc18963875 Make o/O open multiple lines when a count is given
Fixes #873
2016-10-24 20:45:12 +01:00
Maxime Coste
7a04efb6d9 Force wrapping when searching from buffer end
Fixes #868
2016-10-23 21:03:15 +01:00
Maxime Coste
2809ce00de Set main selection index to the current sel when piping different selections
Fixes #884
2016-10-23 19:54:40 +01:00
Maxime Coste
d2aa292c17 Change handling of OpenLineAbove to fix first line edge cases
Fixes #877
2016-10-23 19:48:16 +01:00
Maxime Coste
28db6f04f1 Re-enable undo support on fifo buffers when the fifo closes
Fixes #881
2016-10-23 18:22:42 +01:00
Maxime Coste
e318190a59 Small formatting tweak 2016-10-17 18:37:05 +01:00
Maxime Coste
e8dcdb6072 Support Ctrl + mouse dragging to add a new selection
Fixes #838
2016-10-13 22:59:02 +01:00
Maxime Coste
cc2affea11 Always allow to delete a buffer, just recreate a scratch buffer if needed
Fixes #850
2016-10-13 21:37:44 +01:00
Maxime Coste
6bfc68d4f3 Rename DisplayAtom::Types to avoid conflicts with struct BufferRange 2016-10-13 19:55:15 +01:00
Maxime Coste
1f3e424047 Do not expand filenames when doing insert filename completion
Fixes #855
2016-10-13 19:46:09 +01:00
Maxime Coste
e384e7263c Use CPPFLAGS instead of CXXFLAGS for the _XOPEN_SOURCE define 2016-10-13 00:19:27 +01:00
Frank LENORMAND
f7e2bfd76f Document the optional parameter of the cd command 2016-10-11 10:39:20 +03:00
Maxime Coste
5440d31f99 Only create a default *scratch* when we dont have any non debug buffers
Fixes #852
Closes #856
2016-10-11 00:45:05 +01:00
Maxime Coste
780a4605fa More transform(...) filter cleanup using mem_fn when possible 2016-10-11 00:32:40 +01:00
Maxime Coste
8b6eba8208 Add support for repeating the last object/char find command
This is a potential solution for #794.
2016-10-11 00:20:36 +01:00
Maxime Coste
f6cdc2eee5 Use std::begin/std::end in containers.hh instead of the method version 2016-10-11 00:17:00 +01:00
Maxime Coste
025b91baca Convert some uses of lambda to more concise std::mem_fn 2016-10-10 23:44:18 +01:00
Maxime Coste
bc9d1b4dac Small formatting fixup 2016-10-10 23:20:05 +01:00
Maxime Coste
0d2bb4756b Fix register alternate name doc and dash -> hash for '#' 2016-10-10 23:19:57 +01:00
Maxime Coste
10681f4809 Merge remote-tracking branch 'Delapouite/typo' 2016-10-09 23:30:00 +01:00
Maxime Coste
314108e539 Document register alternate names and add some missing ones
Fixes #853
2016-10-09 23:27:52 +01:00
Maxime Coste
f904402486 Handle all available keys when a RemoteClient input is available
We were just treating the next key. Which led to <esc> byte
remaining after suspend, that led that <esc> being interpretted
as <alt> when the following key got available.

Fixes #739
2016-10-06 23:47:44 +01:00
Maxime Coste
006be63a32 Ensure local client is destroyed before we fork the server to background
The recent change that introduced defered client deletion made the local
client destruction happens too late, putting the terminal in a bad state
when we resumed the process as client only.
2016-10-06 23:35:32 +01:00
Maxime Coste
5dd47e9c33 Preserve shell context through eval command
Fixes #835
2016-10-06 23:22:39 +01:00
Delapouite
acafe5f0b9 Fix typo horzontally → horizontally 2016-10-06 16:13:40 +02:00
Maxime Coste
9078039326 Fix select_to_previous_word with spaces at buffer start
Fixes #844
2016-10-05 23:42:36 +01:00
Maxime Coste
8579e299da Fix custom text object 2016-10-05 09:36:39 +01:00
Maxime Coste
f81b8c137b Replace non ascii chars with ? in xterm title, and limit to 511 chars
Closes #839
2016-10-04 20:13:15 +01:00
Maxime Coste
d2a324d3c4 Treat '\n' as 1 column wide
Fixes #842
2016-10-04 19:37:43 +01:00
Maxime Coste
40fb56c87a Small code cleanup 2016-10-04 19:37:17 +01:00
Maxime Coste
620fc28ea6 Add "(extend)" to search prompts when we are extending the selection
Fixes #832
2016-10-04 13:18:03 +01:00
Maxime Coste
9e12ac327b Refactor hook disabling in normal mode
Normal mode takes care of keeping hooks disabled until nested modes
finishes.

Requiered form #818, not sufficient yet.
2016-10-03 20:02:37 +01:00
Maxime Coste
a51d5a1046 Do not select the next word for inner word. 2016-10-03 20:01:37 +01:00
Maxime Coste
c7356c8e9c Close write buffer file descriptor before getting the new fs timestamp 2016-10-03 20:00:36 +01:00
Maxime Coste
d50087eabe Change BufWritePre/BufWritePost logic
Run them in client context if possible, and give them the target
filename instead of the buffer name.

Fixes #823
2016-10-01 23:51:53 +01:00
Maxime Coste
4b6d4ec8eb Small refactoring in highlighters.cc 2016-10-01 14:12:21 +01:00
Maxime Coste
8cc30a8ca0 Enable _XOPEN_SOURCE=700 on cygwin to get the wcwidth function 2016-10-01 13:46:55 +01:00
Maxime Coste
249ec4835e Rename get_width to codepoint_width 2016-10-01 13:45:00 +01:00
Maxime Coste
28cfd0bb61 Fix get_column function and add some unit tests for fullwidth text 2016-10-01 13:45:00 +01: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
dc735450a8 Tweak ranked match comparison, give contiguous matches an edge 2016-09-30 22:13:01 +01:00
Maxime Coste
e701254b02 Fix String::Data::reserve on big endian platforms, and document String::Data
reserve was not ensuring the capacity would be pair, which is needed
on big endian machines, as we use its least significant bit to flag
short string optimizations. On little endian the bit we use is the
8th most significant (the least significant bit of the last byte),
so we were not hitting any problems.

Fixes #828
2016-09-28 19:06:25 +01:00
Maxime Coste
1b9eb2c6ba Validate option names to be in [a-zA-Z0-9_]
Closes #824
2016-09-27 09:54:55 +01:00
Maxime Coste
e3c4bddd3b Make hook disabling work for all hooks, not only user hooks
Fixes #823
2016-09-26 23:43:05 +01:00
Maxime Coste
696db111e2 Selecting 'around' word when on spaces after word now selects next word 2016-09-26 23:33:28 +01:00
Maxime Coste
fcb37cc754 Pass count to all object selectors 2016-09-26 23:32:07 +01:00
Maxime Coste
1e0ec182c1 Assert substr from parameter is within the string
Should catch #756 earlier if it happens again.
2016-09-26 23:24:09 +01:00
Maxime Coste
a0c20a924a OptionDescs are const in OptionRegistry 2016-09-26 22:59:02 +01:00
Maxime Coste
5e3effc1f0 Merge remote-tracking branch 'lenormf/fix-src-makefile' 2016-09-26 22:04:34 +01:00
Maxime Coste
b5450aa375 Tweak RankedMatch logic, prioritize matches that are in a single word 2016-09-26 21:54:39 +01:00
Frank LENORMAND
b9d21a9e9e Add some standard GNU targets to the Makefile
Closes #813
2016-09-25 09:40:24 +03:00
Maxime Coste
532e3758fe Add InsertCompletionShow/InsertCompletionHide hooks 2016-09-21 13:43:06 +01:00
Maxime Coste
12f2815159 Tweak Buffer::offset_coord implementation 2016-09-21 13:36:11 +01:00
Maxime Coste
4f874a3679 Code cleanup in make_completer, use std::decay 2016-09-19 23:26:52 +01:00
Maxime Coste
fafde8655b Fix select_to_reverse to correctly handle the first character of the buffer
Fixes #809
2016-09-19 09:20:55 +01:00
Maxime Coste
396b71ecc2 Add an unmap command to remove key mappings 2016-09-19 09:10:41 +01:00
Maxime Coste
44e9da3bee More command completer code cleanup 2016-09-18 16:27:34 +01:00
Maxime Coste
d14c39ebdd Rewrite PerArgumentCommandCompleter to use compile time dispatching
No need to store these vectors of std::functions around anymore.
2016-09-18 16:07:00 +01:00
Maxime Coste
c152fbe3b6 Make idle timeout and filesystem check timeout configurable 2016-09-18 13:47:22 +01:00
Maxime Coste
c63c92cbf7 Support kill session inside init command 2016-09-06 22:46:27 +01:00
Maxime Coste
c1d7f79a52 Do not let boost regex errors propagate, convert them to Kakoune errors. 2016-09-06 13:55:14 +01:00
Maxime Coste
da0fe5d0bd Small code tweak in generate_switches_doc 2016-09-05 23:34:03 +01:00
Maxime Coste
21a76d135c Fix handling of remote errors in the accepter 2016-09-05 13:47:56 +01:00
Maxime Coste
4fc20b8d7d Rework client quitting and handling of remote errors
Client quitting no longer immediately unwinds, client is just pushed
for deletion until we get back to the main loop, similarly to what
happens for buffer and window deletion.
2016-09-04 17:56:07 +01:00
Maxime Coste
563497ade7 Use proper buffering when reading remote messages
Messages now have their size in a header, along with their type
and are only executed once fully received. We dont block anymore
while trying to read a full message.
2016-09-04 11:17:35 +01:00
Maxime Coste
044a6ce860 Rework binary network protocol to be more message based
We cannot just write to Kakoune socket from any application anymore,
use of kak -p is mandatory, as we now have an introduction to write.
2016-09-04 11:17:34 +01:00
Maxime Coste
4d13e6fb88 Do not crash whenever S matches the whole selection and hence does not select anything
Fixes #787
2016-09-04 11:17:34 +01:00
Maxime Coste
97e36233fb Remove the to_string(unsigned) (it conflicts with to_string(size_t) on x86)
Just cast to int when we pass an unsigned.
2016-08-31 09:07:33 +01:00
Maxime Coste
3831117bc7 style tweak 2016-08-30 23:23:07 +01:00
Maxime Coste
8b02bb749d Add a fd_readable(int fd) helper function
Use it instead of direct calls to select scatered around the code
base.
2016-08-30 22:56:47 +01:00
Maxime Coste
b6cab458ed Use a heap instead of sorting to gather the best shell-candidates matches
O(n + k * log n) (with k = 100 here) instead of O(n log n), much faster
with many candidates.
2016-08-30 13:42:29 +01:00
Maxime Coste
f6cb6319d6 Enable shell-candidates update in fast completion mode 2016-08-30 00:55:01 +01:00
Maxime Coste
f52f5f7c53 Only decode utf8 when strictly necessary in RankedMatch::operator< 2016-08-30 00:51:21 +01:00
Maxime Coste
2b631837d8 Tweak RankedMatch, compare max match index instead of match indices sum 2016-08-30 00:30:15 +01:00
Maxime Coste
cbe38b2f96 Use flags and bit operations instead of bools in RankedMatch
full match is now the most important flag for comparison.
2016-08-29 23:56:22 +01:00
Maxime Coste
95c21a4ebd Merge remote-tracking branch 'doppioandante/json-fix' 2016-08-28 18:51:19 +01:00
Enrico Lumetti
c6da163cb3 Fix menu_select in the JSON ui 2016-08-27 17:57:48 +02:00
Maxime Coste
b934bcd4e1 Support merging consecutive selections with <a-m>
Fixes #773
2016-08-27 11:20:38 +01:00
Maxime Coste
093d3bd0df Map tab to jump forward until we can distinguish <c-i> from it
Fixes #769
2016-08-27 11:07:24 +01:00
Maxime Coste
85f54a77ac Display the capture used in select/split prompt
Fixes #770
2016-08-27 10:55:07 +01:00
Maxime Coste
2bf100bdd0 Add a to_string overload for unsigned int 2016-08-27 10:46:49 +01:00
Maxime Coste
7ac54b0b0f Fix another bug in wrap_lines 2016-08-26 00:08:34 +01:00
Maxime Coste
9124851029 JsonUi: try to handle all available requests, on input event, not just the first one 2016-08-24 23:47:09 +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
911a32a992 Only drop blank prefixed history entries in command/shell prompts
For regex prompts we actually want to save them, as a leading space
is significant

Fixes #767
2016-08-22 20:37:14 +01:00
Maxime Coste
ac81d0f39c Cleanup history_push function 2016-08-22 20:37:14 +01:00
Maxime Coste
56a7c6e594 Rework buggy number selection function
Fixes #765
Fixes #766
2016-08-22 13:54:22 +01:00
Maxime Coste
0de4fc75d0 Dont consider OptionManager watcher list as part of the state of the option manager 2016-08-21 20:24:18 +01:00
Maxime Coste
1d1f27248f Try to fix travis ci 2016-08-18 22:42:31 +01:00
Maxime Coste
8803bf7c46 Fix comment missing a closing parenthesis 2016-08-14 20:05:57 +01:00
Maxime Coste
bedf2f703c Small code cleanups 2016-08-09 21:45:06 +01:00
Maxime Coste
ac0c746072 Tweak format of option docstrings 2016-08-07 10:47:26 +01:00
Maxime Coste
f73e89a716 Add information of types of options 2016-08-06 09:05:50 +01:00
Maxime Coste
f1a93a0e61 Replace some const String& with StringView in option_manager.hh 2016-08-06 06:52:11 +01:00
Maxime Coste
5b7b6eebaf Regenerate shell-candidates for each completion sessions
That should allow fixing the #665 issue while still avoiding to
run a potentially long shell command on each keystroke.
2016-08-05 13:53:19 +01:00
Maxime Coste
38d372567b Do not force exec to run in normal mode anymore, run in the current mode 2016-08-05 09:43:33 +01:00
Maxime Coste
373c21e875 Preserve selections when converting to client mode
Fixes #742
2016-08-05 08:16:43 +01:00
Maxime Coste
8cc27354e8 Support sorting and merging overlapping separately, fix bug in move
Fixes #754
2016-07-30 15:32:47 +01:00
Maxime Coste
d28e503150 Use the same logic for mouse wheel and (half) page up/down
Fixes #749
2016-07-28 09:51:49 +01:00
Maxime Coste
a7005ec74b Add a char_length(Buffer&, const ByteCoord&, const ByteCoord&) util 2016-07-28 09:41:47 +01:00
Maxime Coste
74c3f101cd Use -1 for invalid codepoint, not 0 2016-07-28 09:24:51 +01:00
Maxime Coste
2425f4a781 Tweak session renaming code 2016-07-28 00:16:41 +01:00
Maxime Coste
62fa133efd Merge remote-tracking branch 'doppioandante/set_session' 2016-07-28 00:12:09 +01:00
Maxime Coste
623fcd88ea Do not avoid end of lines after selecting modified ranges in undo
Fixes #751
2016-07-27 23:53:16 +01:00
Maxime Coste
14198fadb4 BufferIterator is random access, not just bidirectional 2016-07-27 21:36:52 +01:00
Maxime Coste
14f59d415d Avoid underlying iterator copies in utf8_iterator 2016-07-27 21:36:32 +01:00
Maxime Coste
df0773feeb Ensure we cannot call StringView::StringView{Codepoint} 2016-07-27 09:08:08 +01:00
Maxime Coste
a09b094f2b Avoid repeated calls to context.selections() in highlight_selections 2016-07-27 09:03:01 +01:00
Maxime Coste
0d2c5072b0 Merge remote-tracking branch 'lenormf/fix-timespec-conversion' 2016-07-27 00:37:04 +01:00
Maxime Coste
09188a2bc1 Revert "Try to disambiguate timespec as a struct"
This reverts commit 17d2dc9477.
2016-07-27 00:36:53 +01:00
Maxime Coste
17d2dc9477 Try to disambiguate timespec as a struct 2016-07-27 00:34:20 +01:00
Maxime Coste
f30bd4c540 Fix use of dead string memory and quick cleanup 2016-07-27 00:25:05 +01:00
Maxime Coste
35f1ad100e Merge remote-tracking branch 'lenormf/select-arbitrary-punctuation' 2016-07-27 00:14:49 +01:00
Maxime Coste
dffb1dff7c Add missing <time.h> header so that timespec is well defined 2016-07-27 00:14:11 +01:00
Maxime Coste
80c3405a20 Rework SelectionList::check_invariant 2016-07-27 00:04:06 +01:00
Maxime Coste
13ed87410f Rework compute_modified_ranges
Fixes #743
2016-07-26 23:31:23 +01:00
Frank LENORMAND
f04a7a0ed3 Allow selection primitives to use arbitrary punctuation signs 2016-07-26 10:39:18 +03:00
Frank LENORMAND
f8224b1384 Use explicit initialization of the timespec object to fix compilation on older compilers 2016-07-26 09:43:41 +03:00
Maxime Coste
78fc88ae6d Display some information when moving in history 2016-07-24 22:55:37 +01:00
Enrico Lumetti
1a7cd707aa Add 'session' command to change remote session name 2016-07-24 22:46:33 +02:00
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
46a15534c5 Introduce chrono.hh 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
e3bf01d1f9 Replace C-style operators with their alphabetical equivalent 2016-07-24 08:34:49 +03:00
Frank LENORMAND
ef82c496eb Use a more appropriate error message with unlogical flag combinations 2016-07-23 10:03:25 +03:00
Frank LENORMAND
3c91f711fc Warn the user when flag combinations don't make sense 2016-07-23 10:03:25 +03: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
3ddc6eccda Add sanity check 2016-07-15 20:26:58 +01:00
Maxime Coste
1401c55531 Faster implementation of utf8::advance not copying iterators at each step 2016-07-15 20:26:33 +01:00
Maxime Coste
73fdc726fb Avoid postfix increment in utf8::distance 2016-07-15 20:07:47 +01:00
Maxime Coste
4ecdbea5c4 Make buffer iterator iteration/dereference faster 2016-07-15 19:48:13 +01:00
Maxime Coste
b988871df6 Ensure selections are sorted and non overlapping in selections_list_from_string 2016-07-14 21:14:17 +01:00
Maxime Coste
52d3b60aaa Clamp selection generated in selection_list_from_string
Fixes #733
2016-07-13 19:25:32 +01:00
Maxime Coste
bb688cf42d Do not throw when recursive hook calls are detected
Running hooks is non critical, and should never `fail` as far as
caller is concerned.
2016-07-11 19:44:29 +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
88a9607552 Keep modified selections in non-draft exec/eval -itersel
Fixes #727
2016-07-08 09:52:10 +01:00
Maxime Coste
439f168928 Use named keys for Return and Tab instead of <c-m> and <c-i>
Fixes #722
2016-07-05 20:08:13 +01:00
Maxime Coste
8270f9299f Improve robustness of json parsing and execution
Fixes #720
2016-07-04 19:31:09 +01:00
Maxime Coste
469eb6ec44 Avoid possible access to an invalid, being deleted buffer list. 2016-07-04 19:20:22 +01:00
Maxime Coste
ca7f647562 Refactor Optional::operator== 2016-07-04 19:19:40 +01:00
Maxime Coste
e262dc1257 Support Resize modifiers in key_to_str
As seen in #715, that was not supported correctly
2016-06-30 23:49:21 +01:00
Maxime Coste
c8f5204202 Try to make the json ui more tolerant with the json input
Should improve the issues raised #714
2016-06-29 21:08:16 +01:00
Maxime Coste
511367f977 Change end of line format detection logic to match vims
Only consider a buffer to be Crlf if *all* of its lines use it, else
consider it as Lf with embedded Cr chars.

Fixes #686
2016-06-28 20:46:20 +01:00
Frank LENORMAND
eca7850203 Fix a warning about the forward declaration of SelectionList 2016-06-27 20:59:46 +01:00
Maxime Coste
e07ff0c669 Use tparm instead of tiparm as built in OSX ncurses does not support it 2016-06-27 20:59:02 +01:00
Maxime Coste
089eaa52e0 Detect recursive hook run and abort in that case
Fixes #709
2016-06-27 20:55:07 +01:00
Maxime Coste
fcf73c2293 Refactor context_wrap to share more code between draft/non draft case
Fixes #706
2016-06-22 22:27:43 +01:00
Maxime Coste
a8cf2a84c4 Add an Optional::emplace method 2016-06-22 22:17:13 +01:00
Maxime Coste
5cb9cf4cc3 Go back to saving built-in registers by default in non draft :exec/:eval 2016-06-22 19:57:21 +01:00
Maxime Coste
532ae5a1a6 Do not go backward to when selecting to end of line from the end of line
Fixes #699
2016-06-22 19:56:40 +01:00
Maxime Coste
c032306e04 Merge remote-tracking branch 'doppioandante/fix-json' 2016-06-21 23:51:15 +01:00
Maxime Coste
b77eff1b72 Fix parameter order in fputs 2016-06-21 00:47:46 +01:00
Maxime Coste
2edea2e0f6 Use fputs and fflush in ncurses_ui direct stdout access to respect buffering
Ncurses will write using the FILE* interface, using the fd based one is error
prone.

Fixes #703
2016-06-20 23:43:21 +01:00
Maxime Coste
91bf0d4622 Make window scope available to draft contexts
We do want window options/aliases/keymaps/hooks to be available in
draft context, dont we ?

Fixes #702
2016-06-20 19:45:15 +01:00
Maxime Coste
fef37e6a92 Do not preserve registers by default when exec/eval in a non draft context
Fixes #700
2016-06-20 19:40:49 +01:00
Enrico Lumetti
97680827b8 Fix JSON integer parsing 2016-06-20 16:59:32 +02:00
Maxime Coste
471c75d738 Trim trailing end of lines in %sh outputs
Fixes #698
2016-06-19 17:01:56 +01:00
Maxime Coste
b8908f2dc6 Add a String::resize method 2016-06-19 17:01:27 +01:00
Maxime Coste
f2ba54b2d4 Keep prompt displayed on <c-r> and <c-v> in prompt mode 2016-06-18 11:07:18 +01:00
Maxime Coste
34c8e6a9cf Clear up info/menus and eventual prompts when reseting to normal mode
Fixes #697
2016-06-16 19:35:43 +01:00
Maxime Coste
04d24b22bd Fix parsing of empty json objects/arrays and recover parse errors
Fixes #694
2016-06-11 13:42:25 +01:00
Maxime Coste
3059b3a253 Extract ui type parsing to its own function 2016-06-11 13:22:24 +01:00
Maxime Coste
c73e64882c Check session valididty on kak -l and support kak -clear for clearing the dead ones
Fixes #689
2016-06-06 19:28:56 +01:00
Maxime Coste
e2bfd9e3b2 Diagnose empty selection desc string
Fixes #690
2016-06-06 17:17:18 +01:00
Maxime Coste
5cab2078f8 Fix string view created from a temporary string
This is clearly a case where rust style lifetime analysis would
have been nice, hopefully it comes with GSL lifetime extensions...

Fixes #680
2016-05-24 22:36:20 +01:00
Maxime Coste
fa35330b42 Fix RankedMatch ordering where 'a < a' was true
Fixes #679
2016-05-20 18:42:01 +01:00
Maxime Coste
7280525672 Dont overwrite registers with empty macros
Fixes #674
2016-05-20 09:44:05 +01:00
Maxime Coste
6181781f3d Change dir to $HOME when no parameters are given to cd
Fixes #678
2016-05-20 09:41:29 +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
1834a67b87 Go back to libc locale and use c_regex_traits
Unfortunately, cygwin does not support c++ locales.
2016-05-19 21:45:23 +01:00
Maxime Coste
e1703204f8 fix bug in utf8_iterator 2016-05-19 20:20:42 +01:00
Maxime Coste
fb01c8c377 Do not force recreate scratch buffers by default, require edit! for that 2016-05-17 19:41:24 +01:00
Maxime Coste
49e674fe55 Fix RankedMatch::operator< with matching prefix candidates 2016-05-17 19:40:36 +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
3b6d6956e2 We do need a force redraw on resize for menu, info and status bar 2016-05-16 10:23:47 +01:00
Maxime Coste
8c6849bb04 Make HookManager safe counted 2016-05-15 10:37:42 +01:00
Maxime Coste
baf219ee2f Fix duplicate buffer problem, fix real_path beahviour 2016-05-15 10:37:01 +01:00
Maxime Coste
1788126f38 BufferManager now owns the Buffers instead of registering them 2016-05-14 08:33:50 +01:00
Maxime Coste
ba421e45f7 Delay window deletion until we get back to main loop
Avoid WinResize hooks while redrawing, ensure window resize only
take place while handling user input.

Fixes #672
2016-05-14 08:17:52 +01:00
Maxime Coste
4c8089009d Tolerate failure in setting current locale 2016-05-12 00:00:03 +01:00
Maxime Coste
84f62e6ff2 Use C++ locale based functions instead of the libc ones 2016-05-11 09:49:45 +01:00
Maxime Coste
6b1bd84e8e Allow access to end of line with horizontal moves (h and l)
Lets enable that for some time, get some feedback on that behaviour
change, and see if we keep it.
2016-05-11 00:03:45 +01:00
Maxime Coste
dd41a46c4c Correctly set c++ locale on startup
Fixes #595
2016-05-10 22:06:02 +01:00
Maxime Coste
abac6a9436 Use boost::wregex implementation and manually utf8 decode into it
That way we get proper unicode support in regular expressions as long
as the current locale treats wchar_t as unicode codepoints.

Fixes #638
Fixes #595
Fixes #162
2016-05-10 09:38:21 +01:00
Maxime Coste
bff9d45bdb Make utf8_iterator codepoint type and difference type configurable 2016-05-09 21:56:08 +01:00
Maxime Coste
e3cddf3783 Fix use of potentially null local_client
Fixes #667
2016-05-09 13:56:15 +01:00
Maxime Coste
d3aff03062 Keep a pointer to current client in windows so that window hooks can access it 2016-05-09 13:48:48 +01:00
Maxime Coste
457e11bdc9 time window display buffer update in debug profile mode 2016-05-06 00:24:54 +01:00
Maxime Coste
a132eb6b5b Expose a WinResize hook when a window changes size
Fixes #661
2016-05-04 23:27:28 +01:00
Maxime Coste
d4e9f30e5f Merge branch 'master' of git://github.com/pierroelmito/kakoune 2016-05-04 23:20:49 +01:00
pierroelmito
3044eff356 fix whitespace label
The author of this work hereby waives all claim of copyright (economic and moral) in this work and immediately places it in the public domain; it may be used, distorted or destroyed in any manner whatsoever without further attribution or notice to the creator
2016-04-30 11:59:53 +02:00
Maxime Coste
25a31534ec Fix splitting selecting the first buffer char when there is a match at buffer begin 2016-04-30 10:37:31 +01:00
pierroelmito
d4b8e28d0a add face to change whitespace colors 2016-04-30 10:35:25 +02:00
Maxime Coste
da40828801 Check all buffer are saved in :kill, and add :kill! to avoid that 2016-04-29 21:58:04 +01:00
Maxime Coste
61c155fc40 Fix wrap_lines 2016-04-27 13:55:32 +01:00
Maxime Coste
75d22a8da7 Add another missing include in shell_manager.cc 2016-04-27 09:46:53 +01:00
Maxime Coste
cf142872dc Add missing include in file.cc 2016-04-27 09:46:53 +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
717e37f2f3 Add checked, explicit conversion from strongly typed number for size_t 2016-04-27 09:46:53 +01:00
Maxime Coste
21644d17d6 Fix comparison operators in utf8_iterator and tag it as bidirectional 2016-04-27 09:46:53 +01:00
Maxime Coste
e4b9e30b31 Fix missing include in json_ui.cc 2016-04-21 20:46:41 +01:00
Maxime Coste
de033d2915 Allow equality comparison between buffer iterators from differnt buffers 2016-04-21 20:42:23 +01:00
Maxime Coste
a22b1b6bc8 Fix BufferIterator::difference_type, it should be signed 2016-04-21 20:42:16 +01:00
Maxime Coste
66a40a37cd prompt: zero password memory after running the command to be slightly more secure 2016-04-20 13:31:34 +01:00
Maxime Coste
199ccb4021 Add a -password switch to :prompt to allow for more secure password entering
Fixes #660
2016-04-19 09:51:09 +01:00
Maxime Coste
2435949fae Add support for env var name completion
Fixes #659
2016-04-17 19:21:43 +01:00
Maxime Coste
e784db4ad6 Use common completion system for OptionManager::complete_option_name 2016-04-17 19:21:08 +01:00
Maxime Coste
013519b3cb Remove iterator based regex constructor 2016-04-16 21:41:04 +01:00
Maxime Coste
f877c388fe Fix mistake in input_handler.cc 2016-04-13 23:50:49 +01:00
Maxime Coste
7833b53272 Fix support for macro being recorded and replay during :exec (non draft) 2016-04-13 21:21:49 +01:00
Maxime Coste
b0060ed79e Fix modified range computation when erasing multiple times past current buffer end
Fixes #654
2016-04-13 21:21:00 +01:00
Maxime Coste
d1b693270e ShellManager: do not open child stdin if there is no data to write to it
Fixes #383
2016-04-12 13:41:21 +01:00
Maxime Coste
a2d426abba Use padding face on the whole line 2016-04-11 21:12:27 +01:00
Maxime Coste
064e965500 Remove padding control options from ncurses ui 2016-04-11 13:54:47 +01:00
Maxime Coste
815924e4da Merge remote-tracking branch 'lenormf/buffer-padding' 2016-04-11 13:44:10 +01:00
Maxime Coste
d4b1138e2f Use a specific startup_error exception type to get a nicer message
Fixes #424
2016-04-09 09:13:35 +01:00