ListCode with ||
This commit is contained in:
@@ -1055,21 +1055,26 @@ void ListFilesRecursive(Buffer *buffer, String dir) {
|
|||||||
if (!good) {
|
if (!good) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
RawAppendf(buffer, "%-100.*s %.*s\n", FmtString(it.absolute_path), FmtString(it.filename));
|
RawAppendf(buffer, "%-80.*s || %.*s\n", FmtString(it.filename), FmtString(it.absolute_path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Command_ListCode(void) {
|
void Command_ListCode(String dir = WorkDir) {
|
||||||
BSet main = GetActiveMainSet();
|
BSet main = GetActiveMainSet();
|
||||||
JumpGarbageBuffer(&main);
|
JumpGarbageBuffer(&main);
|
||||||
ListFilesRecursive(main.buffer, WorkDir);
|
ListFilesRecursive(main.buffer, dir);
|
||||||
main.view->fuzzy_search = true;
|
main.view->fuzzy_search = true;
|
||||||
Command_SelectRangeOneCursor(main.view, GetEndAsRange(main.buffer));
|
Command_SelectRangeOneCursor(main.view, GetEndAsRange(main.buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
int Lua_ListCode(lua_State *L) {
|
int Lua_ListCode(lua_State *L) {
|
||||||
Command_ListCode();
|
String string = lua_tostring(L, 1);
|
||||||
|
lua_pop(L, 1);
|
||||||
|
if (string.len == 0) {
|
||||||
|
string = WorkDir;
|
||||||
|
}
|
||||||
|
Command_ListCode(string);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -615,10 +615,30 @@ void OnCommand(Event event) {
|
|||||||
if (CtrlShiftPress(SDLK_Q)) {
|
if (CtrlShiftPress(SDLK_Q)) {
|
||||||
Command_Open(FetchLoadWord(), "exec");
|
Command_Open(FetchLoadWord(), "exec");
|
||||||
} else if (CtrlPress(SDLK_Q)) {
|
} else if (CtrlPress(SDLK_Q)) {
|
||||||
Command_Open(FetchLoadWord());
|
|
||||||
if (active.view->fuzzy_search) {
|
if (active.view->fuzzy_search) {
|
||||||
Range rng = GetLineRangeWithoutNL(active.buffer, active.buffer->line_starts.len - 1);
|
bool success = false;
|
||||||
GetLast(active.window->goto_history)->caret = MakeCaret(rng.max, rng.min);
|
Range range = active.view->carets[0].range;
|
||||||
|
if (GetSize(range) == 0) {
|
||||||
|
Int line = PosToLine(active.buffer, range.min);
|
||||||
|
String16 string = GetLineStringWithoutNL(active.buffer, line);
|
||||||
|
Int idx = 0;
|
||||||
|
if (Seek(string, u"||", &idx)) {
|
||||||
|
string = Skip(string, idx + 3);
|
||||||
|
Command_Open(string);
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!success) {
|
||||||
|
Command_Open(FetchLoadWord());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Range rng = GetLineRangeWithoutNL(active.buffer, active.buffer->line_starts.len - 1);
|
||||||
|
GetLast(active.window->goto_history)->caret = MakeCaret(rng.max, rng.min);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Command_Open(FetchLoadWord());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user