Commit Graph

152 Commits

Author SHA1 Message Date
Maxime Coste
bec849ae14 Tolerate empty filenames in real_path 2018-03-20 05:56:20 +11:00
Maxime Coste
6e695e37be Fix real_path again 2018-03-19 20:49:05 +11:00
Maxime Coste
6d8747b886 Fix introduced bug in real_path 2018-03-19 06:28:06 +11:00
Maxime Coste
cf37623f1a Refactor read_fd '\r' removal logic 2018-03-18 23:43:18 +11:00
Maxime Coste
ac91a79b12 Fix implementation of real_path to handle non-existing directories in /
Fixes #1937
2018-03-18 23:23:00 +11:00
Maxime Coste
07dfcd336d Fallback to getpwuid in the unlikely case $HOME is underfined
Add a homedir() helper function, and document the $kak_config
env var.
2018-01-20 11:19:23 +11:00
fsub
66ca53466f Remove unused lambda captures
This eliminates some warnings emitted by clang++.
2017-11-22 18:43:54 +01:00
Maxime Coste
cd215ccee9 Do not allow opening files whose size we cannot express in an int 2017-10-30 18:58:47 +11:00
Maxime Coste
6ada6e6d77 Move all non-core string code to string_utils.{hh,cc} 2017-10-10 10:52:32 +08:00
Maxime Coste
24234dffa3 Do less implicit parse_filename calls 2017-08-29 09:42:04 +07:00
Maxime Coste
9001580c9b Do not expand env vars in parse_filename
We have far enough ways to provide that feature, through the shell
or through regular expands.
Fixes #1545
2017-08-29 08:33:00 +07:00
Maxime Coste
5b43c46b75 Fix naming in fd_writable 2017-08-29 08:32:47 +07:00
Maxime Coste
250886a9e1 Use read_fd to get pipe command from stdin instead of ad-hoc code
read_fd will also now throw on read error instead of just returning
the data read so far as if nothing failed.
2017-06-12 05:21:34 +01:00
Maxime Coste
3917d26709 small code cleanups 2017-05-17 20:17:16 +01:00
Frank LENORMAND
51ab59cd36 src: Implement a write! command
This commit allows "forced" writes to a write-protected file, by
attempting to temporarily grant the current user write permissions on
it. After the buffer has been written, the previous permissions are
restored if the file existed, or set to 0644 otherwise.
2017-04-20 17:13:42 +03:00
Maxime Coste
30e6387071 Assume filename passed to write_buffer_to_file is already parsed 2017-04-20 09:55:56 +01:00
Maxime Coste
7d9f1df73a Small code tweaks regarding flags handling 2017-03-15 18:25:59 +00:00
Maxime Coste
6373338c50 Replace uses of UnorderedMap with HashMap 2017-03-07 01:03:26 +00:00
Maxime Coste
753f3a50d1 Make StringView and unit types trivial types 2017-01-29 13:49:45 +00:00
Maxime Coste
dcd8f6ef01 Apply clang-tidy modernize to the codebase 2017-01-08 22:39:01 +00:00
Maxime Coste
e42881fa38 Fix remaining uses of hardcoded /tmp to get the socket paths
Fixes #1097
2017-01-01 13:10:08 +00:00
Maxime Coste
831887cd3a Improve general security of the unix sockets
* Use the stricky bit on the shared kakoune folder
* Do not allow read/write access to user folder
* Respect $TMPDIR when set

Fixes #1007
2016-12-15 23:47:34 +00:00
Maxime Coste
8c862c4eea Only write to remote socket when we know they are writable
Buffer data (in an horribly innefficient way for now), and use the
event manager to watch for the socket being ready for a write.

Fixes #945
2016-12-01 20:11:09 +00:00
Maxime Coste
12856066b1 Cleanup include dependencies a bit 2016-11-28 23:58:08 +00:00
Maxime Coste
2f3a7112ea Add more memory domains to certain data 2016-11-28 13:59:55 +00:00
Maxime Coste
67eb19c6d2 Only rely on ignored_files option to remove hidden files, no built in logic
Fixes #929
2016-11-18 09:38:48 +00:00
Maxime Coste
1f3e424047 Do not expand filenames when doing insert filename completion
Fixes #855
2016-10-13 19:46:09 +01:00
Maxime Coste
c7356c8e9c Close write buffer file descriptor before getting the new fs timestamp 2016-10-03 20:00:36 +01:00
Maxime Coste
d50087eabe Change BufWritePre/BufWritePost logic
Run them in client context if possible, and give them the target
filename instead of the buffer name.

Fixes #823
2016-10-01 23:51:53 +01:00
Maxime Coste
8b02bb749d Add a fd_readable(int fd) helper function
Use it instead of direct calls to select scatered around the code
base.
2016-08-30 22:56:47 +01:00
Maxime Coste
bedf2f703c Small code cleanups 2016-08-09 21:45:06 +01:00
Maxime Coste
baf219ee2f Fix duplicate buffer problem, fix real_path beahviour 2016-05-15 10:37:01 +01:00
Maxime Coste
abac6a9436 Use boost::wregex implementation and manually utf8 decode into it
That way we get proper unicode support in regular expressions as long
as the current locale treats wchar_t as unicode codepoints.

Fixes #638
Fixes #595
Fixes #162
2016-05-10 09:38:21 +01:00
Maxime Coste
cf142872dc Add missing include in file.cc 2016-04-27 09:46:53 +01:00
Maxime Coste
3eca90f2b1 Only offer directories when completing :cd arguments
Refactor code in file.cc, avoid many double stat when searching
commands

Fixes #646
2016-04-07 22:47:41 +01:00
Maxime Coste
d3ef2d36ea Add a SplitView container view 2016-03-25 20:38:26 +00: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
6d5900af16 Use RankedMatch for filename based completion (file and command completion) 2016-03-02 13:51:16 +00:00
Frank LENORMAND
df31b88187 Fix "unused result" warnings for several system calls. 2015-12-10 11:00:10 +03:00
Maxime Coste
966ac90fe7 Change eolformat and BOM options to be enums instead of strings 2015-12-06 12:51:55 +00:00
Maxime Coste
a81dbd90a1 Consolidate writing to fd 2015-11-27 13:50:40 +00:00
Maxime Coste
2ce0a5a8a8 Merge https://github.com/alpha123/kakoune 2015-11-04 19:49:21 +00:00
alpha123
97c92368bc Build on FreeBSD 2015-11-03 11:51:27 -07:00
sinetek
4b8c03afe6 Adding support for DragonFlyBSD. 2015-11-03 01:14:34 +07:00
Maxime Coste
17eef4a7dc Use explicit lambda captures 2015-11-02 13:44:03 +00:00
Maxime Coste
76fadd8108 More cleanups in the buffer open/reload code 2015-10-17 11:33:09 +01:00
Maxime Coste
3795ff735a Refactor buffer creation and reloading to be more explicit
Reloading used to be implicit in the buffer creation function,
which is not always nice, as code that explicitely wanted to
reload a buffer could not say so.
2015-10-17 11:33:09 +01:00
Maxime Coste
6913d5427c Try to fix OSX compilation 2015-09-27 18:48:01 +01:00
Maxime Coste
e2720f1fbe Store timespec for buffer fs timestamps, not just time_t
time_t has a resolution of one second, which cause troubles when
a file changes multiple time during that same second.
2015-09-27 11:55:34 +01:00
Filip Szczepański
47e6eed7c9 Add Haiku support. 2015-09-24 22:36:29 +00:00