Fix Ctrl Period to navigate folders

This commit is contained in:
2025-08-11 15:53:11 +02:00
parent b6ef63e817
commit 77b337aed8
4 changed files with 13 additions and 7 deletions

View File

@@ -1110,7 +1110,7 @@ BSet Command_Open(Window *window, String path, String meta, bool set_active = tr
ActiveWindow = set.window->id;
}
if (IsDir(ores.file_path)) {
JumpGarbageBuffer(&set, GetUniqueBufferName(ores.file_path, "dir"));
JumpGarbageBuffer(&set, GetUniqueBufferName(ores.file_path, "temp", ".dirlisting"));
Command_Appendf(set.view, "..\n", FmtString(ores.file_path));
for (FileIter it = IterateFiles(scratch, ores.file_path); IsValid(it); Advance(&it)) {
Command_Appendf(set.view, "%.*s\n", FmtString(it.filename));

View File

@@ -590,7 +590,11 @@ void OnCommand(Event event) {
}
if (CtrlPress(SDLK_PERIOD)) {
Command_Open(ChopLastSlash(main.buffer->name));
String name = ChopLastSlash(main.buffer->name);
if (EndsWith(main.buffer->name, "dirlisting")) {
name = ChopLastSlash(name);
}
Command_Open(name);
}
if (CtrlPress(SDLK_T)) {
@@ -611,9 +615,10 @@ void OnCommand(Event event) {
}
if (CtrlShiftPress(SDLK_Q)) {
if (AltPress(SDLK_L)) {
Command_Open(FetchLoadWord(), "exec");
} else if (CtrlPress(SDLK_Q)) {
}
if (CtrlPress(SDLK_Q)) {
if (active.view->fuzzy_search) {
bool success = false;
Range range = active.view->carets[0].range;

View File

@@ -66,7 +66,8 @@ Style.DrawScrollbar = 1
Style.IndentSize = 4
Style.FontSize = 15
Style.FontFilter = 0
Style.Font = GetExeDir().."CascadiaMono.ttf"
Style.Font = GetExeDir().."/CascadiaMono.ttf"
Print("Style.Font", Style.Font)
Style.VCVarsall = "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat"
Style.TrimWhitespaceOnSave = true
Style.ClangFormatOnSave = false

View File

@@ -51,11 +51,11 @@ String16 SavedClipboardString;
Array<String16> SavedClipboardCarets;
String GetUniqueBufferName(String working_dir, String prepend_name) {
String GetUniqueBufferName(String working_dir, String prepend_name, String extension = ".log") {
Scratch scratch;
String buffer_name = {};
for (int i = 1; i < INT_MAX; i += 1) {
buffer_name = Format(scratch, "%.*s/%.*s%d.log", FmtString(working_dir), FmtString(prepend_name), i);
buffer_name = Format(scratch, "%.*s/%.*s%d%.*s", FmtString(working_dir), FmtString(prepend_name), i, FmtString(extension));
buffer_name = GetAbsolutePath(scratch, buffer_name);
Buffer *exists = FindBuffer(buffer_name);
if (!exists && !FileExists(buffer_name)) {