Commit Graph

465 Commits

Author SHA1 Message Date
Maxime Coste
26f0fd4cc6 Use more std::* for string handling 2013-05-13 18:43:38 +02:00
Maxime Coste
8bfe2d62e5 echo: rename -col option to -color 2013-04-26 18:48:31 +02:00
Maxime Coste
681f30dd28 support renaming buffers
Changing buffer name allows to save a *make* or *grep* buffer when
launching another one for exemple.
2013-04-22 13:49:07 +02:00
Maxime Coste
21f487417b context_wrap options are allowed only at start 2013-04-17 19:10:06 +02:00
Maxime Coste
cc91a71a96 move Client as a public class instead of a ClientManager implementation detail 2013-04-15 14:28:21 +02:00
Maxime Coste
dbffcb226b echo command can take a -col parameter to specify the colors to use 2013-04-12 14:22:01 +02:00
Maxime Coste
1b5760f1a1 delete buffer if needed when creating a scratch buffer 2013-04-11 23:09:17 +02:00
Maxime Coste
107e95622d Hooks can have an (shareable) identifier, and thus be removed 2013-04-11 14:29:10 +02:00
Maxime Coste
9999e5698d Use the buffer manager to delete buffer, throw when a client is inserting 2013-04-10 18:54:01 +02:00
Maxime Coste
bdd617006b add a 'debug' command, which write to the debug buffer 2013-04-10 13:45:17 +02:00
Maxime Coste
5adee4a6a7 rename assert to kak_assert to avoid collisions 2013-04-09 20:04:11 +02:00
Maxime Coste
34b8604f90 move context implementation to context.cc 2013-04-09 19:39:03 +02:00
Maxime Coste
7b94925898 force redraw window if needed in context_wrap 2013-04-09 14:21:48 +02:00
Maxime Coste
f540566b1b UserInterface: status line messages are now DisplayLines
This add color support for the status line
2013-04-04 18:50:00 +02:00
Maxime Coste
6ffdfd7735 Add get_color helper function 2013-04-04 18:47:34 +02:00
Maxime Coste
1822b81d58 pass a color pair when displaying an information window 2013-04-04 14:04:38 +02:00
Maxime Coste
b58f614f40 Pass a fg and bg color when displaying a menu 2013-04-04 14:04:38 +02:00
Maxime Coste
0395f3b9fc fix compilation with clang++ 2013-04-03 18:51:40 +02:00
Maxime Coste
76e73866e5 ParameterParser takes flags
Only implemented flag is OptionsOnlyAtStart which considers
options given after the first positional parameter as a positional one
2013-04-02 14:22:55 +02:00
Maxime Coste
0325e7f312 minor cleanup in assist function 2013-04-02 14:03:39 +02:00
Maxime Coste
f09e24607a add support for adding to options instead of replacing 2013-03-31 14:53:32 +02:00
Maxime Coste
a80cee0d2c Add support for tuple Options, implement LineAndFlag using that 2013-03-29 19:35:48 +01:00
Maxime Coste
29f79346c3 Move parameter count validation to the ParameterParser 2013-03-27 14:27:12 +01:00
Maxime Coste
a48672b3bc factor addhl/rmhl/addfilter/rmfilter completion functions 2013-03-27 14:19:07 +01:00
Maxime Coste
996e5999ed permit do declare regex option 2013-03-26 14:26:07 +01:00
Maxime Coste
1982144b04 Add a special option type LineAndFlag, use it for FlagLines highlighter 2013-03-26 00:14:38 +01:00
Maxime Coste
9429b662ca move absolute path logic to Buffer class 2013-03-25 19:58:23 +01:00
Maxime Coste
58caeaa8a8 add a cd command 2013-03-25 19:19:44 +01:00
Maxime Coste
ce67d29871 Always use absolute path for file buffer names, compact paths for display 2013-03-25 19:11:26 +01:00
Maxime Coste
a160fd6984 open_fifo delete existing buffer if needed 2013-03-22 18:39:00 +01:00
Maxime Coste
0082238c75 use canonicalized filenames for buffers 2013-03-22 14:27:30 +01:00
Maxime Coste
5bba01ca9c BufferManager notify the ClientManager when a buffer dies 2013-03-22 14:26:44 +01:00
Maxime Coste
a2476a8fbf setb can take a -buffer argument 2013-03-22 13:44:40 +01:00
Maxime Coste
eeadb59f7f eval,exec: -restore-selections become -draft, and restore the buffer as well 2013-03-22 13:42:29 +01:00
Maxime Coste
e5d93c2194 BufferManager: replace Buffer* get_buffer with Buffer& get_buffer 2013-03-21 19:09:31 +01:00
Maxime Coste
3883bffacc user defined hooks can access the hook parameter in shell with $kak_hook_param 2013-03-20 19:11:58 +01:00
Maxime Coste
2de0d0fccf add a reg command to set a register 2013-03-18 22:44:39 +01:00
Maxime Coste
a981d41cde Editor: replace selections().back() with main_selection() 2013-03-15 18:22:08 +01:00
Maxime Coste
066876a131 add str-list option support to decl command 2013-03-14 14:11:00 +01:00
Maxime Coste
50d9c4dfda add support for regex options, make ignored_files one 2013-03-14 13:42:07 +01:00
Maxime Coste
b309d1df61 move complete_filename to file.cc 2013-03-13 19:39:38 +01:00
Maxime Coste
17f7607a30 write_buffer: consider buffer as saved only if we used it's filename 2013-03-13 18:51:36 +01:00
Maxime Coste
e4240448b1 colalias: always override 2013-03-06 20:30:02 +01:00
Maxime Coste
fb7234544e HighlightersFactories takes back a Window parameter 2013-03-06 14:27:33 +01:00
Maxime Coste
0e2ba188dc Add support for int list options, specified using a comma seperated list of int 2013-03-06 14:27:00 +01:00
Maxime Coste
fac222a427 Strongly typed options support
* non builtins options require declaration using the decl command

