Setting up windows using project lua file
This commit is contained in:
@@ -57,6 +57,9 @@ SDLK_X = 0x00000078
|
||||
SDLK_Y = 0x00000079
|
||||
SDLK_Z = 0x0000007a
|
||||
|
||||
VERTICAL = 1
|
||||
HORIZONTAL = 2
|
||||
|
||||
function IsAlpha(a)
|
||||
if a == nil then
|
||||
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
|
||||
@@ -1365,3 +1365,24 @@ String16 FetchLoadWord(void) {
|
||||
String16 string = GetString(active.buffer, range);
|
||||
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_Z = 0x0000007a
|
||||
|
||||
VERTICAL = 1
|
||||
HORIZONTAL = 2
|
||||
|
||||
function IsAlpha(a)
|
||||
if a == nil then
|
||||
return false
|
||||
@@ -137,7 +140,7 @@ function IsAlpha(a)
|
||||
end
|
||||
|
||||
function SkipLineAndColumn(s)
|
||||
local line, col = "1", "1"
|
||||
local line, col = "-1", "-1"
|
||||
|
||||
function parse_line_and_column(line_and_col, delimiter)
|
||||
ic, jc = line_and_col:find(delimiter)
|
||||
|
||||
@@ -33,5 +33,6 @@ luaL_Reg LuaFunctions[] = {
|
||||
{"SetWorkDir", Lua_SetWorkDir},
|
||||
{"ListCommands", Lua_ListCommands},
|
||||
{"GetBufferList", Lua_GetBufferList},
|
||||
{"Split", Lua_Split},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
@@ -2,23 +2,19 @@
|
||||
- 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?)
|
||||
- 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
|
||||
- Check. Convert more commands to taking buffer instead of view
|
||||
- Check. Rewrite more commands to use already implemented commands?
|
||||
- Lua namespaces for different kinds of commands (by ids, using main_set, using active_set)?
|
||||
- Some decl/function indexing in fuzzy format
|
||||
|
||||
- Set window layout using project file
|
||||
- Split command
|
||||
- not needed but would be nice:
|
||||
- Query ids somehow
|
||||
- Open buffer using id
|
||||
- Set active window using id
|
||||
- testing
|
||||
- maybe setup folders, a folder with project, without project, stuff like that
|
||||
- text_editor --record events.txt text_editor --playback events.txt
|
||||
|
||||
- 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?
|
||||
- dump text editor state to file, restore state
|
||||
- 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?)
|
||||
- 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)
|
||||
- text_editor --record events.txt text_editor --playback events.txt
|
||||
- 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)
|
||||
- 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
|
||||
- gap buffer
|
||||
- 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
|
||||
@@ -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) {
|
||||
Window *window = GetWindow(window_id);
|
||||
window->visible = v;
|
||||
|
||||
Reference in New Issue
Block a user