save
This commit is contained in:
248
build_file.cpp
248
build_file.cpp
@@ -183,251 +183,6 @@ char *C(const char *value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
S8_String LuaScript = R"==(
|
|
||||||
INTERNET_BROWSER = 'C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe'
|
|
||||||
|
|
||||||
SDLK_CTRL = 1073742048
|
|
||||||
SDLK_PAGE_DOWN = 1073741902
|
|
||||||
SDLK_PAGE_UP = 1073741899
|
|
||||||
SDLK_DOWN = 1073741905 -- 0x40000051
|
|
||||||
SDLK_UP = 1073741906 -- 0x40000052u
|
|
||||||
SDLK_RIGHT = 1073741903
|
|
||||||
SDLK_LEFT = 1073741904
|
|
||||||
SDLK_Q = 113
|
|
||||||
SDLK_BACKSLASH = 0x5c
|
|
||||||
SDLK_RETURN = 13
|
|
||||||
|
|
||||||
SDLK_F1 = 0x4000003a
|
|
||||||
SDLK_F2 = 0x4000003b
|
|
||||||
SDLK_F3 = 0x4000003c
|
|
||||||
SDLK_F4 = 0x4000003d
|
|
||||||
SDLK_F5 = 0x4000003e
|
|
||||||
SDLK_F6 = 0x4000003f
|
|
||||||
SDLK_F7 = 0x40000040
|
|
||||||
SDLK_F8 = 0x40000041
|
|
||||||
SDLK_F9 = 0x40000042
|
|
||||||
SDLK_F10 = 0x40000043
|
|
||||||
SDLK_F11 = 0x40000044
|
|
||||||
SDLK_F12 = 0x40000045
|
|
||||||
|
|
||||||
SDLK_A = 0x00000061
|
|
||||||
SDLK_B = 0x00000062
|
|
||||||
SDLK_C = 0x00000063
|
|
||||||
SDLK_D = 0x00000064
|
|
||||||
SDLK_E = 0x00000065
|
|
||||||
SDLK_F = 0x00000066
|
|
||||||
SDLK_G = 0x00000067
|
|
||||||
SDLK_H = 0x00000068
|
|
||||||
SDLK_I = 0x00000069
|
|
||||||
SDLK_J = 0x0000006a
|
|
||||||
SDLK_K = 0x0000006b
|
|
||||||
SDLK_L = 0x0000006c
|
|
||||||
SDLK_M = 0x0000006d
|
|
||||||
SDLK_N = 0x0000006e
|
|
||||||
SDLK_O = 0x0000006f
|
|
||||||
SDLK_P = 0x00000070
|
|
||||||
SDLK_Q = 0x00000071
|
|
||||||
SDLK_R = 0x00000072
|
|
||||||
SDLK_S = 0x00000073
|
|
||||||
SDLK_T = 0x00000074
|
|
||||||
SDLK_U = 0x00000075
|
|
||||||
SDLK_V = 0x00000076
|
|
||||||
SDLK_W = 0x00000077
|
|
||||||
SDLK_X = 0x00000078
|
|
||||||
SDLK_Y = 0x00000079
|
|
||||||
SDLK_Z = 0x0000007a
|
|
||||||
|
|
||||||
function SkipLineAndColumn(s)
|
|
||||||
local line, col = "1", "1"
|
|
||||||
|
|
||||||
function parse_line_and_column(line_and_col, delimiter)
|
|
||||||
ic, jc = line_and_col:find(delimiter)
|
|
||||||
line = line_and_col:sub(1, ic - 1)
|
|
||||||
col = line_and_col:sub(ic + 1)
|
|
||||||
return line, col
|
|
||||||
end
|
|
||||||
|
|
||||||
do -- :line:column
|
|
||||||
local i, j = s:find("^:%d+:%d+")
|
|
||||||
if i then
|
|
||||||
skip_pattern = s:sub(j + 1)
|
|
||||||
line, col = parse_line_and_column(s:sub(2, j), ":")
|
|
||||||
return line, col, skip_pattern
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
do -- :line
|
|
||||||
local i, j = s:find("^:%d+")
|
|
||||||
if i then
|
|
||||||
skip_pattern = s:sub(j + 1)
|
|
||||||
line = s:sub(2, j)
|
|
||||||
return line, col, skip_pattern
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
do -- (line,column)
|
|
||||||
local i, j = s:find("^%(%d+,%d+%)")
|
|
||||||
if i then
|
|
||||||
skip_pattern = s:sub(j + 1)
|
|
||||||
line, col = parse_line_and_column(s:sub(2, j - 1), ",")
|
|
||||||
return line, col, skip_pattern
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
do -- (line)
|
|
||||||
local i, j = s:find("^%(%d+%)")
|
|
||||||
if i then
|
|
||||||
skip_pattern = s:sub(j + 1)
|
|
||||||
line = s:sub(2, j - 1)
|
|
||||||
return line, col, skip_pattern
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return line, col, s
|
|
||||||
end
|
|
||||||
|
|
||||||
function SkipSlashes(s)
|
|
||||||
found_slash = false
|
|
||||||
while s:sub(1,1) == '/' or s:sub(1,1) == '\\' do
|
|
||||||
s = s:sub(2)
|
|
||||||
found_slash = true
|
|
||||||
end
|
|
||||||
return s, found_slash
|
|
||||||
end
|
|
||||||
|
|
||||||
function SkipDrive(s)
|
|
||||||
local i, j = s:find("^%a:")
|
|
||||||
if not i then return s, nil, true end
|
|
||||||
|
|
||||||
local drive = s:sub(i, j)
|
|
||||||
local new_s = s:sub(j + 1)
|
|
||||||
|
|
||||||
new_s, found_slash = SkipSlashes(new_s)
|
|
||||||
if not found_slash then return s, drive, false end
|
|
||||||
|
|
||||||
return new_s, drive, true
|
|
||||||
end
|
|
||||||
|
|
||||||
function SkipPathCell(s)
|
|
||||||
local i, j = s:find("^[%w_%.-% +]+")
|
|
||||||
if not i then return s, nil, false end
|
|
||||||
|
|
||||||
local word = s:sub(i, j)
|
|
||||||
local new_s = s:sub(j + 1)
|
|
||||||
local new_s, found_slash = SkipSlashes(new_s)
|
|
||||||
|
|
||||||
return new_s, word, found_slash
|
|
||||||
end
|
|
||||||
|
|
||||||
function SkipPath(s)
|
|
||||||
local input_s = s
|
|
||||||
local s, drive, ok = SkipDrive(s)
|
|
||||||
if not ok then return s end
|
|
||||||
|
|
||||||
local cells = {}
|
|
||||||
while true do
|
|
||||||
s, word, slash_eaten = SkipPathCell(s)
|
|
||||||
if word then cells[#cells + 1] = word end
|
|
||||||
if not slash_eaten then break end
|
|
||||||
end
|
|
||||||
|
|
||||||
if #cells == 0 then return s end
|
|
||||||
|
|
||||||
local skip_size = input_s:len() - s:len()
|
|
||||||
local path = input_s:sub(1, skip_size)
|
|
||||||
return s, path, drive, cells
|
|
||||||
end
|
|
||||||
|
|
||||||
function MatchWindowsPath(_s)
|
|
||||||
local s, file_path, drive = SkipPath(_s)
|
|
||||||
if not file_path then return nil end
|
|
||||||
|
|
||||||
if not drive then
|
|
||||||
local d = GetDir()
|
|
||||||
file_path = d..'/'..file_path
|
|
||||||
end
|
|
||||||
local line, col, s = SkipLineAndColumn(s)
|
|
||||||
|
|
||||||
local exists = FileExists(file_path) or BufferExists(file_path)
|
|
||||||
if not exists then return nil end
|
|
||||||
|
|
||||||
return {kind = "text", file_path = file_path, line = line, col = col}
|
|
||||||
end
|
|
||||||
|
|
||||||
function MatchGitCommit(s)
|
|
||||||
local i, j = string.find(s, "^commit ([a-zA-Z0-9]+)")
|
|
||||||
if i then
|
|
||||||
s = s:sub(8)
|
|
||||||
local command = "git --no-pager show "..s
|
|
||||||
return {kind = "exec", cmd = command, working_dir = GetDir()}
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
function MatchURL(s)
|
|
||||||
local i, j = string.find(s, "^https://")
|
|
||||||
if i then
|
|
||||||
return {kind = "exec_console", cmd = '"'..INTERNET_BROWSER..'" '..s, working_dir = GetDir()}
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
Rules = {
|
|
||||||
MatchWindowsPath,
|
|
||||||
MatchGitCommit,
|
|
||||||
MatchURL,
|
|
||||||
}
|
|
||||||
|
|
||||||
function ApplyRules(s)
|
|
||||||
for i = #Rules,1,-1 do
|
|
||||||
rule = Rules[i]
|
|
||||||
result = rule(s)
|
|
||||||
if result then
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
Coroutines = {}
|
|
||||||
function AddCo(f)
|
|
||||||
local i = #Coroutines + 1
|
|
||||||
Coroutines[i] = coroutine.create(f)
|
|
||||||
coroutine.resume(Coroutines[i])
|
|
||||||
return Coroutines[i]
|
|
||||||
end
|
|
||||||
|
|
||||||
OnCommandCallbacks = {}
|
|
||||||
table.insert(OnCommandCallbacks, function (e)
|
|
||||||
if e.key == SDLK_F and e.ctrl == 1 and e.shift == 1 then
|
|
||||||
C("git grep -n "..GetLoadWord().." :/") end
|
|
||||||
if e.key == SDLK_L and e.ctrl == 1 then
|
|
||||||
Eval(GetLoadWord()) end
|
|
||||||
end)
|
|
||||||
|
|
||||||
function OnUpdate(e)
|
|
||||||
local new_co_list = {}
|
|
||||||
for key, co in pairs(Coroutines) do
|
|
||||||
local status = coroutine.status(co)
|
|
||||||
if status ~= "dead" then
|
|
||||||
coroutine.resume(co, e)
|
|
||||||
new_co_list[#new_co_list + 1] = co
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Coroutines = new_co_list
|
|
||||||
end
|
|
||||||
|
|
||||||
function OnCommand(e)
|
|
||||||
for i = #OnCommandCallbacks,1,-1 do
|
|
||||||
on_command = OnCommandCallbacks[i]
|
|
||||||
on_command(e)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function OnInit()
|
|
||||||
end
|
|
||||||
)==";
|
|
||||||
|
|
||||||
void GenerateConfig() {
|
void GenerateConfig() {
|
||||||
struct Var {
|
struct Var {
|
||||||
const char *name;
|
const char *name;
|
||||||
@@ -537,7 +292,8 @@ void GenerateConfig() {
|
|||||||
else sb.add(Fmt("Style.%s = \"%s\"", it.name, it.value));
|
else sb.add(Fmt("Style.%s = \"%s\"", it.name, it.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.add(LuaScript);
|
S8_String init_file = OS_ReadFile(scratch, "../data/init.lua");
|
||||||
|
sb.add(init_file);
|
||||||
}
|
}
|
||||||
sb.add(")==\";");
|
sb.add(")==\";");
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,6 @@ void Command_Append(View *view, String16 string, bool scroll_to_end_if_cursor_on
|
|||||||
|
|
||||||
Command_SelectRangeOneCursor(view, GetEndAsRange(buffer));
|
Command_SelectRangeOneCursor(view, GetEndAsRange(buffer));
|
||||||
Command_Replace(view, string);
|
Command_Replace(view, string);
|
||||||
Command_Replace(view, u"\n");
|
|
||||||
|
|
||||||
if (scroll_to_end) {
|
if (scroll_to_end) {
|
||||||
view->carets[0] = MakeCaret(GetEndAsRange(buffer).min);
|
view->carets[0] = MakeCaret(GetEndAsRange(buffer).min);
|
||||||
@@ -185,7 +184,7 @@ void ReportErrorf(const char *fmt, ...) {
|
|||||||
STRING_FORMAT(scratch, fmt, string);
|
STRING_FORMAT(scratch, fmt, string);
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error!", string.data, NULL);
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error!", string.data, NULL);
|
||||||
View *view = GetView(NullViewID);
|
View *view = GetView(NullViewID);
|
||||||
Command_Append(view, string, true);
|
Command_Appendf(view, "%.*s\n", FmtString(string));
|
||||||
|
|
||||||
// Set console view as active
|
// Set console view as active
|
||||||
{
|
{
|
||||||
@@ -207,14 +206,14 @@ void ReportConsolef(const char *fmt, ...) {
|
|||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
STRING_FORMAT(scratch, fmt, string);
|
STRING_FORMAT(scratch, fmt, string);
|
||||||
View *view = GetView(NullViewID);
|
View *view = GetView(NullViewID);
|
||||||
Command_Append(view, string, true);
|
Command_Appendf(view, "%.*s\n", FmtString(string));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReportWarningf(const char *fmt, ...) {
|
void ReportWarningf(const char *fmt, ...) {
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
STRING_FORMAT(scratch, fmt, string);
|
STRING_FORMAT(scratch, fmt, string);
|
||||||
View *null_view = GetView(NullViewID);
|
View *null_view = GetView(NullViewID);
|
||||||
Command_Append(null_view, string, true);
|
Command_Appendf(null_view, "%.*s\n", FmtString(string));
|
||||||
|
|
||||||
// Set console view as active
|
// Set console view as active
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,11 @@ void ListFilesRecursive(Buffer *buffer, String filename) {
|
|||||||
if (it.is_directory) {
|
if (it.is_directory) {
|
||||||
ListFilesRecursive(buffer, it.absolute_path);
|
ListFilesRecursive(buffer, it.absolute_path);
|
||||||
} else {
|
} else {
|
||||||
bool good = EndsWith(it.filename, ".c") || EndsWith(it.filename, ".h") || EndsWith(it.filename, ".cpp") || EndsWith(it.filename, ".hpp");
|
bool good = EndsWith(it.filename, ".c") ||
|
||||||
|
EndsWith(it.filename, ".h") ||
|
||||||
|
EndsWith(it.filename, ".cpp") ||
|
||||||
|
EndsWith(it.filename, ".hpp") ||
|
||||||
|
EndsWith(it.filename, ".bat");
|
||||||
if (!good) {
|
if (!good) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -274,10 +278,8 @@ void OnCommand(Event event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CtrlShiftPress(SDLK_P)) {
|
if (CtrlPress(SDLK_P)) {
|
||||||
Command_ListBuffers();
|
Command_ListBuffers();
|
||||||
} else if (CtrlPress(SDLK_P)) {
|
|
||||||
Command_GetCFiles();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CtrlShiftPress(SDLK_BACKSLASH)) {
|
if (CtrlShiftPress(SDLK_BACKSLASH)) {
|
||||||
@@ -322,8 +324,6 @@ void OnCommand(Event event) {
|
|||||||
WindowOpenBufferView(active.window, event.text);
|
WindowOpenBufferView(active.window, event.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (CtrlAltPress(SDLK_DOWN)) {
|
if (CtrlAltPress(SDLK_DOWN)) {
|
||||||
Command_DuplicateLine(active.view, DIR_DOWN);
|
Command_DuplicateLine(active.view, DIR_DOWN);
|
||||||
} else if (AltShiftPress(SDLK_DOWN)) {
|
} else if (AltShiftPress(SDLK_DOWN)) {
|
||||||
@@ -490,7 +490,9 @@ void OnCommand(Event event) {
|
|||||||
Command_IdentedNewLine(active.view);
|
Command_IdentedNewLine(active.view);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CtrlPress(SDLK_F)) {
|
if (CtrlShiftPress(SDLK_F)) {
|
||||||
|
// because using lua thing
|
||||||
|
} else if (CtrlPress(SDLK_F)) {
|
||||||
if (!active.window->is_search_bar) {
|
if (!active.window->is_search_bar) {
|
||||||
BSet search = GetBSet(main.window->search_bar_window);
|
BSet search = GetBSet(main.window->search_bar_window);
|
||||||
String16 string = GetString(main.buffer, main.view->carets[0].range);
|
String16 string = GetString(main.buffer, main.view->carets[0].range);
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ Style.FontSize = 12
|
|||||||
Style.FontFilter = 0
|
Style.FontFilter = 0
|
||||||
Style.Font = "C:/Windows/Fonts/consola.ttf"
|
Style.Font = "C:/Windows/Fonts/consola.ttf"
|
||||||
Style.VCVarsall = "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvars64.bat"
|
Style.VCVarsall = "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvars64.bat"
|
||||||
|
|
||||||
INTERNET_BROWSER = 'C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe'
|
INTERNET_BROWSER = 'C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe'
|
||||||
|
|
||||||
SDLK_CTRL = 1073742048
|
SDLK_CTRL = 1073742048
|
||||||
@@ -181,13 +180,17 @@ end
|
|||||||
|
|
||||||
function SkipDrive(s)
|
function SkipDrive(s)
|
||||||
local i, j = s:find("^%a:")
|
local i, j = s:find("^%a:")
|
||||||
if not i then return s, nil, true end
|
if not i then
|
||||||
|
return s, nil, true
|
||||||
|
end
|
||||||
|
|
||||||
local drive = s:sub(i, j)
|
local drive = s:sub(i, j)
|
||||||
local new_s = s:sub(j + 1)
|
local new_s = s:sub(j + 1)
|
||||||
|
|
||||||
new_s, found_slash = SkipSlashes(new_s)
|
new_s, found_slash = SkipSlashes(new_s)
|
||||||
if not found_slash then return s, drive, false end
|
if not found_slash then
|
||||||
|
return s, drive, false
|
||||||
|
end
|
||||||
|
|
||||||
return new_s, drive, true
|
return new_s, drive, true
|
||||||
end
|
end
|
||||||
@@ -209,6 +212,10 @@ function SkipPath(s)
|
|||||||
if not ok then return s end
|
if not ok then return s end
|
||||||
|
|
||||||
local cells = {}
|
local cells = {}
|
||||||
|
if drive ~= nil then
|
||||||
|
table.insert(cells, drive)
|
||||||
|
end
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
s, word, slash_eaten = SkipPathCell(s)
|
s, word, slash_eaten = SkipPathCell(s)
|
||||||
if word then cells[#cells + 1] = word end
|
if word then cells[#cells + 1] = word end
|
||||||
@@ -224,7 +231,14 @@ end
|
|||||||
|
|
||||||
function MatchWindowsPath(_s)
|
function MatchWindowsPath(_s)
|
||||||
local s, file_path, drive = SkipPath(_s)
|
local s, file_path, drive = SkipPath(_s)
|
||||||
if not file_path then return nil end
|
|
||||||
|
if not file_path and FileExists(drive) then
|
||||||
|
return {kind = "text", file_path = drive, line = line, col = col}
|
||||||
|
end
|
||||||
|
|
||||||
|
if not file_path then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
if not drive then
|
if not drive then
|
||||||
local d = GetDir()
|
local d = GetDir()
|
||||||
@@ -310,7 +324,6 @@ end
|
|||||||
|
|
||||||
function OnInit()
|
function OnInit()
|
||||||
end
|
end
|
||||||
|
|
||||||
)==";
|
)==";
|
||||||
void ReloadStyle() {
|
void ReloadStyle() {
|
||||||
ColorText = GetColor("Text", ColorText);
|
ColorText = GetColor("Text", ColorText);
|
||||||
|
|||||||
@@ -38,6 +38,35 @@ View *Command_ExecHidden(String buffer_name, String cmd, String working_dir) {
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// void Command_Exec(String cmd) {
|
||||||
|
// BSet main = GetActiveMainSet();
|
||||||
|
// Window *next_window = GetNextLayoutWindow(main.window);
|
||||||
|
// BSet set = GetBSet(next_window);
|
||||||
|
// CheckpointBeforeGoto(set.window);
|
||||||
|
|
||||||
|
// String working_dir = Command_GetDir();
|
||||||
|
// Exec(NullViewID, true, cmd, working_dir);
|
||||||
|
|
||||||
|
// set.window->active_view = NullViewID;
|
||||||
|
// ActiveWindow = set.window->id;
|
||||||
|
// }
|
||||||
|
|
||||||
|
void Command_Exec(String cmd, String working_dir) {
|
||||||
|
BSet main = GetActiveMainSet();
|
||||||
|
CheckpointBeforeGoto(main.window);
|
||||||
|
|
||||||
|
Buffer *buffer = GetBuffer(NullBufferID);
|
||||||
|
View *view = WindowOpenBufferView(main.window, buffer->name);
|
||||||
|
Exec(view->id, true, cmd, working_dir);
|
||||||
|
|
||||||
|
Int pos = XYToPos(buffer, {0, buffer->line_starts.len - 1});
|
||||||
|
view->carets[0] = MakeCaret(pos);
|
||||||
|
UpdateScroll(main.window, true);
|
||||||
|
|
||||||
|
main.window->active_view = view->id;
|
||||||
|
ActiveWindow = main.window->id;
|
||||||
|
}
|
||||||
|
|
||||||
void Command_Open(String path) {
|
void Command_Open(String path) {
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
|
|
||||||
@@ -71,8 +100,9 @@ void Command_Open(String path) {
|
|||||||
} else if (FieldString(LuaState, "kind") == "exec") {
|
} else if (FieldString(LuaState, "kind") == "exec") {
|
||||||
String cmd = FieldString(LuaState, "cmd");
|
String cmd = FieldString(LuaState, "cmd");
|
||||||
String working_dir = FieldString(LuaState, "working_dir");
|
String working_dir = FieldString(LuaState, "working_dir");
|
||||||
Command_ExecInNewBuffer(main, cmd, working_dir);
|
Command_Exec(cmd, Command_GetDir());
|
||||||
} else if (FieldString(LuaState, "kind") == "exec_console") {
|
} else if (FieldString(LuaState, "kind") == "exec_console") {
|
||||||
|
// this shouldn't change the focus/window/view
|
||||||
String cmd = FieldString(LuaState, "cmd");
|
String cmd = FieldString(LuaState, "cmd");
|
||||||
String working_dir = FieldString(LuaState, "working_dir");
|
String working_dir = FieldString(LuaState, "working_dir");
|
||||||
Exec(NullViewID, true, cmd, working_dir);
|
Exec(NullViewID, true, cmd, working_dir);
|
||||||
@@ -87,11 +117,10 @@ void Command_Open(String16 path) {
|
|||||||
Command_Open(string);
|
Command_Open(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Lua_AppendCmd(lua_State *L) {
|
int Lua_C(lua_State *L) {
|
||||||
String string = lua_tostring(L, 1);
|
String string = lua_tostring(L, 1);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
String working_dir = Command_GetDir();
|
Command_Exec(string, Command_GetDir());
|
||||||
Exec(NullViewID, true, string, working_dir);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +136,7 @@ int Lua_Eval(lua_State *L) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Lua_C(lua_State *L) {
|
int Lua_NewWindowCMD(lua_State *L) {
|
||||||
String string = lua_tostring(L, 1);
|
String string = lua_tostring(L, 1);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
@@ -158,8 +187,9 @@ int Lua_Print(lua_State *L) {
|
|||||||
View *null_view = GetView(NullViewID);
|
View *null_view = GetView(NullViewID);
|
||||||
for (int i = 1; i <= nargs; i += 1) {
|
for (int i = 1; i <= nargs; i += 1) {
|
||||||
String string = lua_tostring(L, i);
|
String string = lua_tostring(L, i);
|
||||||
Command_Append(null_view, string, true);
|
Command_Appendf(null_view, "%.*s ", FmtString(string));
|
||||||
}
|
}
|
||||||
|
Command_Appendf(null_view, "\n");
|
||||||
lua_pop(L, nargs);
|
lua_pop(L, nargs);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -441,6 +471,7 @@ void ReloadStyle();
|
|||||||
extern String BaseLuaConfig;
|
extern String BaseLuaConfig;
|
||||||
|
|
||||||
void LoadLuaBuffer(Buffer *lua_buffer) {
|
void LoadLuaBuffer(Buffer *lua_buffer) {
|
||||||
|
if (!lua_buffer) return;
|
||||||
ReportConsolef("reloading config: %.*s", FmtString(lua_buffer->name));
|
ReportConsolef("reloading config: %.*s", FmtString(lua_buffer->name));
|
||||||
|
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
luaL_Reg LuaFunctions[] = {
|
luaL_Reg LuaFunctions[] = {
|
||||||
{"AppendCmd", Lua_AppendCmd},
|
|
||||||
{"Eval", Lua_Eval},
|
|
||||||
{"C", Lua_C},
|
{"C", Lua_C},
|
||||||
|
{"Eval", Lua_Eval},
|
||||||
|
{"NewWindowCMD", Lua_NewWindowCMD},
|
||||||
{"Cmd", Lua_Cmd},
|
{"Cmd", Lua_Cmd},
|
||||||
{"Print", Lua_Print},
|
{"Print", Lua_Print},
|
||||||
{"Kill", Lua_Kill},
|
{"Kill", Lua_Kill},
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ void KillProcess(View *view) {
|
|||||||
if (view_id == view->id) {
|
if (view_id == view->id) {
|
||||||
KillProcess(&it);
|
KillProcess(&it);
|
||||||
remove_item = true;
|
remove_item = true;
|
||||||
String string = "process was killed by user";
|
String string = "process was killed by user\n";
|
||||||
Command_Append(view, string, it.scroll_to_end);
|
Command_Append(view, string, it.scroll_to_end);
|
||||||
// dont break because that will fuck with removal ...
|
// dont break because that will fuck with removal ...
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
- maybe commands should mostly be dumped into a single buffer
|
||||||
- When moving last line alt + arrow key it moves it into upper line, super annoying
|
- When moving last line alt + arrow key it moves it into upper line, super annoying
|
||||||
- maybe we could allow user to change window titles which would make them special in some way. A:/text_editor/+test_buffer:1:1:ADE |
|
- maybe we could allow user to change window titles which would make them special in some way. A:/text_editor/+test_buffer:1:1:ADE |
|
||||||
|
|
||||||
@@ -12,6 +13,7 @@ activate_buffer
|
|||||||
- dump text editor state to file, restore state
|
- dump text editor state to file, restore state
|
||||||
- help menu popup when for example in process buffer, on tile bar buffer and stuff like that
|
- help menu popup when for example in process buffer, on tile bar buffer and stuff like that
|
||||||
- shift click inside selection should move the selection
|
- shift click inside selection should move the selection
|
||||||
|
- shift click larger then screen jumps the view to other caret
|
||||||
- report errors (try showing a window)
|
- report errors (try showing a window)
|
||||||
- proper lister
|
- proper lister
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user