Commit Graph

2538 Commits

Author SHA1 Message Date
Maxime Coste
9f65a4e6dd Remove Context::set_selections, use Context::selections() = ... 2015-04-19 15:00:37 +01:00
Maxime Coste
b570c68c75 Run BufOpenFifo hook when opening a fifo in a (new or already existing) buffer 2015-04-19 14:48:39 +01:00
Maxime Coste
95a14c5049 UndoGroupOptimizer disappeared long time ago 2015-04-18 14:17:17 +01:00
Maxime Coste
d2b6d696a2 Small layout change 2015-04-17 16:47:31 +01:00
Maxime Coste
3982131753 Fix StronglyTypedNumbers::abs 2015-04-17 01:01:58 +01:00
Maxime Coste
b584fd3bfc Fix UnorderedSet allocator 2015-04-16 23:46:26 +01:00
Maxime Coste
2902fce437 Use an UnorderedSet for string registry 2015-04-16 12:38:59 +01:00
Maxime Coste
491ffc4ffd Improve ui_options docstring 2015-04-16 11:35:52 +01:00
Maxime Coste
ea67724ff5 Optional: put the bool m_valid after the content to improve packing 2015-04-15 11:43:39 +01:00
Eike Plack
2cf45ddb21 Refactor nextbuffer_cmd 2015-04-15 02:43:16 +02:00
Eike Plack
0f9b210e3f Fix set_last_used_buffer 2015-04-15 02:36:47 +02:00
Maxime Coste
bf02838816 Remove is_blank, which is identical to is_horizontal_blank 2015-04-15 00:34:00 +01:00
Maxime Coste
eb9c95298e Add support for string <-> selection list serialization 2015-04-13 15:21:26 +01:00
Maxime Coste
731c27c094 Add a 'abs' friend function to StronglyTypedNumber 2015-04-13 15:20:47 +01:00
Maxime Coste
f93081471a Refactor nextbuffer command to be more idiomatic 2015-04-13 11:34:21 +01:00
Maxime Coste
43c03ea412 Merge remote-tracking branch 'jjthrash/next-prev-buffer' 2015-04-13 11:26:31 +01:00
Maxime Coste
be5ed0e036 Small alignement change 2015-04-12 23:48:11 +01:00
Maxime Coste
f644a51f24 Use char for KeyMapMode enum 2015-04-11 17:22:37 +01:00
Maxime Coste
cfd071b2ad small code formatting fix 2015-04-09 16:28:13 +01:00
Jimmy Thrasher
ba59033935 Add nextbuffer command
Wraps around at the end. If only 1 buffer loaded, does nothing.
2015-04-09 10:14:32 -04:00
Maxime Coste
da09da29c4 Regex comparison operator are const 2015-04-08 23:16:27 +01:00
Maxime Coste
b5ab318a2d Always optimize StringView::strlen (recursive due to constexpr) 2015-04-07 23:21:14 +01:00
Maxime Coste
87b385b956 Use default values for ncurses options when not specified 2015-04-06 20:05:49 +01:00
Maxime Coste
b7144fff6c Make ncurses wheel scroll button configurable 2015-04-06 18:43:27 +01:00
Maxime Coste
dde16b00a9 Add onkey command for executing commands after reading a key
This completes the various user interaction primitives, on_next_key
was the last not to be available through a command.
2015-04-04 13:10:39 +01:00
Maxime Coste
04a922fe1a Avoid zstr in write_debug when no *debug* buffer can be created 2015-04-03 13:14:59 +01:00
Maxime Coste
7176685690 Avoid zstr call in ncurses addutf8str 2015-04-03 13:10:46 +01:00
Maxime Coste
762f60f9fd Rewrite rgb color parsing 2015-04-02 21:27:58 +01:00
Maxime Coste
64e0b6e3f8 Replace a snprintf with format in backup file name generation 2015-04-02 13:58:06 +01:00
Maxime Coste
9edeb08e3a Avoid zero terminated string based console printing 2015-04-01 13:44:04 +01:00
Maxime Coste
4c49583fed small code tweak in format 2015-03-31 13:55:57 +01:00
Maxime Coste
e875828aa9 Use format for {Win,Buf}SetOption hooks description 2015-03-31 13:55:40 +01:00
Maxime Coste
758bfe7284 number to string conversion avoids memory allocations 2015-03-31 13:53:40 +01:00
Maxime Coste
519254dfdc More useage of the format function 2015-03-30 23:56:33 +01:00
Maxime Coste
335c73a09b Use custom implementation rather the sscanf in str_to_int 2015-03-30 23:37:55 +01:00
Maxime Coste
6e1a388544 Replace various adhoc operator+ based formatting with format func 2015-03-30 23:06:02 +01:00
Maxime Coste
13a5af70ae Add a format function for printf like formatting 2015-03-30 23:05:24 +01:00
Maxime Coste
8761fc34f4 Always go through StringView to compare strings
That avoids creating temporary String needlessly
2015-03-30 19:59:08 +01:00
Maxime Coste
8439059758 Fix wrong implicit conversions from int/Codepoint to StringView 2015-03-30 13:33:46 +01:00
Maxime Coste
adaf6ecc40 Move skip_while helpers to selectors.hh 2015-03-29 20:03:09 +01:00
Maxime Coste
56b5300b9d Handle mouse events in key_to_str 2015-03-28 18:18:52 +00:00
Maxime Coste
d1b81c8f8a minor cleanup 2015-03-27 13:47:02 +00: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
0fbbd64681 small formatting tweak 2015-03-27 13:20:37 +00:00
Maxime Coste
727580a238 Make utf8_iterator a proper stl useable iterator 2015-03-27 13:19:30 +00:00
Maxime Coste
c2150dd163 Rework show_matching highlighter implementation 2015-03-27 13:18:06 +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
e0757e7ba9 Flip the cat assistant 2015-03-25 13:53:13 +00:00
Maxime Coste
16037744b7 Add exception type name when failing with an uncaught exception 2015-03-25 13:42:36 +00:00
Maxime Coste
bc67a6547d Remove unneeded c_str() call 2015-03-25 13:42:36 +00:00
Maxime Coste
48007d5de2 Only do tty validation when using a NCursesUI 2015-03-24 19:38:03 +00:00
Maxime Coste
7eaa6976b9 Use a dummy UI when running tests, so that we do not need a tty 2015-03-24 13:14:02 +00:00
Maxime Coste
4188335b51 Fix segfault in highlighting 2015-03-23 19:21:35 +00:00
Maxime Coste
323b0359c7 Add support for mouse wheel 2015-03-22 12:17:01 +00:00
Maxime Coste
5eaf472fc0 Experimental support for mouse 2015-03-22 11:41:20 +00:00
Maxime Coste
def33de9bc Check modifiers before inserting codepoints in the line editor 2015-03-22 11:41:19 +00:00
Maxime Coste
7a7f86a205 Impreove Window::buffer_coord behaviour with invalid coords 2015-03-22 11:41:19 +00:00
Maxime Coste
dbbbc3aa80 constexprify Face 2015-03-21 16:32:22 +00:00
Maxime Coste
74ecf4976e Fix Color constructor not constexpr 2015-03-21 16:32:07 +00:00
Maxime Coste
bbfcfe4242 constexprify Color (in)equality operator 2015-03-20 19:03:41 +00:00
Maxime Coste
5cf7d650c8 Small code tweak 2015-03-19 23:33:44 +00:00
Maxime Coste
f5da1671fd Refactor number_line higlighter, use a switch to higlhight the cursor line 2015-03-19 00:31:11 +00:00
Maxime Coste
006f8ca588 Merge remote-tracking branch 'ekie/relative_line_numbers' 2015-03-19 00:03:59 +00:00
Maxime Coste
3e28539b81 Add a display coord to buffer coord method to Window 2015-03-18 23:40:26 +00:00
Eike Plack
5627d33ac3 Add support for relative line numbers 2015-03-18 22:07:57 +01:00
Maxime Coste
d3738b858b Remove unneeded include 2015-03-17 20:06:35 +00:00
Maxime Coste
4770d3d86c Change flags operator& to return a value convertible both to flags and bool 2015-03-16 18:57:18 +00:00
Maxime Coste
3921b234e7 Store fake keystrokes when selecting an insert completion candidate
Instead of storing the real 'select next completion' keystroke,
generate fake backspace/delete/char keystrokes so that replay
of the insert will insert the exact same text.