* At the moment, only int and string options are supported, however
the goal of this change is to provide a consistent way to support
more complex options, namely lists and booleans
2013-03-05 18:49:26 +01:00
Maxime Coste
d23694e31f Do not use a factory for window builtins highlighters
This helps cleanup up the code, as factories no longer takes
a window as parameter.
2013-03-01 19:15:05 +01:00
Maxime Coste
6318f2268f assistant: no need for raw strings 2013-03-01 14:29:28 +01:00
Maxime Coste
849f225e70 use a 16K buffer when reading from fifo 2013-02-28 18:51:11 +01:00
Maxime Coste
cd8c36fc50 Add a debug option to Makefile, and use KAK_DEBUG define to remove debug code 2013-02-27 19:02:01 +01:00
Maxime Coste
3d19111570 Use unicode box drawing character for the assistant 2013-02-26 14:28:42 +01:00
Maxime Coste
dc7227b983 Add the most important missing feature of Kakoune 2013-02-25 19:38:20 +01:00
Maxime Coste
577734dae7 expose exec_keys function in commands.hh 2013-02-18 18:57:08 +01:00
Maxime Coste
32e6184210 context_wrap: create a DynamicSelectionList only when needed 2013-02-07 19:25:07 +01:00
Maxime Coste
6c7d646d35 exec keys: push_jump if editor has changed 2013-02-07 13:35:21 +01:00
Maxime Coste
bc63be3388 open_fifo uses fcntl for more portable CLOEXEC bit setting 2013-01-30 19:08:16 +01:00
Maxime Coste
84ea452ed2 info command take a -anchor <pos> instead of -inline params 2013-01-29 18:56:14 +01:00
Maxime Coste
38a67e72bc Do not pass a context to InputHandler methods 2013-01-29 13:49:01 +01:00
Maxime Coste
94bbf47cd4 InputHandler have it's own context 2013-01-28 13:48:34 +01:00
Maxime Coste
edb5dbc56f move {exec,eval}_string common code to a helper context_wrap function 2013-01-17 14:06:06 +01:00
Maxime Coste
cedb0d18a3 exec and eval accepts a restore-selection parameter 2013-01-17 13:58:09 +01:00
Maxime Coste
621be2ceab Hooks now takes a non-const context 2013-01-17 13:45:43 +01:00
Maxime Coste
310ec1f791 move input watching responsibility into UserInterface implementations 2013-01-14 18:50:17 +01:00
Maxime Coste
79d28e68dc Refactor EventManager
Watching a file descriptor is now done using a FDWatcher object
2013-01-10 19:10:42 +01:00
Maxime Coste
4b649d386c various code style fixes 2013-01-04 18:39:13 +01:00
Maxime Coste
08fd946c07 Add a nop command to avoid accidental shell output evaluation 2013-01-03 18:52:07 +01:00
Maxime Coste
2b2474b2d1 add a force mode to delete buffer (db!) 2012-12-28 14:07:35 +01:00
Maxime Coste
43ad920bd8 menu commands has a -select-cmds option
when this option is given, menu expect three argument per entry
instead of two, the last one being the command to run when the
entry is selected, but not yet validated.
2012-12-15 19:11:22 +01:00
Maxime Coste
d208067589 InputHandler: call callback on abort and on selected element change as well 2012-12-14 19:38:11 +01:00
Maxime Coste
3184159572 info: support a -inline option
By default display info box above command line, full width
(like menu), in inline mode, display the info box close
to cursor, using only needed width.
2012-12-14 19:25:27 +01:00
Maxime Coste
9236c87842 UserInterface: add info box support
using the info command, you can display an arbitrary string
in a tooltip box.
2012-12-14 19:04:34 +01:00
Maxime Coste
d0c800a7d7 Support nested {Filters,Highlighter}Group 2012-12-09 18:58:58 +01:00
Maxime Coste
158f5a5c84 extract ParametersParser to it's own file 2012-12-07 19:20:26 +01:00
Maxime Coste
ce6e864772 'exec' and (resurected) 'eval' commands can take a '-client' parameter 2012-12-03 18:57:57 +01:00
Maxime Coste
cf39835805 add 'name' command to set current client name 2012-12-03 18:57:23 +01:00
Maxime Coste
b23af02ec4 fix quit modified file behaviour 2012-12-03 13:33:05 +01:00
Maxime Coste
91d2cc38e5 EventManager: avoid erasing an event handler while it may be in use 2012-11-26 14:08:27 +01:00
Maxime Coste
d2f811a8d5 Refactor filter and highlighter registry into a common template 2012-11-23 13:40:20 +01:00
Maxime Coste
3b5530ac09 rename (hook|option)_manager to (hook|option)s.
And Global(Hook|Option)Manager to Global(Hook|Option)s
2012-11-22 13:50:29 +01:00
Maxime Coste
6bbbd2543a move wrong_argument_count to commands.cc, where it is used 2012-11-21 13:44:43 +01:00
Maxime Coste
d1fade5c9e Buffer: replace reset_undo_data with a NoUndo flag 2012-11-21 13:43:10 +01:00
Maxime Coste
985464bee5 Fix FIFO double deregistering issue when closing the buffer after EOF
When a fifo was closed, the fifo event handler would close the fd and
unregister it from the event handler, however the hook on BufClose
did that as well without checking if the fd was still refering to the
fifo.

