Commit Graph

120 Commits

Author SHA1 Message Date
Maxime Coste
c8839e7904 Add a ClientCreate and ClientClose hook
As discussed in #2830.
Closes #2500.
2019-04-08 21:59:32 +10:00
Maxime Coste
835f2239a7 Run WinClose hook when clearing all free windows
Fixes #2830
2019-04-04 22:06:17 +11:00
Maxime Coste
cc788c888e Fix detection of client ungraceful disconnection 2019-04-04 13:10:38 +11:00
Maxime Coste
924f30840b Fix uses of std::remove_if
std::remove_if is not std::partition, it makes no guarantees on
the state of the objects past the new end (they usually are in a
moved-from state).
2019-02-17 11:21:26 +11:00
Maxime Coste
8135a44c6c Run WinClose hook before putting the window into trash 2019-02-17 11:21:26 +11:00
Maxime Coste
dfc11d1c43 Refactor Hook management to have a well defined list of hooks
Hooks are now an enum class instead of passing strings around.
2018-10-23 08:15:53 +11:00
Delapouite
746b9acb96 Change client default name: "unnamed0" → "client0" 2018-04-23 11:42:11 +02:00
Maxime Coste
57baad4afd Make FaceRegistry scoped
set-face now takes a scope argument, and faces can be overridden on
a buffer or window basis.

colorscheme apply on global scope, which should be good enough for
now.

Fixes #1411
2018-04-07 16:27:50 +10:00
Delapouite
cb02186c77 Make error messages more consistent 2018-04-06 16:56:53 +02:00
Maxime Coste
a6b1d142fa Cleanup client name validation code 2018-03-25 16:53:27 +11:00
Maxime Coste
49c52b025f Remove contains_that and use any_of to be closer to the c++ stdlib 2018-03-25 16:47:19 +11:00
Maxime Coste
435b5b7ff9 Unify code that validates identifiers in Kakoune
Session/Client/User modes names are now requiered to be "identifiers"
they must be in [a-zA-Z0-9_-]. Option names are the same except they
do not allow '-' as they need to be made available through the env vars
and '-' is not supported there.

Fixes #1946
2018-03-25 16:35:33 +11:00
Maxime Coste
db7b43acd5 Restore client name after converting to client
When Kakoune forked the sever to background, the newly converted
to client process (the original client/server process) was not
preserving its previous client name.
2018-03-23 07:36:18 +11:00
Maxime Coste
299e22ca7c Do not block when waiting for next event if we have pending input
Handle next event should never block if we have already accumulated
input that we want to process. As we can accumulate new input in
lots of places (everytime we run a shell process for example, we
might end up reading input keys. That can be triggered during the
mode line generation which takes place during display of the window)

Fixes #1804
2018-01-21 12:00:40 +11:00
Maxime Coste
ab6a999431 Rename containers.hh to ranges.hh (and Container to Range) 2017-08-29 15:23:03 +07:00
Maxime Coste
1709886873 avoid literal eol in status lines, replace them with another symbol 2017-08-29 10:01:43 +07:00
Maxime Coste
e80b36b495 Expose client pid as $kak_client_pid
As requested in #1414
2017-08-28 13:12:45 +07:00
Maxime Coste
f7bed9eb18 Support specifying an exit status on quit commands
The current client exit status can be specified as an optional
parameter, is nothing is given the exit status will be 0.

