Buffer directories design change
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
- What precise workflow do I need for me to be viable to use this?
|
- What precise workflow do I need for me to be viable to use this?
|
||||||
- From a user (novice) point of view, how does it look like?
|
- From a user (novice) point of view, how does it look like?
|
||||||
|
|
||||||
|
|
||||||
- build console window
|
- build console window
|
||||||
- Use WorkDir (raname to Workspace?) to shorten file names
|
|
||||||
- Show what process/coroutines are running and allow to kill (active process buffer?)
|
- Show what process/coroutines are running and allow to kill (active process buffer?)
|
||||||
- Database idea: use special buffers to store information
|
- Database idea: use special buffers to store information
|
||||||
- Editing the buffer doesn't seem to be the slow part rather, accessing the data and putting it into the buffer (potentially hitting many different memory locations) I have a crazy idea to use buffers in order to store the names in a serialized format
|
- Editing the buffer doesn't seem to be the slow part rather, accessing the data and putting it into the buffer (potentially hitting many different memory locations) I have a crazy idea to use buffers in order to store the names in a serialized format
|
||||||
@@ -19,10 +19,11 @@ Commands TODO:
|
|||||||
|
|
||||||
- CONSIDER AUTOMATING: CheckpointBeforeGoto
|
- CONSIDER AUTOMATING: CheckpointBeforeGoto
|
||||||
- GotoBackward how to handle that in case we want to automate and create on every move?
|
- GotoBackward how to handle that in case we want to automate and create on every move?
|
||||||
|
- Add jump checkpoints
|
||||||
|
- Make sure the timing window works forward and backward in undo and jump
|
||||||
|
|
||||||
|
|
||||||
backlog
|
backlog
|
||||||
ISSUE Ctrl+Alt+Down (DuplicateLine) doesn't work on ubuntu
|
|
||||||
FEATURE Search whole words, case sensitive etc.
|
FEATURE Search whole words, case sensitive etc.
|
||||||
FEATURE Select all searched occurences
|
FEATURE Select all searched occurences
|
||||||
FEATURE commands for scrolling: center, cursor_at_bottom_of_screen, cursor_at_top
|
FEATURE commands for scrolling: center, cursor_at_bottom_of_screen, cursor_at_top
|
||||||
|
|||||||
@@ -1505,8 +1505,8 @@ Buffer *BufferOpenFile(String path) {
|
|||||||
if (!FileExists(path)) {
|
if (!FileExists(path)) {
|
||||||
buffer = CreateBuffer(sys_allocator, path);
|
buffer = CreateBuffer(sys_allocator, path);
|
||||||
} else if (IsDir(path)) {
|
} else if (IsDir(path)) {
|
||||||
ReportWarningf("failed to open, it's a directory: %S", path);
|
buffer = CreateBuffer(sys_allocator, path);
|
||||||
return GetBuffer(NullBufferID);
|
buffer->is_dir = true;
|
||||||
} else {
|
} else {
|
||||||
String string = ReadFile(scratch, path);
|
String string = ReadFile(scratch, path);
|
||||||
buffer = CreateBuffer(sys_allocator, path, string.len * 4 + 4096);
|
buffer = CreateBuffer(sys_allocator, path, string.len * 4 + 4096);
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ struct Buffer {
|
|||||||
unsigned dont_try_to_save_in_bulk_ops : 1;
|
unsigned dont_try_to_save_in_bulk_ops : 1;
|
||||||
unsigned close : 1;
|
unsigned close : 1;
|
||||||
unsigned special : 1;
|
unsigned special : 1;
|
||||||
|
unsigned is_dir : 1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -19,20 +19,17 @@ BSet GetConsoleSet() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
String GetCurrentFilename() {
|
|
||||||
BSet main = GetBSet(LastActiveLayoutWindowID);
|
|
||||||
return main.buffer->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
String GetDir(Buffer *buffer) {
|
String GetDir(Buffer *buffer) {
|
||||||
String name = ChopLastSlash(buffer->name);
|
if (buffer->is_dir) {
|
||||||
return name;
|
return buffer->name;
|
||||||
|
} else {
|
||||||
|
return ChopLastSlash(buffer->name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String GetMainDir() {
|
String GetMainDir() {
|
||||||
BSet main = GetBSet(LastActiveLayoutWindowID);
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
||||||
String name = ChopLastSlash(main.buffer->name);
|
return GetDir(main.buffer);
|
||||||
return name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JumpGarbageBuffer(BSet *set, String buffer_name = "") {
|
void JumpGarbageBuffer(BSet *set, String buffer_name = "") {
|
||||||
@@ -618,10 +615,13 @@ BSet Open(Window *window, String path, String meta, bool set_active = true) {
|
|||||||
ActiveWindowID = set.window->id;
|
ActiveWindowID = set.window->id;
|
||||||
}
|
}
|
||||||
if (IsDir(o.path)) {
|
if (IsDir(o.path)) {
|
||||||
JumpGarbageBuffer(&set, GetUniqueBufferName(o.path, "temp", ".dirlisting"));
|
CheckpointBeforeGoto(set.window);
|
||||||
Appendf(set.view, "..\n");
|
View *view = WindowOpenBufferView(set.window, o.path);
|
||||||
|
Buffer *buffer = GetBuffer(view->active_buffer);
|
||||||
|
ResetBuffer(buffer);
|
||||||
|
RawAppendf(buffer, "..\n");
|
||||||
for (FileIter it = IterateFiles(scratch, o.path); IsValid(it); Advance(&it)) {
|
for (FileIter it = IterateFiles(scratch, o.path); IsValid(it); Advance(&it)) {
|
||||||
Appendf(set.view, "%S\n", it.filename);
|
RawAppendf(buffer, "%S\n", it.filename);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CheckpointBeforeGoto(set.window);
|
CheckpointBeforeGoto(set.window);
|
||||||
@@ -857,9 +857,6 @@ void Command_GotoForward() {
|
|||||||
void Command_OpenUpFolder() {
|
void Command_OpenUpFolder() {
|
||||||
BSet main = GetBSet(LastActiveLayoutWindowID);
|
BSet main = GetBSet(LastActiveLayoutWindowID);
|
||||||
String name = ChopLastSlash(main.buffer->name);
|
String name = ChopLastSlash(main.buffer->name);
|
||||||
if (EndsWith(main.buffer->name, "dirlisting")) {
|
|
||||||
name = ChopLastSlash(name);
|
|
||||||
}
|
|
||||||
Open(name);
|
Open(name);
|
||||||
} RegisterCommand(Command_OpenUpFolder, "ctrl-period");
|
} RegisterCommand(Command_OpenUpFolder, "ctrl-period");
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,6 @@
|
|||||||
#include "draw.cpp"
|
#include "draw.cpp"
|
||||||
#include "test/tests.cpp"
|
#include "test/tests.cpp"
|
||||||
|
|
||||||
|
|
||||||
#if OS_WASM
|
#if OS_WASM
|
||||||
EM_JS(void, JS_SetMouseCursor, (const char *cursor_str), {
|
EM_JS(void, JS_SetMouseCursor, (const char *cursor_str), {
|
||||||
document.getElementById("canvas").style.cursor = UTF8ToString(cursor_str);
|
document.getElementById("canvas").style.cursor = UTF8ToString(cursor_str);
|
||||||
|
|||||||
Reference in New Issue
Block a user