Merge remote-tracking branch 'freefull/master'

This commit is contained in:
Maxime Coste 2015-09-24 23:01:20 +01:00
commit 48a7448b11
5 changed files with 27 additions and 2 deletions

View File

@ -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

View File

@ -20,6 +20,12 @@
#include <mach-o/dyld.h>
#endif
#if defined(__HAIKU__)
#include <app/Application.h>
#include <app/Roster.h>
#include <storage/Path.h>
#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

View File

@ -21,6 +21,8 @@
#include <termios.h>
#include <unistd.h>
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;

View File

@ -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;

View File

@ -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);