Fix autoenclose and override F1 in config

This commit is contained in:
Krzosa Karol
2024-08-15 12:44:27 +02:00
parent e49838b974
commit fbe34b2d40
6 changed files with 28 additions and 5 deletions

View File

@@ -385,6 +385,10 @@ function OnUpdate(e)
end
function OnCommand(e)
if e.key == KEY_F1 then
local word = GetLoadWord()
C('git grep -n '..word)
end
end
function OnInit()

View File

@@ -1,6 +1,7 @@
void OnCommand(Event event) {
ProfileFunction();
WindowID start_command_active_window = ActiveWindow;
//
// Window cursor setting
@@ -490,6 +491,11 @@ void OnCommand(Event event) {
}
}
if (start_command_active_window != ActiveWindow) {
Window *start_command_window = GetWindow(start_command_active_window);
if (start_command_window->is_title_bar) start_command_window->auto_enclose = false;
}
MergeCarets(active.view);
IF_DEBUG(AssertRanges(active.view->carets));
}

View File

@@ -276,6 +276,10 @@ function OnUpdate(e)
end
function OnCommand(e)
if e.key == KEY_F1 then
local word = GetLoadWord()
C('git grep -n '..word)
end
end
function OnInit()

View File

@@ -119,6 +119,19 @@ int Lua_Error(lua_State *L) {
return 0;
}
int Lua_GetLoadWord(lua_State *L) {
BSet active = GetActiveSet();
Range range = active.view->carets[0].range;
if (GetSize(range) == 0) {
range = EncloseLoadWord(active.buffer, range.min);
}
Scratch scratch;
String string = AllocCharString(scratch, active.buffer, range);
lua_pushlstring(L, string.data, string.len);
return 1;
}
int Lua_Open(lua_State *L) {
Scratch scratch;
String path = luaL_checkstring(L, 1);

View File

@@ -4,6 +4,7 @@ luaL_Reg LuaFunctions[] = {
{"C", Lua_C},
{"Kill", Lua_Kill},
{"Error", Lua_Error},
{"GetLoadWord", Lua_GetLoadWord},
{"Open", Lua_Open},
{"Reopen", Lua_Reopen},
{"Print", Lua_Print},

View File

@@ -1,17 +1,12 @@
- adding items to directory should create files on save - it should ask the user (syntax: dir/ | file)
- ask user if he really wants to quit even though he has an unsaved buffer - popup window
- test the code editor: try writing in it, try browsing in it, create test tooling
- Execute enclosure which is going to execute on every keypress, modification
- Find matches using grep, change things in that buffer then apply those changes to all items
- group history entries so the you can rollback through multiple ones at once and not waste time on skipping whitespace trimming or deleting every character
- ReportWarning should be signaled visibly but you should be able to do things! no focus switching
- fix fucking conversions between strings!!!!!! we need to have stb_sprintf 16
- OnWindowCommand allow config user to overwrite the WindowCommand keybinding, introduce his own
- some split selection commands
- assign commands or lua functions to F1-F8 keys
- A lister which is going to show project without the full path and sorted by recency