Commit Graph

6236 Commits

Author SHA1 Message Date
Maxime Coste
d75a835ca1 Merge remote-tracking branch 'Delapouite/main_index' 2017-07-23 23:15:51 +02:00
Maxime Coste
d1c005dd8c Limit diff algorithm complexity
Return a non-optimal, but valid, diff when we detect too many
iterations

Fixes #1509
2017-07-23 21:33:12 +02:00
Maxime Coste
d43e2ac843 More cleanups in diff code 2017-07-20 17:47:50 +02:00
Maxime Coste
d7c0bfddd0 Merge remote-tracking branch 'Delapouite/rmhl' 2017-07-20 12:47:49 +02:00
Delapouite
720ff62f03 Fix wrong autoinfo for remove-highlighter 2017-07-20 12:08:06 +02:00
Maxime Coste
ec1824d3c3 Make non smart case full match better than smart case full match 2017-07-19 20:18:47 +02:00
Maxime Coste
016a50f213 Use smart case matching for contiguous/prefix/fullmatch detection
Fixes #1498
2017-07-19 20:16:28 +02:00
Maxime Coste
9c44077002 Require clang >= 3.6 as 3.5 is failing on debug symbol generation 2017-07-19 17:59:01 +02:00
Maxime Coste
f87afbcb65 Detect overflow using a long long for the computation result.
Closes #1306
2017-07-19 17:55:48 +02:00
Maxime Coste
d3f438810e Fix main selection handling in keep pipe ($)
$kak_reg_hash will properly contain the current selection index when
executing the shell command, fixing its use.

Fixes #1503
2017-07-19 17:42:41 +02:00
Maxime Coste
d1de9912c0 Merge remote-tracking branch 'lenormf/fix-git' into c++14 2017-07-19 17:20:18 +02:00
Maxime Coste
9c4448ac41 Remove echo -color support, superseeded by echo -markup
`echo -color Error "blah"` is the same as `echo -markup '{Error}blah'`
Fixes #1512
2017-07-19 17:18:52 +02:00
Maxime Coste
15a3d39b79 Update README for C++14 requirement 2017-07-19 11:44:00 +02:00
Maxime Coste
5ccf18d772 More use of std::enable_if_t alias 2017-07-19 08:55:24 +02:00
Maxime Coste
d37c3d175d More uses of standard type traits aliases 2017-07-19 08:49:44 +02:00
Maxime Coste
609bc24f67 Remove unused function 2017-07-19 08:49:44 +02:00
Maxime Coste
c19b9d0b8b Try to simplify back travis config 2017-07-19 08:49:43 +02:00
Maxime Coste
ba83cbee0e Use c++14 function deduction and decltype(auto) to cleanup some code 2017-07-19 08:49:43 +02:00
Maxime Coste
5bf401948a Cleanup some code with C++14 features 2017-07-19 08:47:14 +02:00
Maxime Coste
bbaa98c46d Fix travis configuration for C++14 support 2017-07-19 08:47:14 +02:00
Maxime Coste
7a79cbbc81 Migrate code to c++14 2017-07-19 08:47:14 +02:00
Maxime Coste
fbffd86f85 Add an assert to try to get more info on #1506 2017-07-19 08:40:17 +02:00
Maxime Coste
7b96d56996 Use the provided equal functor for prefix/suffix detection in diff
We were wrongly using the `==` operator.
2017-07-18 17:53:30 +02:00
Maxime Coste
bed8d9c48e Merge remote-tracking branch 'Delapouite/extra_word' 2017-07-18 17:30:33 +02:00
Maxime Coste
a547b630ef Merge remote-tracking branch 'lenormf/fix-man-expr-reserved-words' 2017-07-18 17:22:36 +02:00
Maxime Coste
9197dd393c More refactoring of the diff code in order to make it cleaner 2017-07-18 16:11:24 +02:00
Maxime Coste
50fec86749 Change diff Implementation to use end indices instead of length
Having absolute begin and relative lenght was a bit strange to
work with. Rename middle_snake to snake.
2017-07-18 12:14:52 +02:00
Frank LENORMAND
21847a5f85 rc man: Avoid undefined behavior on expr
Looking up the man page for `index` was failing on systems using
GNU/coreutils. The `:man` command matched whatever page it was given with
the `expr` utility. This tool behaves as expected when it follows strictly
the POSIX standard but the GNU implementation introduces additional commands
(including `index`), about which the standard states:

