Don't show special buffers, misc
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
- From a user (novice) point of view, how does it look like?
|
- From a user (novice) point of view, how does it look like?
|
||||||
|
|
||||||
- ctrl + p like in VSCode (without special buffers)
|
- ctrl + p like in VSCode (without special buffers)
|
||||||
|
- Move to the top so that it can be progressively expanded using coroutines by appending at the end
|
||||||
|
- Maybe 2 windows?
|
||||||
- Guide on the first page for new users with links to configs, tutorials
|
- Guide on the first page for new users with links to configs, tutorials
|
||||||
|
|
||||||
- Window, View, Buffer + flags design (or is completely new kind based approach needed for Windows/Views?)
|
- Window, View, Buffer + flags design (or is completely new kind based approach needed for Windows/Views?)
|
||||||
|
|||||||
@@ -647,36 +647,13 @@ void Command_SetWorkDir() {
|
|||||||
|
|
||||||
String CodeEndings[] = { ".c", ".cpp", ".h", ".hpp", ".py", ".lua", ".cxx", ".hxx", };
|
String CodeEndings[] = { ".c", ".cpp", ".h", ".hpp", ".py", ".lua", ".cxx", ".hxx", };
|
||||||
|
|
||||||
void ListFilesRecursive(Buffer *buffer, String dir) {
|
|
||||||
Scratch scratch(buffer->line_starts.allocator);
|
|
||||||
for (FileIter it = IterateFiles(scratch, dir); IsValid(it); Advance(&it)) {
|
|
||||||
if (it.filename == ".git") {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (it.is_directory) {
|
|
||||||
ListFilesRecursive(buffer, it.absolute_path);
|
|
||||||
} else {
|
|
||||||
bool match = false;
|
|
||||||
ForItem (ending, CodeEndings) {
|
|
||||||
if (EndsWith(it.absolute_path, ending)) {
|
|
||||||
match = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (match) RawAppendf(buffer, "%-80S || %S\n", it.filename, it.absolute_path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OpenCodeRecursive(String dir) {
|
void OpenCodeRecursive(String dir) {
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
for (FileIter it = IterateFiles(scratch, dir); IsValid(it); Advance(&it)) {
|
for (FileIter it = IterateFiles(scratch, dir); IsValid(it); Advance(&it)) {
|
||||||
if (it.filename == ".git") {
|
if (it.filename == ".git") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (it.filename == "SDL") {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (it.is_directory) {
|
if (it.is_directory) {
|
||||||
OpenCodeRecursive(it.absolute_path);
|
OpenCodeRecursive(it.absolute_path);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -396,11 +396,12 @@ void EndProfileScope() {
|
|||||||
(uint64_t)GetTimeMicros() // timestamp in microseconds -- end of your timing block
|
(uint64_t)GetTimeMicros() // timestamp in microseconds -- end of your timing block
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
#define ProfileScope(name) ProfileScope_ PROFILE_SCOPE_VAR_##name(#name, sizeof(#name) - 1)
|
#define ProfileScopeD(name) ProfileScopeEx PROFILE_SCOPE_VAR_##name((name).data, (name).len)
|
||||||
#define ProfileFunction() ProfileScope_ PROFILE_SCOPE_FUNCTION(__FUNCTION__, sizeof(__FUNCTION__) - 1)
|
#define ProfileScope(name) ProfileScopeEx PROFILE_SCOPE_VAR_##name(#name, sizeof(#name) - 1)
|
||||||
struct ProfileScope_ {
|
#define ProfileFunction() ProfileScopeEx PROFILE_SCOPE_FUNCTION(__FUNCTION__, sizeof(__FUNCTION__) - 1)
|
||||||
ProfileScope_(const char *name, int len) { _BeginProfileScope(name, len); }
|
struct ProfileScopeEx {
|
||||||
~ProfileScope_() { EndProfileScope(); }
|
ProfileScopeEx(const char *name, int len) { _BeginProfileScope(name, len); }
|
||||||
|
~ProfileScopeEx() { EndProfileScope(); }
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
#define ProfileScope(name)
|
#define ProfileScope(name)
|
||||||
|
|||||||
@@ -392,9 +392,8 @@ void OnCommand(Event event) {
|
|||||||
|
|
||||||
For (CommandFunctions) {
|
For (CommandFunctions) {
|
||||||
if (it.trigger && MatchEvent(it.trigger, &event)) {
|
if (it.trigger && MatchEvent(it.trigger, &event)) {
|
||||||
double start = GetTimeSeconds();
|
ProfileScopeEx(it.name.data, (int)it.name.len);
|
||||||
it.function();
|
it.function();
|
||||||
ReportConsolef("%S: %f", it.name, GetTimeSeconds() - start);
|
|
||||||
LastExecutedCommand = it.function;
|
LastExecutedCommand = it.function;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,7 +133,6 @@ struct FunctionData { String name; Function *function; };
|
|||||||
struct CommandData { String name; String binding; Function *function; struct Trigger *trigger; };
|
struct CommandData { String name; String binding; Function *function; struct Trigger *trigger; };
|
||||||
struct PFunctionData { String name; PFunction *function; };
|
struct PFunctionData { String name; PFunction *function; };
|
||||||
|
|
||||||
|
|
||||||
struct Register_Function {
|
struct Register_Function {
|
||||||
Register_Function(Array<FunctionData> *functions, String name, Function *f) {
|
Register_Function(Array<FunctionData> *functions, String name, Function *f) {
|
||||||
int64_t pos = 0;
|
int64_t pos = 0;
|
||||||
|
|||||||
@@ -75,6 +75,24 @@ void Command_ShowCommands() {
|
|||||||
SelectRange(command_bar.view, GetBufferEndAsRange(command_bar.buffer));
|
SelectRange(command_bar.view, GetBufferEndAsRange(command_bar.buffer));
|
||||||
} RegisterCommand(Command_ShowCommands, "ctrl-shift-p");
|
} RegisterCommand(Command_ShowCommands, "ctrl-shift-p");
|
||||||
|
|
||||||
|
void Command_ShowDebugBufferList() {
|
||||||
|
if (ActiveWindowID == CommandBarWindowID && LastExecutedCommand == Command_ShowDebugBufferList) {
|
||||||
|
ActiveWindowID = LastActiveLayoutWindowID;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BSet command_bar = GetBSet(CommandBarWindowID);
|
||||||
|
command_bar.window->visible = true;
|
||||||
|
command_bar.window->eval_command = false;
|
||||||
|
ActiveWindowID = command_bar.window->id;
|
||||||
|
ResetBuffer(command_bar.buffer);
|
||||||
|
For(Buffers) {
|
||||||
|
RawAppendf(command_bar.buffer, "%-80S || %S\n", SkipToLastSlash(it->name), it->name);
|
||||||
|
}
|
||||||
|
command_bar.view->update_scroll = true;
|
||||||
|
SelectRange(command_bar.view, GetBufferEndAsRange(command_bar.buffer));
|
||||||
|
} RegisterCommand(Command_ShowDebugBufferList, "");
|
||||||
|
|
||||||
void Command_ShowBufferList() {
|
void Command_ShowBufferList() {
|
||||||
if (ActiveWindowID == CommandBarWindowID && LastExecutedCommand == Command_ShowBufferList) {
|
if (ActiveWindowID == CommandBarWindowID && LastExecutedCommand == Command_ShowBufferList) {
|
||||||
ActiveWindowID = LastActiveLayoutWindowID;
|
ActiveWindowID = LastActiveLayoutWindowID;
|
||||||
@@ -87,6 +105,9 @@ void Command_ShowBufferList() {
|
|||||||
ActiveWindowID = command_bar.window->id;
|
ActiveWindowID = command_bar.window->id;
|
||||||
ResetBuffer(command_bar.buffer);
|
ResetBuffer(command_bar.buffer);
|
||||||
For(Buffers) {
|
For(Buffers) {
|
||||||
|
if (it->special) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
RawAppendf(command_bar.buffer, "%-80S || %S\n", SkipToLastSlash(it->name), it->name);
|
RawAppendf(command_bar.buffer, "%-80S || %S\n", SkipToLastSlash(it->name), it->name);
|
||||||
}
|
}
|
||||||
command_bar.view->update_scroll = true;
|
command_bar.view->update_scroll = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user