Commit Graph

1052 Commits

Author SHA1 Message Date
Maxime Coste
ea17525b2a Window: sanitize position in set_position 2012-10-31 14:28:47 +01:00
Maxime Coste
c947819154 Fix buffer iterator_at_line_{begin,end}(LineCount) 2012-10-31 14:28:03 +01:00
Maxime Coste
74731b0d0f refactor Client creation 2012-10-31 14:23:44 +01:00
Maxime Coste
6eef68124f use custom Client::operator=(Client&&) to drop safe counts first 2012-10-30 18:13:57 +01:00
Maxime Coste
1ea4b3998a Add a ClientManager for managing client lifetimes 2012-10-30 14:00:44 +01:00
Maxime Coste
bc7dfec44c tweak cpp highlighting 2012-10-29 19:17:48 +01:00
Maxime Coste
945f54daea fix crashes when cycling through menu with an active filter 2012-10-29 19:17:37 +01:00
Maxime Coste
254d43856d NCurses: refactor status line handling, and disambiguate status line from mode line 2012-10-29 19:01:57 +01:00
Maxime Coste
6f2c69a0eb fix adapt_for_linewise for Replace mode 2012-10-29 19:00:28 +01:00
Maxime Coste
cc876f7107 validate key in InputHandler before sending to mode, and minor refactor 2012-10-29 18:59:41 +01:00
Maxime Coste
6b664052b8 Use a Server object instead of just calling setup_server 2012-10-29 13:44:53 +01:00
Maxime Coste
ba244a70a3 NCurses: fix long lines handling 2012-10-28 11:00:23 +01:00
Maxime Coste
d9729cc29e Handle all available input before redrawing 2012-10-28 09:26:54 +01:00
Maxime Coste
13a081ed4a Remote: fix resize handling 2012-10-27 15:49:10 +02:00
Maxime Coste
b24a80a3ec NCurses::draw: maintain current column without using ncurses 2012-10-27 15:48:08 +02:00
Maxime Coste
031ed91ea6 EventManager: handle forced events even when poll return -1 2012-10-27 15:15:34 +02:00
Maxime Coste
b199cfd644 NCursesUI: force input handling reexecution when resizing 2012-10-27 15:02:17 +02:00
Maxime Coste
70cdb7a811 EventManager: add force_signal method to force event execution 2012-10-27 15:01:13 +02:00
Maxime Coste
24b43f91c8 NCurses: rework terminal resize handling 2012-10-27 14:18:52 +02:00
Maxime Coste
ee882d9d02 utf8: use CharCount instead of size_t 2012-10-27 13:26:40 +02:00
Maxime Coste
61c8ef6ce4 remote: send resize message when needed 2012-10-26 16:14:51 +02:00
Maxime Coste
73aa11ac16 remote: check read/write results, detect disconnections 2012-10-26 13:45:32 +02:00
Maxime Coste
1c3f6c314f send actual dimensions of remote client at connection 2012-10-25 12:51:01 +02:00
Maxime Coste
0735c69a92 add initial (and buggy) unix socket based client/server code 2012-10-24 21:44:19 +02:00
Maxime Coste
b9eb939e05 Add some remote client support protocol code 2012-10-23 22:55:44 +02:00
Maxime Coste
b163711963 DisplayBuffer: store lines in a vector, not a list 2012-10-23 22:55:04 +02:00
Maxime Coste
227c66cf61 use Colors and Attributes are char 2012-10-23 22:53:56 +02:00
Maxime Coste
98b6618658 merge contiguous DisplayAtoms after highlighting DisplayBuffer 2012-10-22 13:20:02 +02:00
Maxime Coste
eed8a2a57c add basic utf8 unit test 2012-10-22 01:05:56 +02:00
Maxime Coste
49237a771b some minor cleanups/refactorings in main 2012-10-21 13:09:01 +02:00
Maxime Coste
a0cca31dc1 make UserInterface unaware of Window, only of DisplayBuffer 2012-10-20 20:15:20 +02:00
Maxime Coste
48fe18ff0a memoryview: include cstddef for size_t 2012-10-20 16:40:12 +02:00
Maxime Coste
28c8acf80a assert: throw if launching xmessage fails 2012-10-19 03:53:10 +02:00
Maxime Coste
abf514f305 avoid utf8 errors with invalid keys, like ncurse KEY_RESIZE 2012-10-18 19:56:57 +02:00
Maxime Coste
132c31042e main: prepare for multi client support 2012-10-17 17:49:34 +02:00
Maxime Coste
df400f90ab utf8: replace InvalidBytePolicy::Throw with InvalidBytePolicy::Assert 2012-10-17 17:01:51 +02:00
Maxime Coste
c1387dc592 assert: simplify header 2012-10-17 17:01:08 +02:00
Maxime Coste
4aa3a36102 rename Client to InputHandler 2012-10-17 13:14:03 +02:00
Maxime Coste
1ab486b0d8 verious refactoring 2012-10-16 18:42:51 +02:00
Maxime Coste
f8abbfbb44 assert: use xmessage to block on assert failed 2012-10-16 16:16:32 +02:00
Maxime Coste
214baf4cdd add a _str user defined literal to create String 2012-10-16 15:11:22 +02:00
Maxime Coste
6ff6058ceb create_buffer_from file return nullptr on file not found instead of throwing 2012-10-16 14:59:39 +02:00
Maxime Coste
4be6882bd5 Menu: support searching through choices with /
when hitting / while in a menu, a regex filter can be entered so that only
entries matching it are selectable, <esc> disable filtering while a second
<esc> close the menu as usual.
2012-10-15 12:49:46 +02:00
Maxime Coste
148466c659 Extract basic line editing functionality from PromptMode to LineEditor 2012-10-14 16:24:35 +02:00
Maxime Coste
dfafcdb6e6 utf8::codepoint: configurable invalid byte policy 2012-10-13 19:05:14 +02:00
Maxime Coste
4f1ab5b749 fix Window::scroll_to_keep_cursor_visible_ifn 2012-10-11 14:23:20 +02:00
Maxime Coste
4210a17753 Client: never call substr(CharCount, String::npos); 2012-10-11 14:22:08 +02:00
Maxime Coste
c92077762c Makefile: add -Wall to CXXFLAGS 2012-10-11 01:17:29 +02:00
Maxime Coste
0ce6bd9bf5 use ByteCount instead of CharCount when we are really counting bytes
(that is most of the time when we are not concerned with displaying)
2012-10-11 00:41:48 +02:00
Maxime Coste
571861bc7b Return something in utf8::distance, thanks again gcc for letting this work 2012-10-11 00:39:17 +02:00
Maxime Coste
561cc72d6c Add a ByteCount unit 2012-10-11 00:13:31 +02:00
Maxime Coste
2cdebe01d3 fix make tags 2012-10-10 22:44:06 +02:00
Maxime Coste
8de754e2e9 when executing keys, propagate potentially changed editor to calling context 2012-10-10 19:15:43 +02:00
Maxime Coste
dae8f65308 exec concat all its arguments instead of accepting only one 2012-10-10 19:15:09 +02:00
Maxime Coste
ffba94fcde Actually return something in utf8::codepoint, thanks gcc for using rax 2012-10-10 19:14:18 +02:00
Maxime Coste
a04d1e3a1f Editor merge selections when they overlap 2012-10-10 19:11:24 +02:00
Maxime Coste
5bb37ad755 Support Append mode for Editor::select and use it for 'N' key 2012-10-10 13:59:55 +02:00
Maxime Coste
4c8b4890e6 Context: explicit constructors and more comments 2012-10-10 13:59:55 +02:00
Maxime Coste
74cdeb5952 Paste use a linewise mode when pasted string ends with a \n 2012-10-10 13:59:55 +02:00
Maxime Coste
b48d639976 Editor::insert handle all InsertModes 2012-10-10 13:59:55 +02:00
Maxime Coste
d574ae864d Editor::insert takes an InsertMode param, remove Editor::{append,replace} 2012-10-09 19:25:20 +02:00
Maxime Coste
7a8366da2b add a unicode.hh header for Codepoint related functions, s/utf8::Codepoint/Codepoint/ 2012-10-09 19:15:05 +02:00
Maxime Coste
e1d4215159 InsertMode insert the whole utf8 representation of a codepoint 2012-10-09 14:31:00 +02:00
Maxime Coste
c0db3b81be NCursesUI::get_key returns the codepoint 2012-10-09 14:30:35 +02:00
Maxime Coste
ba50d853b3 Editor: fix move_selection(LineCount) for utf8 2012-10-09 14:29:59 +02:00
Maxime Coste
1af7465107 utf8: add dump(OutputIterator& it, Codepoint cp) 2012-10-09 14:29:37 +02:00
Maxime Coste
c7272e427d get rid of Character 2012-10-08 19:33:53 +02:00
Maxime Coste
194bf6ac98 Buffer: add some utf8 sanity checks 2012-10-08 19:25:17 +02:00
Maxime Coste
bff015d5b9 WordCompleter: avoid word currently being edited 2012-10-08 19:14:48 +02:00
Maxime Coste
0a686573ab utf8 awareness in selectors 2012-10-08 19:12:09 +02:00
Maxime Coste
ed592a3005 DisplayAtom: add utf8 sanity check 2012-10-08 14:28:54 +02:00
Maxime Coste
5602bc10e8 DisplayAtom: only let DisplayLine touch m_begin and m_end 2012-10-08 14:28:38 +02:00
Maxime Coste
7e046e3f0b utf8 awareness in editor, highlighters and ncurses 2012-10-08 14:27:43 +02:00
Maxime Coste
5a267ab627 selections should always point to an utf8 character sequence start byte 2012-10-08 14:26:57 +02:00
Maxime Coste
f2e98f700e add utf8_iterator for adapting byte iterators to iterate on unicode characters 2012-10-08 14:25:58 +02:00
Maxime Coste
2db1d02329 add utf8 helpers in utf8.hh 2012-10-08 14:25:05 +02:00
Maxime Coste
946b4650b6 fix postfix StronglyTypedInteger::operator{++,--} 2012-10-02 14:19:45 +02:00
Maxime Coste
514aeead63 do not use our broken safe bool, c++11 explicit bool conversion is better 2012-10-02 14:18:34 +02:00
Maxime Coste
9ae8f5e47b Editor::move_selection now either takes a LineCount or a CharCount 2012-10-02 14:10:00 +02:00
Maxime Coste
669d2e456f add postfix operator++ to BufferIterator 2012-10-02 14:09:06 +02:00
Maxime Coste
9ec10daf69 move clamp to utils.hh 2012-10-02 14:08:09 +02:00
Maxime Coste
84acf2594a grep,make: tweak mktemp call to work on OSX 2012-10-02 10:37:08 +02:00
Maxime Coste
081f579ba1 OSX compilation fixes 2012-10-02 10:36:28 +02:00
Maxime Coste
4b0ccb0437 String and BufferIterator value_type goes back to plain char 2012-10-01 20:20:08 +02:00
Maxime Coste
f2f3421637 cpp.kak: fix string highlighter 2012-10-01 14:24:32 +02:00
Maxime Coste
bd0805cf3e autoenable word completion while inserting 2012-10-01 14:23:04 +02:00
Maxime Coste
29b72b3e24 Add a word completing functionality to insert mode (wip) 2012-09-30 16:24:06 +02:00
Maxime Coste
430765e132 extract is_alpha to string.hh 2012-09-30 16:23:18 +02:00
Maxime Coste
801e3eaae2 Add a Window::display_position(const BufferIterator&) method 2012-09-30 16:22:03 +02:00
Maxime Coste
6cd5d80757 Add a length method to AtomContent 2012-09-30 16:21:20 +02:00
Maxime Coste
5b6cb500fc Menus can be placed anywhere on the screen, and takes a style parameter
This paves the way for insert mode completion menu using the current
prompt menu system.
2012-09-30 15:18:37 +02:00
Maxime Coste
f230feec7f Change buffer order based on the last one used 2012-09-28 14:14:49 +02:00
Maxime Coste
79d8d082bd Store capture groups with selections in editor, and access them through dynamic registers 2012-09-26 20:43:42 +02:00
Maxime Coste
a8d2482eb6 Editor now stores selections as SelectionAndCapturesList 2012-09-26 20:33:47 +02:00
Maxime Coste
a2fd1528e6 Move last insertion from Client to Context 2012-09-26 20:07:06 +02:00
Maxime Coste
77eb86bcdb Forbid context copy 2012-09-26 14:27:23 +02:00
Maxime Coste
efc069b531 Extract IncrementalInserter::Mode as InsertMode
move ClientMode classes in a namespace due to InsertMode name collisions
2012-09-26 14:22:24 +02:00
Maxime Coste
f76323f56e Move UserInterface out of Client into Context 2012-09-26 14:13:04 +02:00
Maxime Coste
c36ee924eb cleanup BatchUI 2012-09-25 14:23:50 +02:00
Maxime Coste
730f39aaa0 remove selection stack from editor 2012-09-24 20:47:06 +02:00
Maxime Coste
747c14c19f Hide more Client Mode code in the cpp 2012-09-24 19:39:40 +02:00
Maxime Coste
a312ce6dc2 extract Client virtual methods to a UserInterface class 2012-09-24 19:24:27 +02:00
Maxime Coste
0380c999c3 move Client::Mode class definition in client.cc 2012-09-24 14:03:04 +02:00
Maxime Coste
b3c4912404 Use context.editor() instead of context.window() when a window is not needed 2012-09-24 13:56:39 +02:00
Maxime Coste
e86e3bda4d select_all_matches: reject match that start at the end of originating selection 2012-09-19 14:04:09 +02:00
Maxime Coste
81eae79154 ncurses: fix displaying of lines longer than screen 2012-09-17 21:38:51 +02:00
Maxime Coste
b245b39a85 RegexColorizer: store ColorPairs by pointer so that alias changes are taken into account 2012-09-17 21:02:08 +02:00
Maxime Coste
a92a6dc7f3 ColorRegistry: permit overriding an alias 2012-09-17 21:01:11 +02:00
Maxime Coste
4d369d6290 kakrc: use color aliases for cpp and kakrc highlighting 2012-09-17 19:02:08 +02:00
Maxime Coste
5cf947f845 Add a ColorRegistry class responsible of color parsing and supporting aliases
colalias command permits to define names for color pairs
2012-09-17 19:01:13 +02:00
Maxime Coste
45bffd8b8a fix parse_keys for <esc> 2012-09-17 13:46:34 +02:00
Maxime Coste
00e357ed56 PromptMode: fix completion of non-last parameters 2012-09-17 13:37:08 +02:00
Maxime Coste
ebae75e96e fifo: buffer size is 4k instead of 512 2012-09-14 14:29:54 +02:00
Maxime Coste
f6d2533cae rework fifo handling, use real fifos in {make,grep}.kak, update README 2012-09-12 19:54:46 +02:00
Maxime Coste
a467d73115 use parse_filename when opening files or completing filenames so that ~ and env vars are handled 2012-09-12 19:42:12 +02:00
Maxime Coste
6f6f10c83d simplify tab completion code in Client::InsertMode 2012-09-12 19:09:27 +02:00
Maxime Coste
ec57990060 whine when a search selected nothing so that the user knows 2012-09-12 19:09:10 +02:00
Maxime Coste
cfbe32f6a2 support Tab/BackTab keys in MenuMode as well 2012-09-12 14:25:14 +02:00
Maxime Coste
7266052d46 grep command uses file completion 2012-09-12 14:22:01 +02:00
Maxime Coste
7c039585a4 add -file-completion option to def command and document in README 2012-09-12 14:21:42 +02:00
Maxime Coste
62e50c38fa commands.cc: cleanup 2012-09-11 19:09:55 +02:00
Maxime Coste
9dfccddca8 Correctly handle arrow keys in insert mode 2012-09-11 19:09:14 +02:00
Maxime Coste
e39086cd5f Buffer: reset undo data after executing hooks in constructor 2012-09-11 19:03:37 +02:00
Maxime Coste
a0b75817a5 do not keep undo data in the debug buffer 2012-09-11 19:03:13 +02:00
Maxime Coste
eac68f09a4 NCursesClient::show_menu: stop displaying counts in front of items 2012-09-11 14:30:32 +02:00
Maxime Coste
859e907396 fix NCursesClient::menu_select for one past last item 2012-09-11 14:28:54 +02:00
Maxime Coste
ee4c6b04a6 Support Shift-Tab in prompt mode to go back in completions 2012-09-11 14:27:21 +02:00
Maxime Coste
b5a2901f8d add 'r' for replacing selection with next typed char 2012-09-11 14:01:41 +02:00
Maxime Coste
f8a6045307 Load config file in ${XDG_CONFIG_HOME}/kak/kakrc and ${XDG_CONFIG_HOME}/kak/autload/*
Do not autoload files in $kak_runtime/rc, let the user choose
restore the runtime command implemented in shell this time.
2012-09-10 20:45:34 +02:00
Maxime Coste
82a2bb37e7 Remove runtime command, use shell expansion to source files in rc dir.
With the help of a new kak_runtime env var.
2012-09-10 20:10:18 +02:00
Maxime Coste
f9e31856cf Buffer: Allow inserting at the end when the inserted text ends with an end of line
Adapted other code in consequence and added unit tests so that this behavior
is maintained.
2012-09-10 19:26:17 +02:00
Maxime Coste
a37b14785f use -shell-params in rc files 2012-09-09 17:14:08 +02:00
Maxime Coste
ae76b7dddc Add support for shell script parameters
Now %sh{ ... } can access positional parameters through
standard shell construct, allowing simple handling of variable
parameters.

def command accepts -shell-params flag to use this facility.
2012-09-09 17:10:53 +02:00
Maxime Coste
46565723b1 Add support for page up and page down 2012-09-07 21:09:23 +02:00
Maxime Coste
499bb77491 Cleanup Key handling, use symbolic names for function keys 2012-09-07 20:22:19 +02:00
Maxime Coste
287628ec19 Editor::{select,move_cursor} takes a enum SelectMode parameter instead of a boolean 2012-09-07 14:29:29 +02:00
Maxime Coste
1e18dcba0f fix Client::repeat_last_insert when no last insert 2012-09-07 14:28:27 +02:00
Maxime Coste
4e356a6312 kakrc.kak: fix comments highlighting 2012-09-06 14:30:09 +02:00
Maxime Coste
96beaf50dd ShellManager: output stderr in the debug buffer 2012-09-06 14:28:07 +02:00
Maxime Coste
ddd5236b08 cpp.kak: smarter alt command 2012-09-06 13:38:51 +02:00
Maxime Coste
41b0751a5d tweak make output highlighting 2012-09-06 13:35:36 +02:00
Maxime Coste
16e1c2daf9 simplify menu api 2012-09-05 19:02:06 +02:00
Maxime Coste
11d86ca3f3 fix Selection::merge_with 2012-09-05 14:27:48 +02:00
Maxime Coste
bf42d77469 Handle inserting in Client::InsertMode 2012-09-05 14:27:14 +02:00
Maxime Coste
d4446d1525 Client: fix history search 2012-09-05 00:52:09 +02:00
Maxime Coste
5c4df507c4 ncurses: colorize the menu 2012-09-05 00:49:59 +02:00
Maxime Coste
3f64c36654 fix NCursesClient::show_menu with big menu entries 2012-09-05 00:37:09 +02:00
Maxime Coste
bdaa083c88 Factor select to next char commands using Client::on_next_key 2012-09-05 00:30:59 +02:00
Maxime Coste
737ee8af24 use on_next_key in do_go and do_select_object 2012-09-05 00:21:42 +02:00
Maxime Coste
b23425764e Add client::on_next_key method to run some code when the next key arrives 2012-09-05 00:21:19 +02:00
Maxime Coste
aac30a27e7 use more constexpr 2012-09-04 23:54:10 +02:00
Maxime Coste
63f467081a Prompt: use entered text as prefix for history search 2012-09-04 13:48:04 +02:00
Maxime Coste
11d5ae2743 add override markers 2012-09-04 00:17:41 +02:00
Maxime Coste
0e6ced9176 cleanup cpp.kak 2012-09-04 00:08:01 +02:00
Maxime Coste
2e339e92bb Allow arrow keys in prompt mode 2012-09-04 00:07:13 +02:00
Maxime Coste
d530a2d864 Support # comments in commands 2012-09-04 00:04:49 +02:00
Maxime Coste
57b89099ec Client::MenuMode wrap through options with j/k Ctrl-n/Ctrl-p and tab 2012-09-04 00:02:50 +02:00
Maxime Coste
c4dd6b4038 Client::MenuMode map tab as SelectNext 2012-09-03 23:55:11 +02:00
Maxime Coste
69bebdb44e fix open line above for first line and add a unit test 2012-09-03 23:46:04 +02:00
Maxime Coste
c61f9cbe6b Add MenuCommand::SelectNone and use it when tab completions goes back to original string 2012-09-03 19:34:10 +02:00
Maxime Coste
c2a4f68899 NCurses: Fix menu display 2012-09-03 19:20:41 +02:00
Maxime Coste
b08d8719e6 move input handling, including menu and prompt, to the Client class 2012-09-03 14:22:02 +02:00
Maxime Coste
d5f5f0989d fix control key parsing 2012-09-03 19:21:11 +02:00
Maxime Coste
96a50e9b7d NCurses: use menu for tab completion 2012-08-31 14:14:16 +02:00
Maxime Coste
51e80558d9 Change client menu api to give more control to the caller 2012-08-30 21:53:22 +02:00
Maxime Coste
1ca502d23d More useable menu implementation on ncurses 2012-08-30 21:14:28 +02:00
Maxime Coste
78d4675c24 git.kak: tweak highlighting 2012-08-30 18:56:05 +02:00
Maxime Coste
f1d8d0add8 escape whitespaces in filename or buffername completions 2012-08-29 21:52:17 +02:00
Maxime Coste
2825bc3d7b Fix escaped whitespace handling in command manager 2012-08-29 21:50:48 +02:00
Maxime Coste
bbce6b22a3 remove regex.hh, define Regex directly in string.hh 2012-08-29 21:49:36 +02:00
Maxime Coste
8febec0bcf add_hook: do not construct a regex again and again 2012-08-29 14:15:13 +02:00
Maxime Coste
8263adf8c8 make.kak: fix highlighting 2012-08-29 14:13:59 +02:00
Maxime Coste
1fc05c8bb0 make.kak: fix parameter passing 2012-08-29 14:03:55 +02:00
Maxime Coste
2b8c636377 use fifo buffers for grep and make command 2012-08-29 00:35:45 +02:00
Maxime Coste
db98bcc278 Add an -fifo option to the 'edit' command
In -fifo mode, the buffer's file is used as a fifo, writes are tracked
and udpated in the buffer. This should be useful for grep and make
commands.
2012-08-29 00:17:37 +02:00
Maxime Coste
00d32fd392 main: EventManager should be destroyed after the Buffers 2012-08-29 00:11:16 +02:00
Maxime Coste
2d82e2a2c6 fix ShellManager, avoid zombie childs when grand childs detaches themselves 2012-08-29 00:08:39 +02:00
Maxime Coste
ab47b72dc8 add a poll based EventManager and use it for ncurse client update 2012-08-28 22:32:15 +02:00
Maxime Coste
d5dc5dff7f ncurses: refresh at end of draw_window 2012-08-28 22:31:06 +02:00
Maxime Coste
4cdddb7e6d BufferManager: protect complete_buffername from regex_error 2012-08-28 21:46:49 +02:00
Maxime Coste
217b3d2bce fix compilation on OSX 2012-07-30 14:12:49 +02:00
Maxime Coste
1833cb4dcf use a separate context for kakrc execution 2012-08-28 14:10:44 +02:00
Maxime Coste
db1e2f2d86 fix complete_filename 2012-08-28 14:10:05 +02:00
Maxime Coste
96c6adad78 IncrementalInserter: Fix avoid_eol behavior 2012-08-27 14:26:16 +02:00
Maxime Coste
350b578eb5 grep.kak: do not quote params 2012-08-23 23:56:35 +02:00
Maxime Coste
e4fd839dda use a strongly typed int CharCount for character counts 2012-08-23 23:56:35 +02:00
Maxime Coste
0d8cce2728 use a strongly typed int LineCount for line counts 2012-08-22 23:33:52 +02:00
Maxime Coste
c6e8080426 do_go: some cleanups 2012-08-21 20:58:10 +02:00
Maxime Coste
3f471c138a RegexColorizer: fix last buffer line highlighting 2012-08-21 20:53:23 +02:00
Maxime Coste
0eaf39b725 Add Buffer::iterator_at_line{begin,end}(size_t line) overloads 2012-08-21 20:52:49 +02:00
Maxime Coste
05098a373a edit command: when a line is specified ask the window to center it 2012-08-21 20:08:57 +02:00
Maxime Coste
26313a3f68 bind <a-c> to window::center_selection 2012-08-21 20:06:35 +02:00
Maxime Coste
c9a7cf50f3 add Window::center_selection method 2012-08-21 20:05:56 +02:00
Maxime Coste
45b9ac6087 fix parse_keys for <a-key> 2012-08-21 20:03:18 +02:00
Maxime Coste
1515566e4b Allow context with client and non-window editor 2012-08-17 20:18:36 +02:00
Maxime Coste
7cc5ff7c73 fix create_buffer_from_file when file does not exists 2012-08-17 18:52:04 +02:00
Maxime Coste
8a6e8cd898 RegexColorizer: Fix range computation 2012-08-17 18:42:07 +02:00
Maxime Coste
b6460aaec7 make.kak: style fix 2012-08-17 18:41:40 +02:00
Maxime Coste
4b93a90047 grep.kak: use perl regex syntax and quote parameters 2012-08-17 12:39:57 +02:00
Maxime Coste
c1fcc593a1 Store the current client in context 2012-08-15 22:36:45 +02:00
Maxime Coste
a2aefa2998 avoid keeping end of lines selected in Editor::erase 2012-08-15 18:20:02 +02:00
Maxime Coste
416785f53c Add BufferIterator::clamp(bool avoid_eol) method 2012-08-15 18:18:12 +02:00
Maxime Coste
390d4ccdfc Buffer::{iterator_at,clamp} takes an optional avoid_eol parameter
when avoid_eol is true, clamping does avoid end-of-line if possible
2012-08-15 18:06:59 +02:00
Maxime Coste
260b30e6d9 misc cleanups 2012-08-15 17:55:58 +02:00
Maxime Coste
346108ec62 CommandManager::parse: fix invalid memory read 2012-08-15 17:34:01 +02:00
Maxime Coste
99eaa259e6 Context: do not store buffer, ask editor for it 2012-08-15 17:32:46 +02:00
Maxime Coste
9e3323bf68 RegexColorizer only cache a range instead of the whole buffer 2012-08-15 17:24:08 +02:00
Maxime Coste
6e70b805df colorize_regex become RegexColorizer and maintain a cache of matches 2012-08-15 17:08:48 +02:00
Maxime Coste
5393e9e78b Buffer: add a timestamp 2012-08-15 17:07:53 +02:00
Maxime Coste
14475e91cb rc/grep.kak: style fix 2012-08-14 14:27:32 +02:00
Maxime Coste
e00c811712 complete_buffername try regex matching when prefix matching does not work 2012-08-14 14:26:36 +02:00
Maxime Coste
b630189ce5 Add a writeall (wa) command 2012-08-14 14:20:18 +02:00
Maxime Coste
4e34f777b0 Buffer: stronger invariant, a buffer is never empty and all lines finish by '\n' 2012-08-14 14:13:10 +02:00
Maxime Coste
b37f8f470a use new reg access syntax in rc files 2012-08-11 12:14:17 +02:00
Maxime Coste
0a976cd309 CommandManager: support %reg{<reg>} and %opt{<option>} syntax 2012-08-11 12:13:48 +02:00
Maxime Coste
808e79a53e commands: code cleanup 2012-08-11 11:48:54 +02:00
Maxime Coste
759319ca44 Buffer: move back Modification as an implementation detail
* Filters now only works on insertion and take directly the
   iterator and content
 * use Buffer::insert and Buffer::erase to modify a buffer
2012-08-10 19:12:43 +02:00
Maxime Coste
44621bff11 detect byte order mark in buffers, and write back 2012-08-10 18:48:21 +02:00
Maxime Coste
7d3675fe33 make.kak: quote echo parameter in errjump 2012-08-10 18:47:54 +02:00
Maxime Coste
20655f9290 ShellManager: fix option regex, allow caps 2012-08-10 18:47:18 +02:00
Maxime Coste
d81a100a85 support crlf line ending when reading and writing buffers 2012-08-10 14:24:13 +02:00
Maxime Coste
54b599c1a7 Buffer: fix corner case in insert 2012-08-10 14:22:57 +02:00
Maxime Coste
c7fc2a9317 Buffer: add reset_undo_data method 2012-08-10 14:21:32 +02:00
Maxime Coste
e5c46d7c45 Window,Buffer: add const overload for {option,hook}_manager 2012-08-10 14:21:01 +02:00
Maxime Coste
a30b3e1343 highlight_range: handle empty ranges 2012-08-10 14:20:15 +02:00
Maxime Coste
f59dd77f60 add rc/asciidoc.kak for asciidoc highlighting 2012-08-08 19:38:27 +02:00
Maxime Coste
1eb2b8321b make.kak: errjump also display the error description in the status line 2012-08-08 19:37:32 +02:00
Maxime Coste
691a6328b1 exec_keys: use the context editor, no need for a new one 2012-08-08 19:37:04 +02:00
Maxime Coste
ce99856bfa Refactor BufferManager 2012-08-08 19:36:40 +02:00
Maxime Coste
b29b75aa81 Regex Highlighter: highlight 10 lines above and below displayed range
and some code cleanup
2012-08-08 19:02:36 +02:00
Maxime Coste
1ede3f6b13 BufferIterator: use default operator= 2012-08-08 18:51:30 +02:00
Maxime Coste
939dc0fa8e Makefile: use -MMD to generate deps instead of using separate steps 2012-08-08 13:39:31 +02:00
Maxime Coste
e7153aacef rc/{grep,make}.kak: use a scratch buffer to store results 2012-08-07 23:29:12 +02:00
Maxime Coste
78b0c2f7f5 kakrc: fix string highlighting 2012-08-07 23:26:40 +02:00
Maxime Coste
25a1a9c159 Fix do_pipe 2012-08-07 23:25:54 +02:00
Maxime Coste
8e0f99a03b write command refuse to write a scratch file when no filename is given 2012-08-07 23:20:53 +02:00
Maxime Coste
207f2f6bb9 edit commands accept a -scratch flag to edit not to be saved file 2012-08-07 23:20:11 +02:00
Maxime Coste
dd05d6c6f5 BufferIterator: fix operator+ 2012-08-07 23:18:37 +02:00
Maxime Coste
b0ed0e37b7 add rc/grep.kak which provides a grep and gjump command 2012-08-07 14:29:33 +02:00
Maxime Coste
a88da08767 add rc/make.kak which provides make and errjump commands 2012-08-07 13:52:49 +02:00
Maxime Coste
6a660f7e8f ncurses: refresh at the end of print_status so that the status is immediately visible 2012-08-07 14:21:26 +02:00
Maxime Coste
2cac18545e define_command: remove unused param from parser definition 2012-08-07 14:26:51 +02:00
Maxime Coste
718f62b6a3 support line and column in command line parameters 2012-08-07 14:00:47 +02:00
Maxime Coste
b3c293a9da cpp.kak: also try to detect cpp files using the file tool 2012-08-07 13:51:51 +02:00
Maxime Coste
4bfe46a882 kakrc: tweak highlighting 2012-08-07 13:51:21 +02:00
Maxime Coste
661c9db925 colorize_regex_factory: transform boost::regex_error in Kakoune::runtime_error 2012-08-07 00:32:21 +02:00
Maxime Coste
c166bc92e3 use new regex highlighter features in rc files 2012-08-07 00:28:55 +02:00
Maxime Coste
02b7786bcd fix complete_filename 2012-08-07 00:16:51 +02:00
Maxime Coste
b69134c36f new regex highlighter parameters syntax, support per capture highlight 2012-08-07 00:13:54 +02:00
Maxime Coste
a38a9c3bf2 Commands take a mutable context, main_context is gone ! 2012-08-06 22:02:11 +02:00
Maxime Coste
a712dd5bbe Completions functions take a Context parameter 2012-08-06 21:37:43 +02:00
Maxime Coste
39797f87dc command_manager: cleanup command execution, lazy exec shell commands 2012-08-06 19:29:51 +02:00
Maxime Coste
4dc9973288 Registers need a context to return their values 2012-08-05 20:13:41 +02:00
Maxime Coste
18ca422306 Context: only buffer context are not allowed, an editor is always needed 2012-08-05 20:12:43 +02:00
Maxime Coste
1ce2d3e302 cleanup keymap definition 2012-08-05 19:53:39 +02:00
Maxime Coste
0164d78c10 Use a context as parameter to keymap functions 2012-08-05 19:39:37 +02:00
Maxime Coste
12e2ce0f3c Context: store an editor instead of a window 2012-08-05 18:23:37 +02:00
Maxime Coste
2cc01d3407 move SafeCountable functionality to Editor from Window 2012-08-05 18:23:09 +02:00
Maxime Coste
d91070f5b7 Context: add a numeric_param property 2012-08-05 16:46:10 +02:00
Maxime Coste
9fcb89c8fc Window: tolerate invisible cursor when it is the end of the buffer 2012-08-02 07:04:42 +02:00
Maxime Coste
23f72851e4 Buffer: fix insert at end of buffer 2012-08-02 07:04:04 +02:00
Maxime Coste
407782a742 command_manager.cc: use anonymous namespace 2012-08-02 06:41:55 +02:00
Maxime Coste
2d2ac98511 fix global.kak, eval command no longer exists 2012-08-02 06:41:08 +02:00
Maxime Coste
2071db3558 Tokens are CommandManager implementation details
CommandParameters go back to memoryview<String>
2012-08-01 14:27:34 +02:00
Maxime Coste
36070dd429 CommandManager: rework command parser
a new type of strings is supported inspired by the ruby strings.
%<delimiter>content<delimiter>, if opening delimiter is one of
([{<, then closing delimiter is the matching )]}> and balanced
delimiters in the string needs not to be escaped, else the closing
delimiter is the same as the opening one.

shell expansion is available through %sh<delimiter>command<delimiter>
syntax.

Command flags have been removed, as these strings provide proper nesting
support, so now, you can for example do:

def command %{ echo %sh{ ls } }
2012-07-31 14:22:57 +02:00
Maxime Coste
ac2676cbcf ShellManager: catch all exception once we are in child process 2012-07-31 14:21:25 +02:00
Maxime Coste
b65f8cc887 CommandParameters is a list of Tokens instead of Strings
CommandManager string parsing is less ad-hoc.
2012-07-31 00:06:50 +02:00
Maxime Coste
a3cb9bfc5e editor.cc: remove unused id_not_unique 2012-07-30 13:39:38 +02:00
Maxime Coste
6bd67c01cc refactor insertion and insertion replay functions 2012-07-27 10:22:33 +02:00
Maxime Coste
0e9b0c8b3a insert_char: remove 'ctrl-r %' handling, already provided by dynamic register 2012-07-25 14:29:51 +02:00
Maxime Coste
af203b2b94 diff.kak: recognize patch files 2012-07-25 14:14:25 +02:00
Maxime Coste
6fc0432e9f add inline keyword in cpp highlighting 2012-07-20 13:36:06 +02:00
Maxime Coste
435797e34f global: quote tag pattern 2012-07-18 19:03:20 +02:00
Maxime Coste
399b9b6235 optimize regex highlighter's regex 2012-07-18 19:02:41 +02:00
Maxime Coste
4908b2c3ef Fix end_it computation in Buffer::insert, avoid clamping in iterator_at 2012-07-18 14:12:41 +02:00
Maxime Coste
c915e18950 Move selection to last modification position in editor::{undo,redo} 2012-07-16 21:53:00 +02:00
Maxime Coste
31c0931dff Go back to a generic BufferChangeListener interface for selection update 2012-07-16 21:51:37 +02:00
Maxime Coste
fe988868e5 IncrementalInserter preserves selections 2012-07-16 21:21:56 +02:00
Maxime Coste
5a671db12c Correct multi select unit test 2012-07-16 21:14:52 +02:00
Maxime Coste
1d5180e782 Window: handle horizontal scrolling correctly
Window::scroll_to_keep_cursor_visible_ifn now highlights the cursor
line in order to find its real display position (for example if the
number_lines highlighter is present it may modify the position).
2012-07-15 01:48:50 +02:00
Maxime Coste
6e072d1a61 ncurses: fix first ~ line drawing 2012-07-12 23:59:02 +02:00
Maxime Coste
03d8efc249 DisplayBuffer: add range and compute_range methods 2012-07-12 23:51:13 +02:00
Maxime Coste
b1a087485c DisplayBuffer rewrite, a DisplayBuffer is now a list of DisplayLines
Code is now greatly simplified using this architecture, and
DisplayAtoms no longer know their DisplayCoords and can be in any
order.
2012-07-12 23:19:10 +02:00
Maxime Coste
2830825c56 BufferIterator: allow invalid iterator in operator= 2012-07-12 23:11:16 +02:00
Maxime Coste
71fcc123bc Window: remove iterator_at and line_and_column_at methods 2012-07-12 14:28:58 +02:00
Maxime Coste
06dd3f8aad Add Editor::replace(memoryview) and bind alt-P to replace paste 2012-07-11 14:15:27 +02:00
Maxime Coste
5cbded8221 make display buffers and highlighters handle better longer than display lines
still work in progress, I think the whole display system will in fact need
a rewrite.
2012-07-03 23:23:07 +02:00
Maxime Coste
d092afead9 make DisplayBuffer::atom_containing easier to understand 2012-07-03 21:12:05 +02:00
Maxime Coste
d7e1cab116 DisplayAtom: support empty replacement 2012-07-03 19:13:16 +02:00
Maxime Coste
603cfd3108 do not catch exception in commands, let them propagate 2012-06-30 00:44:14 +02:00
Maxime Coste
f11d44246c add safe_ptr::operator=(safe_ptr&&) and safe_ptr::reset(T*) 2012-06-30 00:33:36 +02:00
Maxime Coste
dfbda951d3 support static and dynamic registers, add '%' (filename) and '.' (selection) registers 2012-06-29 18:37:17 +02:00
Maxime Coste
5b2ef1da6a IncrementalInsertor::insert takes a memoryview<String> rather than a Register 2012-06-29 18:35:48 +02:00
Maxime Coste
7aa533c049 simplify Register interface 2012-06-29 13:25:34 +02:00
Maxime Coste
49e1d91804 Buffer: pass by value instead of by reference when object will be copied anyway
Let copy elision and move semantics kick in
2012-06-29 13:19:29 +02:00
Maxime Coste
36e4dacdf5 Fix BufferIterator::on_erase and tweak Buffer 2012-06-28 14:26:01 +02:00
Maxime Coste
9b6b6b6b17 Rename UI to Client 2012-06-28 14:11:43 +02:00
Maxime Coste
286462a2f6 Add Context::option_manager()
it returns the more specific option manager available
(window -> buffer -> global)
2012-06-28 14:01:37 +02:00
Maxime Coste
9c78453cb7 Context references buffer and window with a safe_ptr 2012-06-28 13:46:14 +02:00
Maxime Coste
4dfc910195 BufferManager use safe_ptr to reference the Buffers 2012-06-28 13:45:42 +02:00
Maxime Coste
1289268174 Add SafeCountable and safe_ptr classes
safe_ptr is a smart pointer which manage a safe count in pointed
objects. SafeCountable provides the interface needed for safe_ptr
and assert the safe count is zero in destructor.

This permits to have pointers that guarantees their pointed object is
alive.
2012-06-28 13:42:55 +02:00
Maxime Coste
e7e9b8a6cd add rc/diff.kak and load in kakrc 2012-06-27 14:29:12 +02:00
Maxime Coste
70bd18e1f2 add kak_opt_.* environement variable retriever to access options from shell. 2012-06-27 14:28:43 +02:00
Maxime Coste
ecb3a737a9 Tweak String class, and cleanup usages
remove String::clear, add operator=(String&&) add str_to_int(const String&)
to replace atoi.
2012-06-27 14:26:29 +02:00
Maxime Coste
7fb49b183e ShellManager environment variable use a regex instead of an exact match
when a kakoune releated env var used in a shell command, the ShellManager
tries to match it with given regex and the first that matches calls its
value retriever.

For this to be useful, EnvVarRetrievers now also take the variable
name in its parameters.
2012-06-25 19:40:18 +02:00
Maxime Coste
cffb895797 remove ugly id_to_str param in idvaluemap and str_to_str 2012-06-25 19:11:13 +02:00
Maxime Coste
ccec35f88c code cleanups in buffer 2012-06-25 19:05:32 +02:00
Maxime Coste
d1c4a655b9 git.kak: use filetype option 2012-06-15 14:24:57 +02:00
Maxime Coste
11e8d07797 cleanup kakrc.kak 2012-06-14 21:52:47 +00:00
Maxime Coste
c8fdbc2a60 support buffer as a hook target 2012-06-14 20:51:01 +00:00
Maxime Coste
0e8add34ae delete buffer deletes the current buffer when no params given 2012-06-14 18:05:42 +00:00
Maxime Coste
eb34f6db73 execute BufClose hook in Buffer destructor 2012-06-14 17:44:28 +00:00
Maxime Coste
fd8517f91e fix some warnings detected with clang 2012-06-05 13:33:02 +00:00
Maxime Coste
5936aa6710 rework cpp.kak and kakrc.kak to use the filetype option 2012-06-14 13:21:22 +00:00
Maxime Coste
dc91f344f7 Reorder managers creation in main 2012-06-14 13:20:40 +00:00
Maxime Coste
f7ee2801e9 Windows call the WinSetOption hook when an option changes 2012-06-14 13:19:38 +00:00
Maxime Coste
a943e08dc7 Refactor OptionManager, add OptionManagerWatcher
- use set_option to set an option, instead of operator[] (no-const)
- keeps a list of OptionManagerWatcher to notify when an option change
  it also notifies when an option changes in his parent and the option
  is not overridden.
2012-06-14 13:16:44 +00:00
Maxime Coste
109c11f29c BufferManager deletes remaining buffers in his destructor 2012-06-14 13:15:30 +00:00
Maxime Coste
cab03ef1c6 When creating an Option, OptionManager takes it's initial value from it's parent if possible 2012-06-12 18:28:25 +00:00
Maxime Coste
bc359d7c90 BufCreate hook is always called for every buffer, BufNew is called when creating a new file 2012-06-12 18:27:57 +00:00
Maxime Coste
20315eac85 replace Option::operator {String,int} with Option::as_{string,int} 2012-06-12 18:26:20 +00:00
Maxime Coste
c0987ebacc Add a FilterGroup, and cleanup HighlighterGroup
FilterGroup is similar to HighlighterGroup, it permits grouping
together filters for easy removal.
2012-06-12 18:24:29 +00:00
Maxime Coste
5710893dd5 Cleanup utils.hh, remove auto_raii in favor of on_scope_end 2012-06-12 18:45:13 +00:00
Maxime Coste
e36b3565bf call SetOption hook when setting an option 2012-06-12 13:10:52 +00:00
Maxime Coste
67c6b6834e execute kakrc after creating an UI 2012-06-12 13:10:33 +00:00
Maxime Coste
9bcfda3226 HookManager are now hierarchical from window to buffer to global
window hooks also executes buffer hook which also execute global hooks
2012-06-07 13:29:44 +00:00
Maxime Coste
6a416abae2 abstract ui functions in a UI base class 2012-06-05 23:15:19 +00:00
Maxime Coste
02051bb067 fix runtime directory detection on MacOS 2012-06-05 14:23:47 +00:00
Maxime Coste
61bd77d529 fix compilation on MacOS 2012-06-05 13:31:14 +00:00
Maxime Coste
546a999416 global: select the tag, fail nicely 2012-06-04 14:27:56 +00:00
Maxime Coste
419d5691a1 add a try command
use try <commands...> catch <failure_commands...>
2012-06-04 14:27:34 +00:00
Maxime Coste
310bc42d54 tweak cpp highlighting 2012-06-04 14:14:01 +00:00
Maxime Coste
a7c33207d6 check if no modification were made in Buffer::end_undo_group 2012-06-04 14:12:37 +00:00
Maxime Coste
589aad5f9c sort command names completion candidates 2012-06-02 15:49:56 +00:00
Maxime Coste
f972428823 The def command do not override commands by default, use -allow-override 2012-06-02 15:49:35 +00:00
Maxime Coste
942e63d836 correctly implement std::hash<String> 2012-05-30 14:20:21 +02:00
Maxime Coste
d7c917c96e include <unistd.h> in order to get read and write 2012-05-30 14:19:53 +02:00
Maxime Coste
6792696ba2 enable global and line numbering in kakrc 2012-05-29 11:35:30 +00:00
Maxime Coste
2c4bc5582a Alt-Space permits to remove a selection by index 2012-05-29 11:15:43 +00:00
Maxime Coste
3bfd774f49 Restore piping support.
Add a ShellManager::pipe method, which pipes a string into the
command. Not quite satisfied with this interface.
2012-05-29 10:39:03 +00:00
Maxime Coste
84c1cad3d5 tweak cpp highlighting 2012-05-29 09:23:53 +00:00
Maxime Coste
c7ad724aec global.kak: support tag name completion 2012-05-29 05:23:36 +00:00
Maxime Coste
02c89022e4 Correctly set env vars in define_command 2012-05-29 05:43:09 +00:00
Maxime Coste
d599542473 Support -shell-completion option in the def command
-shell-completion takes some shell code as parameter which
should returns a newline separated list of completion candidates.
2012-05-29 05:22:18 +00:00
Maxime Coste
62202a46c1 Add some string helpers and unit tests
functions int_to_str(int) and split(const String&, Character),
plus corresponding unit tests
2012-05-29 05:19:50 +00:00
Maxime Coste
96c440fcaa CommandManager::execute can take an optional EnvVarMap argument which is used for shell evaluation 2012-05-29 05:42:26 +00:00
Maxime Coste
8fedbbf07b ShellManager::eval now takes an additional env_var map 2012-05-29 05:19:27 +00:00
Maxime Coste
e57ddd3bab Factorize some duplicated completer code in register_commands 2012-05-29 03:34:54 +00:00
Maxime Coste
30d9e10ac6 DisplayBuffer optimization, suppressed some paranoid checks 2012-05-29 00:33:55 +00:00
Maxime Coste
6fa40796e7 Fix Window::scroll_to_keep_cursor_visible_ifn 2012-05-29 00:14:05 +00:00