Setting up windows using project lua file
This commit is contained in:
@@ -57,6 +57,9 @@ SDLK_X = 0x00000078
|
|||||||
SDLK_Y = 0x00000079
|
SDLK_Y = 0x00000079
|
||||||
SDLK_Z = 0x0000007a
|
SDLK_Z = 0x0000007a
|
||||||
|
|
||||||
|
VERTICAL = 1
|
||||||
|
HORIZONTAL = 2
|
||||||
|
|
||||||
function IsAlpha(a)
|
function IsAlpha(a)
|
||||||
if a == nil then
|
if a == nil then
|
||||||
return false
|
return false
|
||||||
|
|||||||
13
init.project.lua
Normal file
13
init.project.lua
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
FKey[2] = "remedybg.exe build\\te.exe"
|
||||||
|
FKey[5] = "remedybg.exe continue-execution"
|
||||||
|
FKey[9] = function () return 'remedybg.exe add-breakpoint-at-file '..GetFilename()..' '..tostring(GetLine()) end
|
||||||
|
FKey[10] = function () return 'remedybg.exe run-to-cursor '..GetFilename()..' '..tostring(GetLine()) end
|
||||||
|
|
||||||
|
|
||||||
|
function OnInit()
|
||||||
|
Open("init.project.lua")
|
||||||
|
Split(VERTICAL)
|
||||||
|
Open("src/text_editor/todo.txt")
|
||||||
|
Split(HORIZONTAL)
|
||||||
|
Open("src/text_editor/commands.cpp")
|
||||||
|
end
|
||||||
@@ -1364,4 +1364,25 @@ String16 FetchLoadWord(void) {
|
|||||||
if (GetSize(caret.range) == 0) range = EncloseLoadWord(active.buffer, GetFront(caret));
|
if (GetSize(caret.range) == 0) range = EncloseLoadWord(active.buffer, GetFront(caret));
|
||||||
String16 string = GetString(active.buffer, range);
|
String16 string = GetString(active.buffer, range);
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SplitWindow(WindowSplitKind kind) {
|
||||||
|
Window *window = CreateWindow();
|
||||||
|
View *view = OpenBufferView(ScratchBuffer->name);
|
||||||
|
window->active_view = view->id;
|
||||||
|
CreateTitlebar(window->id);
|
||||||
|
CreateSearchBar(window->id);
|
||||||
|
|
||||||
|
Window *active_window = GetActiveWindow();
|
||||||
|
SplitWindowEx(NULL, &WindowSplits, active_window, window, kind);
|
||||||
|
ActiveWindow = window->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Lua_Split(lua_State *L) {
|
||||||
|
lua_Integer kind = lua_tointeger(L, -1);
|
||||||
|
lua_pop(L, 1);
|
||||||
|
if (kind == 1 || kind == 2) {
|
||||||
|
SplitWindow((WindowSplitKind)kind);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -127,6 +127,9 @@ SDLK_X = 0x00000078
|
|||||||
SDLK_Y = 0x00000079
|
SDLK_Y = 0x00000079
|
||||||
SDLK_Z = 0x0000007a
|
SDLK_Z = 0x0000007a
|
||||||
|
|
||||||
|
VERTICAL = 1
|
||||||
|
HORIZONTAL = 2
|
||||||
|
|
||||||
function IsAlpha(a)
|
function IsAlpha(a)
|
||||||
if a == nil then
|
if a == nil then
|
||||||
return false
|
return false
|
||||||
@@ -137,7 +140,7 @@ function IsAlpha(a)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function SkipLineAndColumn(s)
|
function SkipLineAndColumn(s)
|
||||||
local line, col = "1", "1"
|
local line, col = "-1", "-1"
|
||||||
|
|
||||||
function parse_line_and_column(line_and_col, delimiter)
|
function parse_line_and_column(line_and_col, delimiter)
|
||||||
ic, jc = line_and_col:find(delimiter)
|
ic, jc = line_and_col:find(delimiter)
|
||||||
|
|||||||
@@ -33,5 +33,6 @@ luaL_Reg LuaFunctions[] = {
|
|||||||
{"SetWorkDir", Lua_SetWorkDir},
|
{"SetWorkDir", Lua_SetWorkDir},
|
||||||
{"ListCommands", Lua_ListCommands},
|
{"ListCommands", Lua_ListCommands},
|
||||||
{"GetBufferList", Lua_GetBufferList},
|
{"GetBufferList", Lua_GetBufferList},
|
||||||
|
{"Split", Lua_Split},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,23 +2,19 @@
|
|||||||
- 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?)
|
||||||
- Kill buffer command (it should be marked for deletion and deleted at the end of frame!)
|
- Kill buffer command (it should be marked for deletion and deleted at the end of frame!)
|
||||||
|
- Save all command
|
||||||
- Delete directory/file on disk command
|
- Delete directory/file on disk command
|
||||||
- Check. Convert more commands to taking buffer instead of view
|
- Check. Convert more commands to taking buffer instead of view
|
||||||
- Check. Rewrite more commands to use already implemented commands?
|
- Check. Rewrite more commands to use already implemented commands?
|
||||||
- Lua namespaces for different kinds of commands (by ids, using main_set, using active_set)?
|
- Lua namespaces for different kinds of commands (by ids, using main_set, using active_set)?
|
||||||
- Some decl/function indexing in fuzzy format
|
- Some decl/function indexing in fuzzy format
|
||||||
|
|
||||||
- Set window layout using project file
|
- testing
|
||||||
- Split command
|
- maybe setup folders, a folder with project, without project, stuff like that
|
||||||
- not needed but would be nice:
|
- text_editor --record events.txt text_editor --playback events.txt
|
||||||
- Query ids somehow
|
|
||||||
- Open buffer using id
|
|
||||||
- Set active window using id
|
|
||||||
- Fix jump scroll, the query ends up the last line on screen, kind of wacky
|
- Fix jump scroll, the query ends up the last line on screen, kind of wacky
|
||||||
|
|
||||||
- save all relevant buffers and build
|
|
||||||
- maybe most of the bindings should be in lua, but actual code in C
|
|
||||||
- maybe less code should be in lua ?? Lua code is very dodgey to change
|
|
||||||
- LoadWord, EncloseWord configurable?
|
- LoadWord, EncloseWord configurable?
|
||||||
- dump text editor state to file, restore state
|
- dump text editor state to file, restore state
|
||||||
- proper lister
|
- proper lister
|
||||||
@@ -41,7 +37,6 @@ backlog
|
|||||||
- Implement shell interaction (the valid cmd lines should start with '>' or '$', user can add more lines like this to expand the command size maybe?, if we have a case where we have a line with '>' but the last line doesn't have (just a space) then it should execute?)
|
- Implement shell interaction (the valid cmd lines should start with '>' or '$', user can add more lines like this to expand the command size maybe?, if we have a case where we have a line with '>' but the last line doesn't have (just a space) then it should execute?)
|
||||||
- drop text into window
|
- drop text into window
|
||||||
- I think the way sublime text and we display line highlights is confusing with multiple cursors (line highlight can be confused with selection)
|
- I think the way sublime text and we display line highlights is confusing with multiple cursors (line highlight can be confused with selection)
|
||||||
- text_editor --record events.txt text_editor --playback events.txt
|
|
||||||
- make the editor replayable, store events and then replay, be careful about globals
|
- make the editor replayable, store events and then replay, be careful about globals
|
||||||
- maybe open should return multiple options if there are many more? (like in sublime if many symbols you get a window and you choose and it automatically jumps you to the symbol in the background)
|
- maybe open should return multiple options if there are many more? (like in sublime if many symbols you get a window and you choose and it automatically jumps you to the symbol in the background)
|
||||||
- I want a way to assign flags to buffers/views/windows from user perspective so that console window concept can be created from user space
|
- I want a way to assign flags to buffers/views/windows from user perspective so that console window concept can be created from user space
|
||||||
@@ -50,7 +45,7 @@ backlog
|
|||||||
- redo tree
|
- redo tree
|
||||||
- gap buffer
|
- gap buffer
|
||||||
- optimize rendering - command buffer, and vertice buffer instead of vertice buffer with scissor
|
- optimize rendering - command buffer, and vertice buffer instead of vertice buffer with scissor
|
||||||
- fix mouse cursor code, visual artifacts, fast cursor changing stuff
|
- fix sdl mouse cursor code, visual artifacts, fast cursor changing stuff
|
||||||
|
|
||||||
|
|
||||||
!!As little lua code as possible, but lua code should be powerful just in case of quick edits
|
!!As little lua code as possible, but lua code should be powerful just in case of quick edits
|
||||||
@@ -89,18 +89,6 @@ void SplitWindowEx(WindowSplit **node, WindowSplit *split, Window *target, Windo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplitWindow(WindowSplitKind kind) {
|
|
||||||
Window *window = CreateWindow();
|
|
||||||
View *view = OpenBufferView(ScratchBuffer->name);
|
|
||||||
window->active_view = view->id;
|
|
||||||
CreateTitlebar(window->id);
|
|
||||||
CreateSearchBar(window->id);
|
|
||||||
|
|
||||||
Window *active_window = GetActiveWindow();
|
|
||||||
SplitWindowEx(NULL, &WindowSplits, active_window, window, kind);
|
|
||||||
ActiveWindow = window->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetVisibility(WindowID window_id, bool v) {
|
void SetVisibility(WindowID window_id, bool v) {
|
||||||
Window *window = GetWindow(window_id);
|
Window *window = GetWindow(window_id);
|
||||||
window->visible = v;
|
window->visible = v;
|
||||||
|
|||||||
Reference in New Issue
Block a user