Small Open improvements

This commit is contained in:
Krzosa Karol
2024-08-04 14:49:02 +02:00
parent e3c1bcb56e
commit 7fc071154f
6 changed files with 58 additions and 18 deletions

View File

@@ -315,9 +315,26 @@ function GenericTextFileRule(_s)
return {kind = "text", file_path = file_path, line = line, col = col}
end
Rules = {}
Rules[#Rules + 1] = GenericTextFileRule
-- Rules[#Rules + 2] = RuleFindExistingBuffer
function MatchAgainstIncludes(s)
line, col, s = ExtractLineAndColumn(s)
include_paths = {
"C:/Work/text_editor/src",
"C:/Work/text_editor/src/text_editor",
}
for i = 1,#include_paths do
file_path = include_paths[i] .. '/' .. s
if FileExists(file_path) then
return {kind = "text", file_path = file_path, line = line, col = col}
end
end
return nil
end
Rules = {
GenericTextFileRule,
MatchAgainstIncludes,
}
function ApplyRules(s)
for i = #Rules,1,-1 do

View File

@@ -266,7 +266,9 @@ bool GlobalCommand(Event event) {
// for now let's leave it because we are relaying on global state
// - maybe just do the check if active window is matching the DocumentSelected window
// - if scrollbar selected then don't invoke window command
if (event.ctrl && Mouse(LEFT)) {
if (event.alt && Mouse(LEFT)) {
GoBackToLastCrumb();
} else if (event.ctrl && Mouse(LEFT)) {
Vec2I mouse = MouseVec2I();
Window *window = GetActiveWindow();
@@ -351,10 +353,6 @@ bool GlobalCommand(Event event) {
}
}
if (event.ctrl && Mouse(RIGHT)) {
GoBackToLastCrumb();
}
if (Ctrl(SDLK_GRAVE)) {
Window *window = GetWindow(ConsoleWindowID);
if (ToggleVisibility(window)) {

View File

@@ -818,7 +818,7 @@ void WindowCommand(Event event, Window *window, View *view) {
Open(string);
}
if (Ctrl(SDLK_W)) {
if (Alt(SDLK_Q)) {
GoBackToLastCrumb();
}

View File

@@ -185,9 +185,26 @@ function GenericTextFileRule(_s)
return {kind = "text", file_path = file_path, line = line, col = col}
end
Rules = {}
Rules[#Rules + 1] = GenericTextFileRule
-- Rules[#Rules + 2] = RuleFindExistingBuffer
function MatchAgainstIncludes(s)
line, col, s = ExtractLineAndColumn(s)
include_paths = {
"C:/Work/text_editor/src",
"C:/Work/text_editor/src/text_editor",
}
for i = 1,#include_paths do
file_path = include_paths[i] .. '/' .. s
if FileExists(file_path) then
return {kind = "text", file_path = file_path, line = line, col = col}
end
end
return nil
end
Rules = {
GenericTextFileRule,
MatchAgainstIncludes,
}
function ApplyRules(s)
for i = #Rules,1,-1 do

View File

@@ -105,7 +105,7 @@ int LuaFileExists(lua_State *L) {
String path = luaL_checkstring(L, 1);
lua_pop(L, 1);
bool exists = FileExists(path);
lua_pushinteger(L, (int)exists);
lua_pushboolean(L, exists);
return 1;
}

View File

@@ -1,21 +1,29 @@
- page up and down should also scroll and leave you in exactly same scroll
- I think the way sublime text and we display line highlights is confusing with multiple cursors (line highlight can be confused with selection)
- bug treats numbers as whitespace or whatever
- bug: Latin-1 is matched as column for some reason in ApplyRules!!
- mouse execute (right click)
- mouse execute (control right click)
- alt right click what to do ? (toggle console?)
- experiment with using multiple cursors to select command and it's input
- should be able click on title bar of windows which disappear on losing focus
- console window should close on esacpe but make it more coherent
- Ctrl + G should select the line number in bar
- open directories - resulting in buffer with dir listing and proper buffer name
- baked font as fallback
- expose font and font size to config
- global config and local config
- Search all buffers in 10X style, incrementally searched results popping up on every key press (maybe we need coroutine library in C so this is easier?)
- select space between parens,braces but make it good
- switch to previous view (ctrl + tab)
- we could rewrite kill lines with simpler commands - extend selection to encompass lines->replace
- search backwards
- experiment with using multiple cursors to select command and it's input
- search as a command to execute which is going to be in the title bar
- Ctrl + G should select the line number in bar
- console window should close on esacpe but make it more coherent
- make the editor replayable, store events and then replay, be careful about globals
- 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
- Search all buffers in 10X style, incrementally searched results popping up on every key press (maybe we need coroutine library in C so this is easier?)
- Implement shell interaction (here we also could use the coroutine library)
- word complete
- Colored strings