Maxime Coste
a1f0bae53a
Do not try to send remaining data on a closed socket
...
Fixes #2906
2019-05-23 12:42:38 +10:00
Robert Melton
a43313c6ce
Strip all trailing slashes in real_path and compact_path
2019-05-19 19:52:05 -04:00
Maxime Coste
744778be30
Add a -to-file <filename> switch to the echo command
...
As discussed in #2836
2019-04-07 09:32:17 +10:00
Maxime Coste
d91e017803
Buffer writes in blocks of 4Kb when writing buffers to files
...
Could make kakoune more compatible with tools looking for file
modifications by reducing the amount of writes done.
As discussed in #2812
2019-04-01 22:57:55 +11:00
Maxime Coste
89cd68d8af
Check the return value of the rename call
2019-02-12 21:05:47 +11:00
Maxime Coste
4dae2c875b
Introduce a writemethod option to either overwrite or replace files
...
This permit to choose if files should be written by overwriting their
content (the default), or by writing to a separate temporary file
and rename it to the current file.
As discussed in #2036
2019-02-12 21:01:19 +11:00
Maxime Coste
e8f26cbae7
Refactor write_buffer_to_file to use a flags param
...
That is clearer than two boolean parameters.
2019-02-12 20:18:34 +11:00
Maxime Coste
4b72cfe530
Replace std::tie with structured bindings
2019-01-24 21:21:59 +11:00
Frank LENORMAND
5309b7b5e5
src: Add a -sync
flag to the write commands
2018-07-04 09:49:53 +03:00
dahlbaek
52a3e9a84d
Pass in OpenBSD binary path using preprocessor option
...
Alternative to hard coding binary path for OpenBSD
2018-06-20 14:20:55 +02:00
Patrick Marchand
dc3e4823a5
Remove extraneous include for openbsd
...
Forgot to remove this before pushing.
2018-06-20 14:20:55 +02:00
Patrick Marchand
2789857f32
Adds openbsd support
...
Seems to work on openbsd 6.3-current but needs more testing. Had to
hardcode the binary path as openbsd considers getting the executable
path at runtime a security flaw.
2018-06-20 14:20:55 +02:00
Maxime Coste
54b62cbef7
Do not expose C++ typeid().name to user facing errors on wrong option type
...
Fixes #2079
2018-05-26 10:01:26 +10:00
Delapouite
cb02186c77
Make error messages more consistent
2018-04-06 16:56:53 +02:00
Maxime Coste
81f605709c
Remove parse_filename overload and use a default parameter
2018-03-25 07:55:39 +11:00
Maxime Coste
a732037b53
Support %
in path
option to mean current buffer directory
...
In the end, % is not that painful to work with as its only set seldomly,
and we usually dont need to use expansion at the same time. Moreover, it
just requires a single \ to be escaped.
Fixes #1562
2018-03-23 08:22:34 +11:00
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