Merge tag 'v2024.05.18'
This commit is contained in:
commit
fc30e5e21f
5
Makefile
5
Makefile
|
@ -54,7 +54,7 @@ LDFLAGS-os-FreeBSD = -L/usr/local/lib
|
|||
|
||||
LIBS-os-Haiku = -lnetwork -lbe
|
||||
|
||||
CPPFLAGS-os-OpenBSD = -DKAK_BIN_PATH="$(bindir)/kak" -I/usr/local/include
|
||||
CPPFLAGS-os-OpenBSD = -DKAK_BIN_PATH=\"$(bindir)/kak\" -I/usr/local/include
|
||||
LDFLAGS-os-OpenBSD = -L/usr/local/lib
|
||||
mandir-os-OpenBSD = $(DESTDIR)$(PREFIX)/man/man1
|
||||
|
||||
|
@ -136,6 +136,9 @@ doc/kak.1.gz: doc/kak.1
|
|||
|
||||
check: test
|
||||
test: src/kak
|
||||
if [ $(os) = OpenBSD ]; then \
|
||||
export KAKOUNE_RUNTIME=$$PWD/share/kak; \
|
||||
fi && \
|
||||
cd test && ./run
|
||||
|
||||
TAGS: tags
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
This changelog contains major and/or breaking changes to Kakoune between
|
||||
released versions.
|
||||
|
||||
== Kakoune 2024.05.18
|
||||
|
||||
* Fixed tests on Alpine Linux and *BSD
|
||||
|
||||
== Kakoune 2024.05.09
|
||||
|
||||
* `flag-lines -after` switch to display text after the line
|
||||
|
|
|
@ -224,7 +224,7 @@ define-command -params 1.. \
|
|||
execute-keys <a-l><semicolon><a-?>^commit<ret><a-semicolon>
|
||||
} catch %{
|
||||
# Missing commit line, assume it is an uncommitted change.
|
||||
execute-keys <a-l><semicolon><a-?>\A<ret><a-semicolon>
|
||||
execute-keys <a-l><semicolon>Gg<a-semicolon>
|
||||
}
|
||||
require-module diff
|
||||
try %{
|
||||
|
|
48
src/file.cc
48
src/file.cc
|
@ -634,9 +634,10 @@ String get_kak_binary_path()
|
|||
char buffer[2048];
|
||||
#if defined(__linux__) or defined(__CYGWIN__) or defined(__gnu_hurd__)
|
||||
ssize_t res = readlink("/proc/self/exe", buffer, 2048);
|
||||
kak_assert(res != -1);
|
||||
buffer[res] = '\0';
|
||||
return buffer;
|
||||
if (res != -1 && res < 2048) {
|
||||
buffer[res] = '\0';
|
||||
return buffer;
|
||||
}
|
||||
#elif defined(__FreeBSD__) or defined(__NetBSD__)
|
||||
#if defined(__FreeBSD__)
|
||||
int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
|
||||
|
@ -644,37 +645,44 @@ String get_kak_binary_path()
|
|||
int mib[] = {CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME};
|
||||
#endif
|
||||
size_t res = sizeof(buffer);
|
||||
sysctl(mib, 4, buffer, &res, NULL, 0);
|
||||
return buffer;
|
||||
if (sysctl(mib, 4, buffer, &res, NULL, 0) != -1)
|
||||
return buffer;
|
||||
#elif defined(__APPLE__)
|
||||
uint32_t bufsize = 2048;
|
||||
_NSGetExecutablePath(buffer, &bufsize);
|
||||
char* canonical_path = realpath(buffer, nullptr);
|
||||
String path = canonical_path;
|
||||
free(canonical_path);
|
||||
return path;
|
||||
char* canonical_path = NULL;
|
||||
if (_NSGetExecutablePath(buffer, &bufsize) != -1)
|
||||
canonical_path = realpath(buffer, nullptr);
|
||||
if (canonical_path) {
|
||||
String path = canonical_path;
|
||||
free(canonical_path);
|
||||
return path;
|
||||
}
|
||||
#elif defined(__HAIKU__)
|
||||
BApplication app("application/x-vnd.kakoune");
|
||||
app_info info;
|
||||
status_t status = app.GetAppInfo(&info);
|
||||
kak_assert(status == B_OK);
|
||||
BPath path(&info.ref);
|
||||
return path.Path();
|
||||
if (app.GetAppInfo(&info) == B_OK) {
|
||||
BPath path(&info.ref);
|
||||
return path.Path();
|
||||
}
|
||||
#elif defined(__DragonFly__)
|
||||
ssize_t res = readlink("/proc/curproc/file", buffer, 2048);
|
||||
kak_assert(res != -1);
|
||||
buffer[res] = '\0';
|
||||
return buffer;
|
||||
if (res != -1 && res < 2048) {
|
||||
buffer[res] = '\0';
|
||||
return buffer;
|
||||
}
|
||||
#elif defined(__OpenBSD__)
|
||||
(void)buffer;
|
||||
return KAK_BIN_PATH;
|
||||
#elif defined(__sun__)
|
||||
ssize_t res = readlink("/proc/self/path/a.out", buffer, 2048);
|
||||
kak_assert(res != -1);
|
||||
buffer[res] = '\0';
|
||||
return buffer;
|
||||
if (res != -1 && res < 2048) {
|
||||
buffer[res] = '\0';
|
||||
return buffer;
|
||||
}
|
||||
#else
|
||||
# error "finding executable path is not implemented on this platform"
|
||||
#endif
|
||||
throw runtime_error("unable to get the executable path");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,6 +45,9 @@ struct {
|
|||
unsigned int version;
|
||||
StringView notes;
|
||||
} constexpr version_notes[] = { {
|
||||
20240518,
|
||||
"» Fix tests failing on some platforms\n"
|
||||
}, {
|
||||
20240509,
|
||||
"» {+u}flag-lines -after{} highlighter\n"
|
||||
"» asynchronous {+u}shell-script-candidates{} completion\n"
|
||||
|
|
|
@ -702,7 +702,7 @@ Optional<Key> TerminalUI::get_next_key()
|
|||
|
||||
static constexpr auto control = [](char c) { return c & 037; };
|
||||
|
||||
static auto convert = [this](Codepoint c) -> Codepoint {
|
||||
auto convert = [this](Codepoint c) -> Codepoint {
|
||||
if (c == control('m') or c == control('j'))
|
||||
return Key::Return;
|
||||
if (c == control('i'))
|
||||
|
@ -717,7 +717,7 @@ Optional<Key> TerminalUI::get_next_key()
|
|||
return Key::Escape;
|
||||
return c;
|
||||
};
|
||||
static auto parse_key = [](unsigned char c) -> Key {
|
||||
auto parse_key = [&convert](unsigned char c) -> Key {
|
||||
if (Codepoint cp = convert(c); cp > 255)
|
||||
return Key{cp};
|
||||
// Special case: you can type NUL with Ctrl-2 or Ctrl-Shift-2 or
|
||||
|
@ -756,7 +756,7 @@ Optional<Key> TerminalUI::get_next_key()
|
|||
return mod;
|
||||
};
|
||||
|
||||
auto parse_csi = [this]() -> Optional<Key> {
|
||||
auto parse_csi = [this, &convert]() -> Optional<Key> {
|
||||
auto next_char = [] { return get_char().value_or((unsigned char)0xff); };
|
||||
int params[16][4] = {};
|
||||
auto c = next_char();
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
ui_out -ignore 7
|
||||
ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [true] }'
|
||||
exec 5>fifo
|
||||
ui_out '{ "jsonrpc": "2.0", "method": "refresh", "params": [true] }'
|
||||
|
||||
echo '* line1' >&5
|
||||
ui_out '{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "black", "bg": "white", "underline": "default", "attributes": [] }, "contents": "*" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " line1\u000a" }]], { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }] }'
|
||||
ui_out -ignore 2
|
||||
ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [false] }'
|
||||
|
||||
echo '* line2' >&5
|
||||
ui_out '{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "black", "bg": "white", "underline": "default", "attributes": [] }, "contents": "*" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " line1\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "* line2\u000a" }]], { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }] }'
|
||||
ui_out -ignore 2
|
||||
ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [false] }'
|
||||
|
||||
dd if=/dev/zero bs=2049 count=1 2>/dev/null | sed s/././g >&5
|
||||
ui_out -ignore 3
|
||||
ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [false] }'
|
||||
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "gjxH|wc -c | tr -d \" \"<ret>" ] }'
|
||||
ui_out -ignore 6
|
||||
ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [false] }'
|
||||
|
||||
exec 5>&-
|
||||
ui_out '{ "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "*fifo* 3:4 " }, { "face": { "fg": "black", "bg": "yellow", "underline": "default", "attributes": [] }, "contents": "[scratch]" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " - client0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "underline": "default", "attributes": [] }] }'
|
||||
ui_out -until '{ "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "*fifo* 3:4 " }, { "face": { "fg": "black", "bg": "yellow", "underline": "default", "attributes": [] }, "contents": "[scratch]" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " - client0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "underline": "default", "attributes": [] }] }'
|
||||
|
|
6
test/run
6
test/run
|
@ -190,6 +190,12 @@ ui_out() {
|
|||
skip_count=$(( skip_count - 1 ))
|
||||
done
|
||||
;;
|
||||
-until)
|
||||
shift
|
||||
while read -r event <&4; do
|
||||
[ "$event" = "$1" ] && break
|
||||
done
|
||||
;;
|
||||
-until-grep)
|
||||
shift
|
||||
while
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/sh
|
||||
command -v git >/dev/null
|
||||
command -v git >/dev/null && command -v perl >/dev/null
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
ui_out -ignore 7
|
||||
ui_out -ignore 11
|
||||
ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [false] }'
|
||||
|
||||
# We've jumped to the new version of line 2. Move to the old version so we
|
||||
# can annotate the old file.
|
||||
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "k:git blame<ret>" ] }'
|
||||
ui_out -ignore 11
|
||||
while ui_out -until-grep '"draw_status"' | grep '\[fifo\]'; do :; done > /dev/null
|
||||
|
||||
# We should have jumped to the old version of line 2, assert on kak_selection.
|
||||
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "x" ] }'
|
||||
ui_out -ignore 5
|
||||
ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [false] }'
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/sh
|
||||
command -v git >/dev/null
|
||||
command -v git >/dev/null && command -v perl >/dev/null
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
while ! ui_out -until-grep draw_status | grep -v '\[fifo\]' >/dev/null;
|
||||
do
|
||||
:
|
||||
while true; do
|
||||
ui_out -until-grep draw_status | grep -v '\[fifo\]' >/dev/null && break
|
||||
done
|
||||
actual_draw_status=$(ui_out -until-grep draw_status)
|
||||
|
||||
|
@ -11,5 +10,5 @@ EOF
|
|||
expected_subject_json=\"$(printf '%s' "$expected_subject" | sed 's/"/\\"/g')\"
|
||||
expected_draw_status='{ "jsonrpc": "2.0", "method": "draw_status", "params": [[{ "face": { "fg": "black", "bg": "yellow", "underline": "default", "attributes": [] }, "contents": '"$expected_subject_json"' }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "*git* 13:2 " }, { "face": { "fg": "black", "bg": "yellow", "underline": "default", "attributes": [] }, "contents": "[scratch]" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " - client0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "underline": "default", "attributes": [] }] }'
|
||||
|
||||
assert_eq "$actual_draw_status" "$expected_draw_status"
|
||||
assert_eq "$expected_draw_status" "$actual_draw_status"
|
||||
ui_out -ignore 2
|
||||
|
|
Loading…
Reference in New Issue
Block a user