Fixes #1230
2017-08-23 13:33:13 +07:00
Maxime Coste
7a79cbbc81 Migrate code to c++14 2017-07-19 08:47:14 +02:00
Maxime Coste
f57e72ab4a Small code tweak 2017-05-27 06:17:44 +01:00
Maxime Coste
0cb192921a Remove unused WindowAndSelections timestamp field
The SelectionList already has a timestamp.
2017-01-29 12:50:16 +00:00
Maxime Coste
e8ee8c23d8 Support the +line syntax for clients as well.
Fix a crash on daemon quit as well.
2017-01-21 12:17:49 +00:00
Maxime Coste
6f4515f005 Only touch new clients selections when target coord are explicit
Do not implicitely change new clients selections to target coordinates
when the user did not specify them, so that we can re-use the selections
from the found free window, which is the generally desired behaviour.
2017-01-19 18:44:26 +00:00
Maxime Coste
089ee8ac0a Fix crash when quitting the first client while another client is connected 2016-12-01 20:55:28 +00:00
Maxime Coste
a65e8142f3 Rework handling of initial coordinates so that init commands can change them
Fixes #944
2016-12-01 20:55:20 +00:00
Maxime Coste
540e504e68 Ensure all available input is handled before going back to main loop
We were not handling keys that could have been generated while handling
other keys (like during a shell evaluation).
2016-11-30 09:47:38 +00:00
Maxime Coste
3a81260917 Simplify greatly UI input handling
This round trip through an input callback expected to call
is_key_available and get_key was overcomplicated, just send the
keys as they arrive, the client is already buffering due to urgent
event mode.
2016-11-29 21:59:36 +00:00
Maxime Coste
8e5f491d3f Support deleting a buffer even if another client is in insert mode on it 2016-11-05 11:29:47 +00:00
Maxime Coste
cc2affea11 Always allow to delete a buffer, just recreate a scratch buffer if needed
Fixes #850
2016-10-13 21:37:44 +01:00
Maxime Coste
5440d31f99 Only create a default *scratch* when we dont have any non debug buffers
Fixes #852
Closes #856
2016-10-11 00:45:05 +01:00
Maxime Coste
4fc20b8d7d Rework client quitting and handling of remote errors
Client quitting no longer immediately unwinds, client is just pushed
for deletion until we get back to the main loop, similarly to what
happens for buffer and window deletion.
2016-09-04 17:56:07 +01:00
Maxime Coste
ba421e45f7 Delay window deletion until we get back to main loop
Avoid WinResize hooks while redrawing, ensure window resize only
take place while handling user input.

Fixes #672
2016-05-14 08:17:52 +01:00
Maxime Coste
9e15181dc9 Rework container helpers, use pipe syntax and cleanup implementation
use 'container | filter(func) | reverse() | transform(func)' instead
of 'transform(reverse(filter(container), func), func)' to express
container transformations.
2016-03-08 21:35:56 +00:00
Maxime Coste
b5b5b82c70 destroy buffer manager first but clear clients before destroying buffers.
Fixes #612
2016-03-03 14:05:07 +00:00
Maxime Coste
3987463e75 Remove direct access to ui, go through client
Client can now update menu/info positions when the window move
around.
2016-02-27 17:23:13 +00:00
Maxime Coste
dfe3098b18 Fix buffer deletion logic
'eval -buffer * db' was failing in certain cases
2016-02-11 23:07:42 +00:00
Maxime Coste
8701a53252 Fix use of dead temporary strings in completions 2016-02-10 13:33:49 +00:00
Maxime Coste
87769c9b03 Migrate most completion to ranked match 2016-02-09 22:50:10 +00:00
Maxime Coste
411e5a9486 Extract jump list handling in a JumpList struct 2015-12-23 01:56:54 +00:00
Maxime Coste
d2b0dba39d Support quitting while executing RuntimeError hooks
Fixes #529
2015-12-14 19:06:30 +00:00
Maxime Coste
9134066e85 Try to switch to last buffer when removing the current one 2015-11-10 13:52:48 +00:00
Maxime Coste
6840f7ce9c Store the last used buffer in clients
Fixes #474
2015-11-07 18:25:49 +00:00
Maxime Coste
7776c38755 Detect ungraceful exits, and backup modified buffers in these cases 2015-10-08 13:43:39 +01:00
Maxime Coste
04536657d1 Add a kill command that kills the current session
Fixes #331
A given session can be killed with 'echo kill | kak -p <session>'
2015-08-26 19:34:19 +01:00
Maxime Coste
0c41c14187 Reorganize slightly local client creation 2015-08-26 19:33:52 +01:00
Maxime Coste
3834440298 Rework window redraw handling, should redraw window less often 2015-06-21 19:56:23 +01:00
Maxime Coste
f0886ad323 Get rid of the mode trash, delete mode directly when leaving on_key 2015-06-03 20:03:06 +01:00
Maxime Coste
8f6fc6a0f3 Port even more code to use format function 2015-06-01 21:15:59 +01:00
Maxime Coste
993e842fdf Retreat ! go back to C++11 only code
This reverts commit b42de85031.
2015-05-26 18:42:09 +01:00
Maxime Coste
b42de85031 Migrate code to c++14 2015-05-25 13:51:17 +01:00