Small unix improvements
This commit is contained in:
3
build.sh
3
build.sh
@@ -1,3 +1,5 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
|
|
||||||
@@ -42,6 +44,7 @@ fi
|
|||||||
clang ../src/text_editor/text_editor.cpp ../src/basic/unix.cpp \
|
clang ../src/text_editor/text_editor.cpp ../src/basic/unix.cpp \
|
||||||
-o te_linux.exe \
|
-o te_linux.exe \
|
||||||
-nostdlib++ -fno-exceptions -fdiagnostics-absolute-paths -g \
|
-nostdlib++ -fno-exceptions -fdiagnostics-absolute-paths -g \
|
||||||
|
-DDEBUG_BUILD=1 \
|
||||||
-Wno-writable-strings \
|
-Wno-writable-strings \
|
||||||
-I../src/external/SDL/include \
|
-I../src/external/SDL/include \
|
||||||
-I../src/external/lua/src \
|
-I../src/external/lua/src \
|
||||||
|
|||||||
@@ -262,6 +262,9 @@ Process SpawnProcess(String command_line, String working_dir, String write_stdin
|
|||||||
const int PIPE_WRITE = 1;
|
const int PIPE_WRITE = 1;
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
|
||||||
|
printf("cmd = %.*s\n", FmtString(command_line));
|
||||||
|
printf("cwd = %.*s\n", FmtString(working_dir));
|
||||||
|
|
||||||
char *buffer = AllocArray(scratch, char, 4096);
|
char *buffer = AllocArray(scratch, char, 4096);
|
||||||
chdir(working_dir.data);
|
chdir(working_dir.data);
|
||||||
getcwd(buffer, 4096);
|
getcwd(buffer, 4096);
|
||||||
|
|||||||
@@ -300,9 +300,9 @@ void OnCommand(Event event) {
|
|||||||
ToggleVisibility(DebugWindowID);
|
ToggleVisibility(DebugWindowID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Press(SDLK_F11)) {
|
// if (Press(SDLK_F11)) {
|
||||||
Command_ToggleFullscreen();
|
// Command_ToggleFullscreen();
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (CtrlPress(SDLK_GRAVE)) {
|
if (CtrlPress(SDLK_GRAVE)) {
|
||||||
if (ActiveWindow != NullWindowID) {
|
if (ActiveWindow != NullWindowID) {
|
||||||
@@ -511,14 +511,14 @@ void OnCommand(Event event) {
|
|||||||
MergeCarets(active.buffer, &active.view->carets);
|
MergeCarets(active.buffer, &active.view->carets);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShiftPress(SDLK_F3)) {
|
if (AltPress(SDLK_N)) {
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
String16 search_string = GetSearchString(main.window);
|
String16 search_string = GetSearchString(main.window);
|
||||||
Caret caret = FindPrev(main.buffer, search_string, main.view->carets[0]);
|
Caret caret = FindPrev(main.buffer, search_string, main.view->carets[0]);
|
||||||
BSet search = GetBSet(main.window->search_bar_window);
|
BSet search = GetBSet(main.window->search_bar_window);
|
||||||
search.window->search_bar_anchor = caret;
|
search.window->search_bar_anchor = caret;
|
||||||
Command_SelectRangeOneCursor(main.view, caret);
|
Command_SelectRangeOneCursor(main.view, caret);
|
||||||
} else if (Press(SDLK_F3)) {
|
} else if (CtrlPress(SDLK_N)) {
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
String16 search_string = GetSearchString(main.window);
|
String16 search_string = GetSearchString(main.window);
|
||||||
Caret caret = FindNext(main.buffer, search_string, main.view->carets[0]);
|
Caret caret = FindNext(main.buffer, search_string, main.view->carets[0]);
|
||||||
|
|||||||
@@ -278,7 +278,6 @@ function MatchUnixPath(s, meta)
|
|||||||
local path = s:sub(i, j)
|
local path = s:sub(i, j)
|
||||||
local rest = s:sub(j + 1, -1)
|
local rest = s:sub(j + 1, -1)
|
||||||
local line, col, s = SkipLineAndColumn(rest)
|
local line, col, s = SkipLineAndColumn(rest)
|
||||||
Print(path, rest, line, col)
|
|
||||||
|
|
||||||
return {kind = "text", file_path = path, line = line, col = col}
|
return {kind = "text", file_path = path, line = line, col = col}
|
||||||
end
|
end
|
||||||
@@ -329,13 +328,14 @@ function MatchExec(s, meta)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if s:match(".exe$") or s:match(".bat$") or s:match(".sh$") then
|
if s:match("^%$") then
|
||||||
return {kind = "exec_console", cmd = s, working_dir = GetMainDir()}
|
Print("");
|
||||||
|
return {kind = "exec_console", cmd = s:sub(2, -1), working_dir = GetMainDir()}
|
||||||
end
|
end
|
||||||
|
|
||||||
if s:match("^%$") then
|
if s:match(".exe$") or s:match(".bat$") or s:match(".sh$") then
|
||||||
Print(s:sub(2, -1))
|
Print("");
|
||||||
return {kind = "exec_console", cmd = s:sub(2, -1), working_dir = GetMainDir()}
|
return {kind = "exec_console", cmd = s, working_dir = GetMainDir()}
|
||||||
end
|
end
|
||||||
|
|
||||||
Eval(s)
|
Eval(s)
|
||||||
@@ -387,22 +387,32 @@ end
|
|||||||
|
|
||||||
function KeybindsBasic(e)
|
function KeybindsBasic(e)
|
||||||
if e.key == SDLK_F and e.ctrl == 1 and e.shift == 1 then
|
if e.key == SDLK_F and e.ctrl == 1 and e.shift == 1 then
|
||||||
C("git grep -n "..GetLoadWord().." :/")
|
C("git -C "..GetMainDir().." grep -n "..GetLoadWord().." :/")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
FKey = {"build.bat", "", "", "", "", "", "", "", "", "", "", ""}
|
FKey = {"build.bat", "", "", "", "", "", "", "", "", "", ToggleFullscreen, ""}
|
||||||
FKeySDLK = {SDLK_F1, SDLK_F2, SDLK_F3, SDLK_F4, SDLK_F5, SDLK_F6, SDLK_F7, SDLK_F8, SDLK_F9, SDLK_F10, SDLK_F11, SDLK_F12}
|
FKeySDLK = {SDLK_F1, SDLK_F2, SDLK_F3, SDLK_F4, SDLK_F5, SDLK_F6, SDLK_F7, SDLK_F8, SDLK_F9, SDLK_F10, SDLK_F11, SDLK_F12}
|
||||||
|
|
||||||
|
if OS_VALUE == OS_WINDOWS then
|
||||||
|
FKey[1] = "build.bat"
|
||||||
|
else
|
||||||
|
FKey[1] = "./build.sh"
|
||||||
|
end
|
||||||
|
|
||||||
function KeybindsFKeys(e)
|
function KeybindsFKeys(e)
|
||||||
for i = #FKey,1,-1 do
|
for i = #FKey,1,-1 do
|
||||||
if FKey[i] ~= "" then
|
if FKey[i] ~= "" then
|
||||||
if e.key == FKeySDLK[i] then
|
if e.key == FKeySDLK[i] then
|
||||||
local cmdline = FKey[i]
|
local cmdline = FKey[i]
|
||||||
if type(cmdline) == "function" then cmdline = FKey[i]() end
|
if type(cmdline) == "function" then
|
||||||
Cmd { working_dir = GetWorkDir(), kind = "console", cmd = cmdline }
|
cmdline = FKey[i]()
|
||||||
|
end
|
||||||
|
if cmdline ~= nil then
|
||||||
|
Cmd { working_dir = GetWorkDir(), kind = "console", cmd = cmdline }
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ void UpdateProcesses() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Command_Append(view, Format(scratch, "process exited with code: %d\n", it.exit_code), it.scroll_to_end);
|
printf("exit code = %d\n", it.exit_code);
|
||||||
remove_item = true;
|
remove_item = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -309,6 +309,7 @@ void Windows_SetupVCVarsall(mco_coro *co) {
|
|||||||
#if _WIN32
|
#if _WIN32
|
||||||
int WinMain(void *hInstance, void *hPrevInstance, const char *lpCmdLine, int nShowCmd)
|
int WinMain(void *hInstance, void *hPrevInstance, const char *lpCmdLine, int nShowCmd)
|
||||||
#else
|
#else
|
||||||
|
extern char **environ;
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@@ -320,6 +321,12 @@ int main(int argc, char **argv)
|
|||||||
InitScratch();
|
InitScratch();
|
||||||
InitArena(&Perm);
|
InitArena(&Perm);
|
||||||
|
|
||||||
|
#if !OS_WINDOWS
|
||||||
|
for (int i = 0; environ[i]; i += 1) {
|
||||||
|
Add(&Enviroment, Copy(GetSystemAllocator(), environ[i]));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
WorkDir = GetWorkingDir(Perm);
|
WorkDir = GetWorkingDir(Perm);
|
||||||
{
|
{
|
||||||
String sdl_config_path = SDL_GetPrefPath("krzosa", "text_editor");
|
String sdl_config_path = SDL_GetPrefPath("krzosa", "text_editor");
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
- Add GetExeDir to lua, point at font automatically
|
||||||
|
- Rework PollStdout and stuff there to match both Unix and Windows properly
|
||||||
|
- Add metaprogram?
|
||||||
|
- Fix windows build
|
||||||
|
|
||||||
- Changing window properties by changing the window name?
|
- Changing window properties by changing the window name?
|
||||||
- commands for scrolling: center, cursor_at_bottom_of_screen, cursor_at_top
|
- commands for scrolling: center, cursor_at_bottom_of_screen, cursor_at_top
|
||||||
- Add metadata to Lua bindings so that we would get a better listing (function args?, what else?)
|
- Add metadata to Lua bindings so that we would get a better listing (function args?, what else?)
|
||||||
|
|||||||
Reference in New Issue
Block a user