Commit Graph

4845 Commits

Author SHA1 Message Date
Maxime Coste
1c6aa9baed Fix bug in WrapHighlighter::do_compute_display_setup
Additional lines were not pulled correctly when a line was removed
due to its wrapping hiding the cursor.

Fixes #2999
2019-08-05 20:16:59 +10:00
Maxime Coste
e42c81c8eb Ensure current context switches away from buffer on delete-buffer
Fixes #3025
2019-07-22 20:26:39 +10:00
Maxime Coste
39445f9acb save command history in execute-keys by default
This should make #3014 unnecessary
2019-07-21 12:29:52 +10:00
Maxime Coste
1a16590960 Slight code cleanup in prompt history handling 2019-07-21 12:20:47 +10:00
Maxime Coste
b83c09509e Merge branch 'master' of http://github.com/jo-he/kakoune 2019-07-21 12:15:48 +10:00
Maxime Coste
b18ca12882 More functional style for '*' code 2019-07-21 12:14:25 +10:00
Maxime Coste
c54e0ec873 Merge remote-tracking branch 'lenormf/fix-2994' 2019-07-21 12:10:22 +10:00
Maxime Coste
be3d0f8b33 Filter non-extra_word_chars completion candidates using Codepoints
Fixes #3010
2019-07-09 19:36:57 +10:00
Maxime Coste
c2e43ee42c Use -O0 for debug builds
-Og is not nice enough to work with in gdb, control jumps around
in too unpredictible ways due to inlining.
2019-07-09 19:27:55 +10:00
Joachim Henke
556d58a073 allow for mapping the Insert key 2019-07-07 18:38:46 +02:00
Maxime Coste
3a7d0b67fa Merge remote-tracking branch 'lenormf/fix-history-size' 2019-07-07 09:14:25 +10:00
Maxime Coste
9e62d2c345 Merge branch 'master' of http://github.com/jo-he/kakoune 2019-07-07 09:13:11 +10:00
Joachim Henke
4c61f82fb2 fix a few typos 2019-07-06 17:37:30 +02:00
Tobias Kortkamp
16bb55edee
Fix build on FreeBSD
file.cc:390:21: error: use of undeclared identifier 'rename'; did you mean 'devname'?
    if (replace and rename(temp_filename, zfilename) != 0)
                    ^~~~~~
                    devname
/usr/include/stdlib.h:277:7: note: 'devname' declared here
char    *devname(__dev_t, __mode_t);
         ^
file.cc:390:28: error: cannot initialize a parameter of type '__dev_t' (aka 'unsigned long') with an lvalue of type 'char [1024]'
    if (replace and rename(temp_filename, zfilename) != 0)
                           ^~~~~~~~~~~~~
/usr/include/stdlib.h:277:22: note: passing argument to parameter here
char    *devname(__dev_t, __mode_t);
                        ^
2 errors generated.

---

highlighters.cc:1110:13: error: use of undeclared identifier 'snprintf'; did you mean 'vswprintf'?
            snprintf(buffer, 16, format, std::abs(line_to_format));
            ^~~~~~~~
            vswprintf
/usr/include/wchar.h:139:5: note: 'vswprintf' declared here
int     vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
        ^
highlighters.cc:1110:22: error: cannot initialize a parameter of type 'wchar_t *' with an lvalue of type 'char [16]'
            snprintf(buffer, 16, format, std::abs(line_to_format));
                     ^~~~~~
/usr/include/wchar.h:139:35: note: passing argument to parameter here
int     vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
                                      ^
2 errors generated.

---

json_ui.cc:60:13: error: use of undeclared identifier 'sprintf'; did you mean 'swprintf'?
            sprintf(buf, "\\u%04x", *next);
            ^~~~~~~
            swprintf
/usr/include/wchar.h:133:5: note: 'swprintf' declared here
int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
        ^
json_ui.cc:60:21: error: cannot initialize a parameter of type 'wchar_t *' with an lvalue of type 'char [7]'
            sprintf(buf, "\\u%04x", *next);
                    ^~~
/usr/include/wchar.h:133:34: note: passing argument to parameter here
int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
                                     ^
