Commit Graph

278 Commits

Author SHA1 Message Date
Maxime Coste
409d804ee8 Do not close stderr/stdout before program finish
Programs like grep called in '$' command will fail due to SIGPIPE
for example. So we need to keep the pipe open.
2015-06-08 22:42:51 +01:00
Maxime Coste
66866aafd3 Change gl/gh to only move cursor, not selecting (<a-h>/<a-l>) are unchanged
That is more consistant with other goto commands (that just move the cursor)
2015-06-08 13:51:06 +01:00
Maxime Coste
942fc224af Specify if ShellManager should read output or not using a flag
Some program (xclip), will fork a daemon keeping stdout/stderr open,
so waiting for them to be closed make kakoune hang. Commands discarding
stdout can then just not wait on it.
2015-06-08 13:45:20 +01:00
Maxime Coste
e6f0e8ef75 Move write_debug to buffer utils as write_to_debug_buffer 2015-06-06 11:54:48 +01:00
Maxime Coste
8f6fc6a0f3 Port even more code to use format function 2015-06-01 21:15:59 +01:00
Maxime Coste
f19bb4fe6d Port more code to use the format function instead of adhoc string concat 2015-06-01 19:06:35 +01:00
Maxime Coste
499bde10bd Small style tweaks 2015-05-26 18:40:39 +01:00
Maxime Coste
bb7800b1a6 Preserve window position in regex_prompt
Fixes #271
2015-05-18 13:56:58 +01:00
Maxime Coste
5bff742e0a Replace some String temporaries with StringViews 2015-04-27 16:46:57 +01:00
Maxime Coste
6e5e831ce6 Merge remote-tracking branch 'ekie/next_buffer' 2015-04-21 13:28:09 +01:00
Maxime Coste
1dfa2d7fe4 Avoid unneeded update of selections when we are going to overwrite them 2015-04-19 15:12:16 +01:00
Maxime Coste
9f65a4e6dd Remove Context::set_selections, use Context::selections() = ... 2015-04-19 15:00:37 +01:00
Eike Plack
0f9b210e3f Fix set_last_used_buffer 2015-04-15 02:36:47 +02:00
Maxime Coste
6e1a388544 Replace various adhoc operator+ based formatting with format func 2015-03-30 23:06:02 +01:00
Maxime Coste
195b813b73 Add support for Home/End keys in normal and insert mode
Fixes #260
2015-03-27 13:33:14 +00:00
Maxime Coste
727580a238 Make utf8_iterator a proper stl useable iterator 2015-03-27 13:19:30 +00:00
Maxime Coste
94bd32572d Move some only used once inline functions directly in their caller
No need to have that in a header, and not really selectors anyway
2015-03-26 13:34:21 +00:00
Maxime Coste
757366472b Add <alt-:> for ensuring selections are forward (cursor >= anchor)
Not very useful interactively, but that feature can make macros much
more robust.
2015-03-26 13:34:21 +00:00
Maxime Coste
6b3201f0f1 Change ShellManager to return both stdout and the return value in a pair 2015-03-13 13:39:18 +00:00
Maxime Coste
3c1a325b6f Refactor String, use a common StringOps interface, hide std::string 2015-03-10 19:50:22 +00:00
Maxime Coste
7af8937bac Extract remaining lambdas commands so that the cmds array can be compile time initialized 2015-03-09 14:01:17 +00:00
Maxime Coste
d1f17228dd Use a static array to store the keymap 2015-03-09 13:55:55 +00:00
Maxime Coste
1cec8df45e ArrayView content is not const anymore
As in upcoming std c++ array_view, ArrayView<T> points to mutable
data, use ArrayView<const T> or alias ConstArrayView<T> for const
data.
2015-03-09 13:54:09 +00:00
Maxime Coste
0bbaef6e48 Use a sorted array for keymap rather than an unordered map
with ~100 entry, a binary search finds in < 7 step, unordered map
is overkill.
2015-03-08 11:40:50 +00:00
Maxime Coste
4be6090107 Fix additional eol inserted when replace piping at end of buffer 2015-03-06 13:57:21 +00:00
Maxime Coste
2d93933d81 Rework keymap to use function pointer rather than std::function 2015-03-05 19:57:46 +00:00
Maxime Coste
bc7c3987e1 Convert CodepointPair to struct MatchingPair 2015-03-04 20:47:14 +00:00
Maxime Coste
00bde4ef48 Respect columns when copying selection, not just bytes 2015-02-25 13:41:00 +00:00
Maxime Coste
bf088a864c Avoid selecting buffer end when copying selection to next line 2015-02-06 22:04:42 +00:00
Maxime Coste
622919bafd Add C and alt-C for 'copy selection to next/previous line' 2015-02-05 21:25:04 +00:00
Maxime Coste
bb74770a24 Add C-f and C-b binding for page up/page down
Fixes #173
2015-01-27 23:33:22 +00:00
Maxime Coste
92cb3a035f Try to improve ga behaviour 2015-01-26 19:40:48 +00:00
Maxime Coste
bb915f0bc5 Fix filename completion 2015-01-15 19:26:38 +00:00
Maxime Coste
da562e03a0 replace all std::vector with Vector 2015-01-12 13:58:41 +00:00
Maxime Coste
295a97f2a6 Rename memoryview to ArrayView 2015-01-06 13:43:37 +00:00
Maxime Coste
8cc96ec36b Add a join function for joining strings using a specific char 2014-12-28 11:16:51 +00:00
Maxime Coste
064fb81b8d Move containers utils to containers.hh and add filtered/transformed utils 2014-12-23 13:40:26 +00:00
Maxime Coste
c454cf1379 Avoid eol after undo/redo 2014-12-18 23:17:38 +00:00
Maxime Coste
a0b35bf590 Add support for user mappings, bound to comma
:map have a 'user' mode that is accessible through the comma key.
the mapping will get executed in normal mode.
2014-12-12 13:57:02 +00:00
Maxime Coste
9c1ca303ff Change a-| to ignore output, and add ! and a-! for insert/append cmd output 2014-12-11 23:21:11 +00:00
Maxime Coste
c68c9abcac Display the register we yanked to 2014-12-11 19:36:41 +00:00
Maxime Coste
319cfcda34 Get rid of uses of unordered_set, vector is just simpler and faster... 2014-12-09 21:59:47 +00:00
Maxime Coste
77e2e8a31e Support selecting yank/paste register with " 2014-11-28 13:58:36 +00:00
Maxime Coste
da9f688f37 Fix indent/deindent when multiple selections are on same line 2014-11-28 13:22:54 +00:00
Maxime Coste
49931fbf05 Separate events between normal and urgent ones
Run urgent ones while executing %sh blocks.