Fixes #135
2015-03-15 18:44:11 +00:00
Maxime Coste
b5854ece43 Change ParameterParser switch interface, use an Optional<StringView>
Merge has_option and option_value into a single method get_switch.
2015-03-14 19:16:46 +00:00
Maxime Coste
65fd0df041 More code style cleanup 2015-03-14 17:30:44 +00:00
Maxime Coste
8a211fc87a Tweak command docstrins 2015-03-14 12:17:43 +00:00
Maxime Coste
82833608c9 Allocate some data in advance in string algorithm 2015-03-14 11:46:53 +00:00
Maxime Coste
9657ef88b7 Small refactoring in client_manager.cc 2015-03-14 11:27:01 +00:00
Maxime Coste
adcb72e987 Minor code cleanup 2015-03-14 11:11:01 +00:00
Maxime Coste
2be6cc918b Avoid stdout/stderr as variable names 2015-03-14 01:53:17 +00:00
Maxime Coste
09e2a0b6ac Do not change the insert completion menu when a candidate is selected 2015-03-13 13:52:23 +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
dbe27d3df2 Code style change in shell_manager.cc 2015-03-13 13:25:20 +00:00
Maxime Coste
2747c4dd3e exception::what returns a StringView rather than a const char* 2015-03-13 13:15:51 +00:00
Maxime Coste
52cd08915d Keep the dir trailing slash in split_path 2015-03-13 13:09:54 +00:00
Maxime Coste
762643d320 Use correct %zu format string rather than cast 2015-03-12 20:43:21 +00:00
Maxime Coste
1a7d50b347 Minor cleanup 2015-03-12 20:40:00 +00:00
Maxime Coste
b4f6b50dbb Make split_path public 2015-03-12 20:39:34 +00:00
Maxime Coste
2f20399d03 Improve 'def' command completion behaviour and clean it up a little 2015-03-12 19:45:05 +00:00
Maxime Coste
d9cd5fef8f Avoid calling real_path when not needed in BufferManager::get_buffer_ifp 2015-03-12 19:40:10 +00:00
Maxime Coste
c57e76ee41 Cleanup parameter parser code 2015-03-12 13:58:31 +00:00
Maxime Coste
f2b8b1ae2b Fix compilation on clang 2015-03-12 13:04:53 +00:00
Maxime Coste
348e23dd8a Remove unused StaticString 2015-03-12 09:52:33 +00:00
Maxime Coste
4843643514 Always inline OnScopeEnd constructor and destructor 2015-03-11 20:52:39 +00:00
Maxime Coste
ecabfc67b7 fix warning on 32 bit compilation 2015-03-11 20:52:17 +00:00
Maxime Coste
c81a5d03c5 String tweaks 2015-03-11 19:41:44 +00:00
Maxime Coste
a0e8e4265a coords/units hashing refactoring 2015-03-11 13:59:25 +00:00
Maxime Coste
023c8afb73 Fix unneeded string copy 2015-03-11 13:58:42 +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
a0cf75ec39 Tweak WordDB implementation 2015-03-10 13:50:25 +00:00
Maxime Coste
ea526c2137 Small refactoring 2015-03-10 13:34:46 +00:00
Maxime Coste
ea42d9dd4a Remove is_in_range utility function 2015-03-09 22:37:42 +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
44f81d0b8b constexprify ArrayView 2015-03-09 13:21:43 +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
3ece7bcf75 Orderable Keys 2015-03-07 15:29:21 +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
99996902de Use a IdMap for storing hooks
The number of hook names is small (<20), using an UnorderedMap
is overkill, and prevents using StringView for key searching.
2015-03-05 14:59:27 +00:00
Maxime Coste
d1f3c1832c Small code tweak 2015-03-05 13:52:54 +00:00
Maxime Coste
bc7c3987e1 Convert CodepointPair to struct MatchingPair 2015-03-04 20:47:14 +00:00
Maxime Coste
c0e4268e17 Reactivate direct file change check on entering normal mode 2015-03-04 20:46:26 +00:00
Maxime Coste
4e02e822fd Merge remote-tracking branch 'ekie/fix_debug_cmd' 2015-03-04 09:37:06 +00:00
Maxime Coste
604e95f771 Tweak StringData::create implementation 2015-03-02 23:55:41 +00:00
Eike Plack
2354655df2 Fix documentation for debug_cmd 2015-03-02 16:38:05 +01:00
Maxime Coste
0eca3b5526 Use StringDataPtr alias for RefPtr<StringData> 2015-03-01 12:06:19 +00:00
Maxime Coste
98972c18b7 rename StringStorage to StringData 2015-03-01 12:03:08 +00:00
Maxime Coste
092dcd174f Add StaticStringStorage for storing string literals 2015-02-28 17:09:29 +00:00
Maxime Coste
f88e873f55 Add IndexSequence and make_index_sequence utilities 2015-02-28 17:08:19 +00:00
Maxime Coste
31267675b9 Small cleanup in containers utils 2015-02-27 19:32:27 +00:00
Maxime Coste
b480d6b419 Tweak BufferIterator::{+=,-=} implementation 2015-02-26 21:58:56 +00:00
Maxime Coste
00bde4ef48 Respect columns when copying selection, not just bytes 2015-02-25 13:41:00 +00:00
Maxime Coste
46f37a6050 Always inline RefPtr::{acquire,release,moved} 2015-02-24 13:43:37 +00:00
Maxime Coste
0a6901899d Use RefPtr as SafePtr backend 2015-02-23 20:39:56 +00:00
Maxime Coste
8df77121d7 Rename safe_ptr and ref_ptr to SafePtr and RefPtr 2015-02-19 13:58:25 +00:00
Maxime Coste
6c65c5e080 Add docstrings to highlighters, displayed by addhl help 2015-02-19 13:54:03 +00:00
Maxime Coste
fd3365deb1 Remove unused RegionMatch::timestamp 2015-02-17 13:56:26 +00:00
Maxime Coste
59177c12f9 Replace vector of vector in RegexHighlighter with a single vector. 2015-02-17 13:50:31 +00:00
Maxime Coste
2f890f12c6 Fix RegexHighlighter cache invalidation when changing the regex 2015-02-16 22:43:14 +00:00
Maxime Coste
e5121fe40a Wrap debug loop in ifdef KAK_DEBUG 2015-02-16 22:27:40 +00:00
Maxime Coste
8f6dab08d6 Try to limit the quantity of buffer reparsed by RegexHighlighter 2015-02-16 19:13:55 +00:00
Maxime Coste
ce950ec9f7 Fix RegexHighlighter in a few corner cases 2015-02-16 13:25:17 +00:00
Maxime Coste
53f1c35013 Fix caching of regex highlighter matches
The previous method was constantly invalidating cache when used in
conjunction with region highlighters.
2015-02-15 19:42:48 +00:00
Maxime Coste
8e6cfd3f09 Indent fix 2015-02-14 23:28:09 +00:00
Maxime Coste
8c843f5bea Add <a-h>, <a-l>, <a-x> and <a-d> bindings to line editor
<a-h> : move cursor left
<a-l> : move cursor right
<a-x> : delete char before cursor
<a-d> : delete char under cursor
2015-02-13 19:13:44 +00:00
Maxime Coste
224f73d72a Cleanup and refactor externally modified buffer reloading
* Correctly hide the reload dialog in every client.
* Correctly handle buffer being deleted.
2015-02-12 19:18:03 +00:00
Maxime Coste
6658d15741 Allow <ret> and <esc> to reload/keep an externally modified file
Fixes #113
2015-02-11 13:56:45 +00:00
Maxime Coste
790e671f6c Replace some <cstring> function usage with c++ algorithms 2015-02-10 23:09:30 +00:00
Maxime Coste
8714c41403 Do not hash rgb values for non rgb colors 2015-02-10 22:53:37 +00:00
Maxime Coste
56dd5f9540 Fix selecting of insert text in SelectionList::insert 2015-02-09 21:09:17 +00:00
Maxime Coste
ec1d5509bb Refactor ncurses assistant option handling
The option is now ncurses_assistant, defaults to clippy, none
and off a recognized to disable assistant.
2015-02-09 13:33:54 +00:00
Maxime Coste
accc510d15 Merge remote-tracking branch 'robinmoussu/cat_assistant' 2015-02-09 13:26:33 +00:00
Maxime Coste
a94c554a7b Add optional helper for commands, to get parameter dependent help
Use for the set command to document options.
2015-02-08 19:04:20 +00:00
robin moussu
0a5a37c1f2 add `assistant=cat|trombon' option
Move ascii art of assistant of top of file.

`assistant' has been renamed to `s_assistant' because it become a static
variable. It was because it `assistant()' was used in `set_ui_options' and
`make_info_box()'
2015-02-08 11:53:41 +01:00
robin moussu
239bb2dd33 Add a cat assistant! 2015-02-08 11:53:41 +01:00
Maxime Coste
0a2f2c2247 Use parameter pack to that the default hash_value is the worst match 2015-02-07 20:15:22 +00:00
Maxime Coste
5b6b04ef9c Merge remote-tracking branch 'jjthrash/not-warnings' 2015-02-06 23:22:17 +00:00
Maxime Coste
f7b8215a68 Add a from C array constructor to ArrayView 2015-02-06 23:22:01 +00:00
Maxime Coste
bf088a864c Avoid selecting buffer end when copying selection to next line 2015-02-06 22:04:42 +00:00
Jimmy Thrasher
240a004354 Fix compile warnings on OSX that could actually be errors
c++ -std=gnu++11 -g -Wall -Wno-reorder -Wno-sign-compare -pedantic -DKAK_DEBUG -MD -MP -MF .buffer.d -c -o .buffer.o buffer.cc
buffer.cc:35:20: warning: logical not is only applied to the left hand side of this comparison
      [-Wlogical-not-parentheses]
        kak_assert(not line->length == 0 and line->data()[line->length-1] == '\n');
                   ^                ~~
./assert.hh:17:18: note: expanded from macro 'kak_assert'
        if (not (condition)) \
                 ^
buffer.cc:35:20: note: add parentheses after the '!' to evaluate the comparison first
./assert.hh:17:18: note: expanded from macro 'kak_assert'
        if (not (condition)) \
                 ^
buffer.cc:35:20: note: add parentheses around left hand side expression to silence this warning
./assert.hh:17:18: note: expanded from macro 'kak_assert'
        if (not (condition)) \
                 ^
buffer.cc:177:20: warning: logical not is only applied to the left hand side of this comparison
      [-Wlogical-not-parentheses]
        kak_assert(not line->length == 0 and line->data()[line->length-1] == '\n');
                   ^                ~~
./assert.hh:17:18: note: expanded from macro 'kak_assert'
        if (not (condition)) \
                 ^
buffer.cc:177:20: note: add parentheses after the '!' to evaluate the comparison first
./assert.hh:17:18: note: expanded from macro 'kak_assert'
        if (not (condition)) \
                 ^
buffer.cc:177:20: note: add parentheses around left hand side expression to silence this warning
./assert.hh:17:18: note: expanded from macro 'kak_assert'
        if (not (condition)) \
                 ^
2 warnings generated.
2015-02-06 09:12:05 -05:00
Maxime Coste
eb5f458138 Extract directory/filename splitting in a function 2015-02-06 13:47:19 +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