json_ui.cc:74:9: error: use of undeclared identifier 'sprintf'
        sprintf(buffer, R"("#%02x%02x%02x")", color.r, color.g, color.b);
        ^
3 errors generated.

---

regex_impl.cc:1039:9: error: use of undeclared identifier 'sprintf'; did you mean 'swprintf'?
        sprintf(buf, " %03d     ", count++);
        ^~~~~~~
        swprintf
/usr/include/wchar.h:133:5: note: 'swprintf' declared here
int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
        ^
regex_impl.cc:1039:17: error: cannot initialize a parameter of type 'wchar_t *' with an lvalue of type 'char [20]'
        sprintf(buf, " %03d     ", count++);
                ^~~
/usr/include/wchar.h:133:34: note: passing argument to parameter here
int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
                                     ^
regex_impl.cc:1197:17: error: use of undeclared identifier 'puts'
    { if (dump) puts(dump_regex(*this).c_str()); }
                ^
regex_impl.cc:1208:18: note: in instantiation of member function 'Kakoune::(anonymous namespace)::TestVM<Kakoune::RegexMode::Forward>::TestVM' requested here
        TestVM<> vm{R"(a*b)"};
                 ^
regex_impl.cc:1197:17: error: use of undeclared identifier 'puts'
    { if (dump) puts(dump_regex(*this).c_str()); }
                ^
regex_impl.cc:1283:56: note: in instantiation of member function 'Kakoune::(anonymous namespace)::TestVM<5>::TestVM' requested here
        TestVM<RegexMode::Forward | RegexMode::Search> vm{R"(f.*a(.*o))"};
                                                       ^
regex_impl.cc:1197:17: error: use of undeclared identifier 'puts'
    { if (dump) puts(dump_regex(*this).c_str()); }
                ^
regex_impl.cc:1423:57: note: in instantiation of member function 'Kakoune::(anonymous namespace)::TestVM<6>::TestVM' requested here
        TestVM<RegexMode::Backward | RegexMode::Search> vm{R"(fo{1,})"};
                                                        ^
5 errors generated.

---

remote.cc:829:9: error: use of undeclared identifier 'rename'; did you mean 'devname'?
    if (rename(old_socket_file.c_str(), new_socket_file.c_str()) != 0)
        ^~~~~~
        devname
/usr/include/stdlib.h:277:7: note: 'devname' declared here
char    *devname(__dev_t, __mode_t);
         ^
remote.cc:829:16: error: cannot initialize a parameter of type '__dev_t' (aka 'unsigned long') with an rvalue of type 'const char *'
    if (rename(old_socket_file.c_str(), new_socket_file.c_str()) != 0)
               ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:277:22: note: passing argument to parameter here
char    *devname(__dev_t, __mode_t);
                        ^
2 errors generated.

---

string_utils.cc:126:20: error: use of undeclared identifier 'sprintf'; did you mean 'swprintf'?
    res.m_length = sprintf(res.m_data, "%i", val);
                   ^~~~~~~
                   swprintf
/usr/include/wchar.h:133:5: note: 'swprintf' declared here
int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
        ^
string_utils.cc:126:28: error: cannot initialize a parameter of type 'wchar_t *' with an lvalue of type 'char [15]'
    res.m_length = sprintf(res.m_data, "%i", val);
                           ^~~~~~~~~~
/usr/include/wchar.h:133:34: note: passing argument to parameter here
int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
                                     ^
string_utils.cc:133:20: error: use of undeclared identifier 'sprintf'; did you mean 'swprintf'?
    res.m_length = sprintf(res.m_data, "%u", val);
                   ^~~~~~~
                   swprintf
[...]
2019-07-06 08:53:47 +02:00
Frank LENORMAND
78129150c9 src: Cap the maximum size of history registers
History registers (for prompt commands, pipe primitive commands etc) are
populated interactively by the users, and currently have no size limit.

This commits silently drops the oldest entries in the storage space to
allow at most 100 entries, to prevent long-running editing sessions from
hogging memory for data most likely never used.
2019-07-02 16:36:12 +03:00
Frank LENORMAND
b040bf8b81 src: Use all selections to generate a pattern upon hitting *
This commit makes the `*` and <a-*> primitives compose a search pattern
comprised of all the current selections, as opposed to only the main one.

All selections are OR'd into the default search register, which makes it
convenient to search for several identifiers already selected.

To retain the old behaviour, the following mappings can be used:

```
map global normal * ': exec -draft -save-regs "" %{<space>*}<ret>'
map global normal <a-*> ': exec -draft -save-regs "" %{<space><a-*>}<ret>'
```

Fixes #2994
2019-07-01 19:53:08 +03:00
Maxime Coste
2ff9fd8d92 Kakoune v2019.07.01 2019-07-01 22:07:29 +10:00
Maxime Coste
aff3e7d5b7 Merge remote-tracking branch 'lenormf/fix-2907-2' 2019-06-29 09:54:51 +10:00
Maxime Coste
eae92c9ae3 Merge remote-tracking branch 'codesoap/rename_moduleload' 2019-06-29 09:52:20 +10:00
Maxime Coste
e4d6bff5ec Fix quoting of tuple options
Fixes #2990
2019-06-27 22:42:12 +10:00
codesoap
ca2741fe20 Rename ModuleLoad hook to ModuleLoaded
This clarifies, that the hook is run *after* the module is loaded.
2019-06-25 19:16:47 +02:00
Frank LENORMAND
4c7bc9179b src: Enforce case sensitivity when parsing function keys
The `parse_keys()` function is case insensitive when parsing function keys,
while the `key_to_str()` function always returns a capitalized key
description.

When users hook on the lowercase name of a function key,
e.g. `NormalKey <f10>`, and later hit that same key in normal mode, the
`key_to_str()` will convert it to the uppercase description ("<F10>").

This results into a hook with a lowercase regex predicate being unsuccessfully
matched against an uppercase key description by the hook manager, which
works on a case sensitive basis.

One solution could be to uppercase all function key descriptions passed as
hook filter upon declaration, but detecting that is not trivial as the
filter can contain more than just the simple <f\d+> data, e.g.

---
hook global InsertKey '<(?<name>\w+)>' %{…}
---

Another simpler solution that this commit implements is to allow only <F\d+>
descriptions in `parse_keys()`, and hope users will know not to use the
lowercase notation when declaring hooks.

Fixes #2907
2019-06-24 18:17:49 +03:00
Maxime Coste
034e726068 Unify register saving/restoring to a Vector
The previous "optimized" history register logic was unfortunately
not restoring correctly as the order of entries in the history
register could have been mutated.
2019-06-24 19:08:48 +10:00
Maxime Coste
6e09f677f4 Fix silly typo 2019-06-23 18:11:16 +10:00
Maxime Coste
a2fce67e9d Put -Og flag in CXXFLAGS, not CPPFLAGS 2019-06-23 16:30:42 +10:00
Maxime Coste
177f38afd1 Merge remote-tracking branch 'eraserhd/debug-optimizations' 2019-06-23 12:05:21 +10:00
Maxime Coste
469818c6f9 Tweak history restoring behaviour 2019-06-23 12:05:09 +10:00
Maxime Coste
e613292568 Use register to store prompt history 2019-06-23 12:05:09 +10:00
Maxime Coste
a9e778fcc7 Add support for echo -quoting (raw|kakoune|shell) switch 2019-06-23 12:04:21 +10:00
Maxime Coste
4b7b5d077c Make quoting opt-in by using $kak_quoted_... 2019-06-23 12:04:21 +10:00
Maxime Coste
8b2906a14d Refactor option_to_string quoting support, introduce Quoting::Raw 2019-06-19 23:04:16 +10:00
Maxime Coste
125b1924ce Move dropped free windoes to the window trash 2019-06-18 21:49:41 +10:00
Maxime Coste
5888e23e02 Do not add window pointing to deleted buffers in the free window list
Fixes #2975
2019-06-16 19:12:35 +10:00
Maxime Coste
984472f681 Merge remote-tracking branch 'lenormf/fix-2966' 2019-06-15 10:48:49 +10:00
Maxime Coste
adf77c3e1d Merge remote-tracking branch 'eraserhd/fifo-fixes' 2019-06-15 10:45:55 +10:00
Frank LENORMAND
936c21da70 src: Make sure the iterator is inbound before decrementing it
Fixes #2966
2019-06-14 09:17:56 +03:00
Jason Felice
0642058b3e Fix emission of BufReadFifo events
The hook parameter should not be adjusted for the prevention of
scrolling.  Also, ensure that the last BufReadFifo is triggered if we
encounter an error or EOF after appending some data to the buffer.

Closes #2946
2019-06-11 10:11:28 -04:00
Maxime Coste
14fb71b16c Refuse to overwrite an existing session socket 2019-06-11 20:13:03 +10:00
Maxime Coste
d2dac558e7 Add a gather overload that infer element type 2019-06-10 21:57:06 +10:00
Maxime Coste
a1758bfcb0 Merge remote-tracking branch 'eraserhd/minor-remote-fixes' 2019-06-04 19:06:56 +10:00
Jason Felice
b82cf38338 Refactor message writing 2019-05-29 09:50:00 -04:00
Maxime Coste
1ebea85e6f Do not merge selections on backspace in insert mode
Fixes #2861
2019-05-29 23:12:04 +10:00
Maxime Coste
7efdbb456d Null terminate gdb auto-load script
Fixes #2929
2019-05-29 22:40:16 +10:00
Maxime Coste
262ef9b4e3 Fix BufferedWriter triggering std::terminate on exception when writing
Fixes #2932
2019-05-29 20:28:06 +10:00
Maxime Coste
7de3ea786f Fix trailing slash removal code with root directory 2019-05-29 20:14:42 +10:00
codesoap
a0e0229f20 Fix the man path for OpenBSD 2019-05-28 11:21:29 +02:00
codesoap
6788b3ae27 Avoid using gzips '-k' for compatibility
OpenBSD's gzip doesn't have '-k', but file redirection should work
everywhere.
2019-05-28 11:21:29 +02:00
Maxime Coste
a1f0bae53a Do not try to send remaining data on a closed socket
Fixes #2906
2019-05-23 12:42:38 +10:00
Jason Felice
a527aea465 Add -Og for debug builds
On my system, some optimizations are on by default (NixOS), resulting in
variables being optimized out on debug builds.  It *seems to be*
something about a "_FORTIFY_SOURCE" feature?  In any case, `-Og` is
documented as "Optimize debugging experience".
2019-05-21 08:44:26 -04:00
Robert Melton
a5bc91d67e Merge remote-tracking branch 'upstream/master' into path-improvements 2019-05-21 04:19:13 -04:00