Fixes #236
2014-11-25 13:52:06 +00:00
Maxime Coste
88aa707b9c For {Menu,Info}Style::Prompt, choose the anchor directly in ncurses code 2014-11-08 19:08:23 +00:00
Maxime Coste
e1fc2677e3 Add a MenuDoc style for info box, that will place it next to the menu 2014-11-08 18:01:55 +00:00
Maxime Coste
fc66c7f92f small style fix 2014-11-07 13:51:07 +00:00
Maxime Coste
c04dfc7bb7 move more parameters from const String& to StringView 2014-11-01 19:31:13 +00:00
Maxime Coste
185b980718 Add scoped aliases
aliases are now stored in window, buffer, or globally.
2014-10-30 14:02:13 +00:00
Maxime Coste
3e797a3d15 centralize bit operation support for enum used as flags 2014-10-23 19:02:39 +01:00
Maxime Coste
fc4142178f Port more code to StringView instead of const String& 2014-10-20 19:18:38 +01:00
Maxime Coste
2e0b4d02b7 Small tweak 2014-10-16 19:43:09 +01:00
Maxime Coste
894dd2e055 Add missing includes 2014-10-13 19:28:02 +01:00
Maxime Coste
fa85f0fc32 Refactor regex uses, do not reference boost except in regex.hh 2014-10-13 13:14:23 +01:00
Maxime Coste
d4a84125ef Use InternedStrings for buffer contents 2014-10-03 13:39:13 +01:00
Maxime Coste
a404886fe2 line joining will only join selected lines if selection span multiples ones
Fixes #133
2014-09-25 19:26:27 +01:00
Maxime Coste
ecf8047bcc Fix reverse search when extending 2014-09-25 13:29:53 +01:00
Maxime Coste
4c4d3cdd38 Add support for mapping keys in goto/view commands 2014-09-23 13:45:18 +01:00
Maxime Coste
9625ea64ff Add inner versions of to object begin/end selection 2014-09-23 13:37:56 +01:00
Maxime Coste
217ba625ad Use raw terminal, and handle signals manually
C-c now sends SIGINT to the process group of Kakoune server
when used in normal mode.

