diff --git a/src/Makefile b/src/Makefile index bd5e871e..f3b32238 100644 --- a/src/Makefile +++ b/src/Makefile @@ -28,6 +28,8 @@ os := $(shell uname) ifeq ($(os),Darwin) LIBS += -lncurses -lboost_regex-mt +else ifeq ($(os),Haiku) + LIBS += -lncursesw -lboost_regex -lnetwork -lbe else ifneq (,$(findstring CYGWIN,$(os))) LIBS += -lncursesw -lboost_regex -ldbghelp else diff --git a/src/file.cc b/src/file.cc index 9810a3d5..2e67f872 100644 --- a/src/file.cc +++ b/src/file.cc @@ -20,6 +20,12 @@ #include #endif +#if defined(__HAIKU__) +#include +#include +#include +#endif + namespace Kakoune { @@ -488,6 +494,13 @@ String get_kak_binary_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(); #else # error "finding executable path is not implemented on this platform" #endif diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index cdcf5d50..9dfca1ad 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -21,6 +21,8 @@ #include #include +constexpr char control(char c) { return c & 037; } + namespace Kakoune { @@ -506,12 +508,12 @@ Key NCursesUI::get_key() if (c > 0 and c < 27) { - if (c == CTRL('l')) + if (c == control('l')) { redrawwin(m_window); redraw(); } - if (c == CTRL('z')) + if (c == control('z')) { raise(SIGTSTP); return Key::Invalid; diff --git a/src/string.cc b/src/string.cc index e0f3525d..22d4e609 100644 --- a/src/string.cc +++ b/src/string.cc @@ -148,6 +148,13 @@ InplaceString<15> to_string(int val) return res; } +InplaceString<23> to_string(long int val) +{ + InplaceString<23> res; + res.m_length = sprintf(res.m_data, "%li", val); + return res; +} + InplaceString<23> to_string(size_t val) { InplaceString<23> res; diff --git a/src/string.hh b/src/string.hh index d15baa34..eb98eb03 100644 --- a/src/string.hh +++ b/src/string.hh @@ -278,6 +278,7 @@ struct Hex { size_t val; }; inline Hex hex(size_t val) { return {val}; } InplaceString<15> to_string(int val); +InplaceString<23> to_string(long int val); InplaceString<23> to_string(size_t val); InplaceString<23> to_string(Hex val); InplaceString<23> to_string(float val);