Now we use a Buffer flag Fifo to tag the buffer as still linked to
a fifo so that the BufClose hook do not close and unregister a second
time
2012-11-20 19:48:27 +01:00
Maxime Coste
8bbfbc8c72 Buffer: replace Buffer::Type with Buffer::Flags 2012-11-20 19:47:56 +01:00
Maxime Coste
533079c389 Let client manager handle deleting client 2012-11-20 18:54:35 +01:00
Maxime Coste
801f4e740c Add jump list support to context
jump forward is bound to ctrl-i
jump backward is bound to ctrl-o

switch buffers or jumping somewhere in the buffer push the current
position to the jump list.

when a buffer is deleted, all entries referencing it in jump lists
are erased.
2012-11-12 19:59:25 +01:00
Maxime Coste
bdd0758ee2 Saner :edit and :buffer behaviour when buffer is the current one 2012-11-07 14:04:47 +01:00
Maxime Coste
0f7948848e Fix buffer deletion from a client when another is editing it 2012-11-07 14:02:23 +01:00
Maxime Coste
3daac4883e Move client drawing responsiblity to the ClientManager 2012-11-05 19:58:04 +01:00
Maxime Coste
fedabb4176 Rework Window creation, avoid using the same window in multiple clients 2012-11-05 19:15:42 +01:00
Maxime Coste
1ea4b3998a Add a ClientManager for managing client lifetimes 2012-10-30 14:00:44 +01:00
Maxime Coste
d9729cc29e Handle all available input before redrawing 2012-10-28 09:26:54 +01:00
Maxime Coste
a0cca31dc1 make UserInterface unaware of Window, only of DisplayBuffer 2012-10-20 20:15:20 +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
6ff6058ceb create_buffer_from file return nullptr on file not found instead of throwing 2012-10-16 14:59:39 +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
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
081f579ba1 OSX compilation fixes 2012-10-02 10:36:28 +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
77eb86bcdb Forbid context copy 2012-09-26 14:27:23 +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
a312ce6dc2 extract Client virtual methods to a UserInterface class 2012-09-24 19:24:27 +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
a92a6dc7f3 ColorRegistry: permit overriding an alias 2012-09-17 21:01:11 +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
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
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
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
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
16e1c2daf9 simplify menu api 2012-09-05 19:02:06 +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
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
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
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
217b3d2bce fix compilation on OSX 2012-07-30 14:12:49 +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
05098a373a edit command: when a line is specified ask the window to center it 2012-08-21 20:08:57 +02:00
Maxime Coste
1515566e4b Allow context with client and non-window editor 2012-08-17 20:18:36 +02:00
Maxime Coste
c1fcc593a1 Store the current client in context 2012-08-15 22:36:45 +02:00
Maxime Coste
b630189ce5 Add a writeall (wa) command 2012-08-14 14:20:18 +02:00
Maxime Coste
808e79a53e commands: code cleanup 2012-08-11 11:48:54 +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
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
2cac18545e define_command: remove unused param from parser definition 2012-08-07 14:26:51 +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
4dc9973288 Registers need a context to return their values 2012-08-05 20:13:41 +02:00
Maxime Coste
0164d78c10 Use a context as parameter to keymap functions 2012-08-05 19:39:37 +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
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
603cfd3108 do not catch exception in commands, let them propagate 2012-06-30 00:44:14 +02:00
Maxime Coste
7aa533c049 simplify Register interface 2012-06-29 13:25:34 +02:00
Maxime Coste
9b6b6b6b17 Rename UI to Client 2012-06-28 14:11: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
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
fd8517f91e fix some warnings detected with clang 2012-06-05 13:33:02 +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
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
e36b3565bf call SetOption hook when setting an option 2012-06-12 13:10:52 +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
419d5691a1 add a try command
use try <commands...> catch <failure_commands...>
2012-06-04 14:27:34 +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
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
e57ddd3bab Factorize some duplicated completer code in register_commands 2012-05-29 03:34:54 +00:00
Maxime Coste
1257d432b4 the 'menu' commands now takes an optional -auto-single option
-auto-single tell the 'menu' command not to prompt when there
is only a single choice, and to automatically execute it's
command.
2012-05-28 23:50:11 +00:00
Maxime Coste
d96427b831 Add a delbuf (db) command which delete an existing buffer 2012-05-28 22:51:12 +00:00
Maxime Coste
393b9b24e2 Unify command parameter parsing with a ParametersParser class 2012-05-25 05:07:37 +00:00
Maxime Coste
5f2471c147 add an initial menu command, which presents several choices to users
usage is "menu 'label1' 'command1' 'label2' 'command2' ..."
2012-05-18 05:20:46 +00:00
Maxime Coste
ff86d9781d move commands to commands.{cc,hh} 2012-05-07 03:13:34 +00:00