Fixes #30
2014-09-20 19:35:37 +01:00
Maxime Coste
2aaae7473c preserve selection direction in split lines 2014-09-19 13:45:24 +01:00
Maxime Coste
6dc223ed6a Fix spaces_to_tabs when tabs follow spaces 2014-08-28 23:19:18 +01:00
Maxime Coste
ceb10665d1 Add support for running kakoune as a filter, using -f 'keys'
It will cycle on every given files, apply the keys and write to
<filename>.kak-out. Only normal/insert mode is available, kakrc
are not read.
2014-08-14 23:51:24 +01:00
Maxime Coste
31f9d87798 Only change search register when prompt are validated
Fixes #160
2014-07-30 19:15:16 +01:00
Maxime Coste
9fe4724743 Stop macro recording on esc in normal mode
Fixes #221
2014-07-30 01:09:04 +01:00
Maxime Coste
826bf22eef fix align with multiple columns 2014-07-22 00:41:10 +01:00
Maxime Coste
a32b49acd1 Rename ColorPair to Face and ColorRegistry to FaceRegistry
Face also stores the attributes
2014-07-11 00:27:43 +01:00
Maxime Coste
b6979e2d2c Add docstring for normal mode commands and display them if autoinfo >= 2 2014-07-10 19:22:14 +01:00
Maxime Coste
4c3bd68876 Change autoinfo option to be an integer, allowing different levels 2014-07-10 19:22:14 +01:00
Maxime Coste
fc7f017372 Remove 'ReplaceMain' select mode 2014-07-05 12:37:49 +01:00
Maxime Coste
a61db7ef5e Merge remote-tracking branch 'alexherbo2/previous-match' 2014-07-05 12:36:35 +01:00
Maxime Coste
9439d28028 More consistent <space> and <a-space> behaviour
<space> and <a-space> without count now remove all except/keep
main selection. Without reducing main selection to cursor.

Reduce to cursor is moved to ';' and flip selections to <a-;>
2014-07-05 12:10:06 +01:00
Maxime Coste
d181a40a91 Add support for paste all (on <a-[pP]>)
Paste all pastes all yanked text at all selections, selecting each
pasted text.

Replace paste moves to R, and concat yank/concat delete (Y and D)
are removed.

Fixes #161
2014-07-05 12:10:06 +01:00
Maxime Coste
8795efdf19 Minor style cleanup 2014-07-05 12:10:06 +01:00
Maxime Coste
ed68d1ff28 utf8: use end of sequence iterators for more security 2014-07-05 12:10:06 +01:00
Alex Leferry 2
581dc59fb8 add alt-n commands to (replace|append) previous match
Note: alt-n command were used to replace main selection with next match
      (preserving the others)
2014-07-03 15:27:07 +02:00
Maxime Coste
ffe8143cc7 Accept upper case macro names, convert them to lower case 2014-07-01 08:48:52 +01:00
Maxime Coste
5b27b956ad Rename utf8::utf8_iterator to utf8::iterator 2014-06-24 19:10:57 +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
Alex Leferry 2
d5b1605df5 add ' ' for whitespaces object 2014-06-11 20:48:38 +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
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
1ffafa8650 Merge branch 'master' into remove-buffer-change-listener 2014-06-06 00:22:46 +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
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
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
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
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
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
1544a006c9 Fix selection update in when doing a 'replace' insert 2014-05-24 02:14:51 +01:00
Maxime Coste
b29cae4d16 Remove duplicated logic and fix insert in Replace mode 2014-05-19 18:59:14 +01:00
Maxime Coste
079d34b82a Minor cleanup in SelectionList methods 2014-05-17 12:13:49 +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
bf98b38afd Use a plain SelectionList for Context, remove DynamicSelectionList 2014-05-14 19:49:04 +01:00