Commit Graph

145 Commits

Author SHA1 Message Date
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