```
The use of string arguments length, substr, index, or match produces unspecified results.
```

As a result, parsing the man page number is now implemented with pure
shell expansions, to avoid triggering an undefined behavior when the topic
searched is one of the keywords above.
2017-07-17 21:24:41 +03:00
Maxime Coste
793c2ed9cf Slight style change 2017-07-17 19:29:57 +02:00
Maxime Coste
d90cd6de77 Refactor find_diff_rec and detect kept prefix/suffixes early
Certain cases, like diffing an empty buffer with a big buffer, were
very slow, now this should get better as we will directly detect the
matching eol at the end of both buffers, end then immediatly detect
we need to add the rest of the big buffer.

We still are too slow on some general diff when there is a lot of
differences.
2017-07-17 13:30:11 +02:00
Maxime Coste
388ada8142 Remove MirroredArray for diff implementation
We can index native arrays negatively, so just setup V1 and V2 to
point in the middle of the work arrays and remove the need for
creating MirroredArray.
2017-07-17 19:28:52 +09:00
Maxime Coste
da9794e272 Fix xmessage handling in assert.cc
The return value of the system call is not directly the exit value
of the process, but a status that needs to be inspected with some
macros.
2017-07-17 18:13:20 +09:00
Frank LENORMAND
8687222518 rc git: Don't force a highlighting format on commits 2017-07-17 08:36:47 +03:00
Maxime Coste
a9455bf132 Tolerate that the cursor might not be visible
Sometimes, like if the window is not high enough, we might not be
able to display any buffer lines, hence not have the cursor visible.

Fixes #1502
2017-07-16 13:12:17 +09:00
Maxime Coste
c625080ecf Merge remote-tracking branch 'lenormf/fix-formatter' 2017-07-16 13:08:04 +09:00
Maxime Coste
5eae7aacc7 Small code cleanup in diff implementation 2017-07-15 17:17:27 +09:00
Frank LENORMAND
74babc36b1 rc formatter: Don't force selection restoration
The `|` primitive now correctly restores selections, we don't need to
forcibly restore the main one after formatting anymore.
2017-07-14 11:21:48 +03:00
Maxime Coste
6e40e57ed4 Fix replacing reducing selections to their cursor
Broken by 8650c99f13
2017-07-14 16:16:43 +09:00
Maxime Coste
580eae0388 | now applies the diff of the modification instead of plain replace
Fixes #312
Fixes #1501
2017-07-14 16:16:40 +09:00
Maxime Coste
8650c99f13 Fix assertion when replacing with empty strings
Replacing with empty strings is essentially a deletion, which means
it can end up push some selections out of the buffer (imagine 3 a
2 empty line buffer, and deleting the second one). We are fixing
the selections in SelectionList::erase, but we were not doing that
in SelectionList::insert.

Fixes #1504
2017-07-14 13:08:29 +09:00
Maxime Coste
53f5b3d709 Fix an assert in compute modified ranges when merging single char ranges
Due to the way Selection::min/max worked, we were creating backward
selections, with cursor < anchor, which was triggering an assert when
trying to move cursor back one char when it was already on the first
char of the buffer.
2017-07-14 12:42:43 +09:00
Maxime Coste
26cc8b3ee0 Fix undo handling in <a-o>/<a-O> 2017-07-13 08:24:55 +09:00
Delapouite
c30aac0080 Docs: update completions_extra_word_chars → extra_word_chars 2017-07-12 19:18:24 +02:00
Delapouite
287a20c485 Add main selection index in mode_info 2017-07-12 19:08:13 +02:00
Maxime Coste
7389e37b4b Small startup message formatting tweak 2017-07-13 00:31:17 +09:00
Maxime Coste
74076ef9b7 Alternative, and hopefully safer implementation of <a-o>/<a-O>
Fixes #1495
2017-07-11 22:35:42 +09:00
Maxime Coste
81b5de6fd8 Add <a-c> and <a-d> for changing/deleting without yanking
As asked for in #1175
2017-07-11 22:25:15 +09:00
Maxime Coste
42e5d95cd8 Preserve order of definition of mappings when listing them
Fixes #1479
Closes #1494
2017-07-11 09:51:56 +09:00
Maxime Coste
ebc1e054fc Merge remote-tracking branch 'Delapouite/last-command-reg' 2017-07-11 09:11:10 +09:00
Maxime Coste
b575067317 Add <a-o> and <a-O> to add lines below/above selections
Fixes #1480
2017-07-11 09:03:45 +09:00