Validate buffer name uniqueness constraint, update todo
This commit is contained in:
@@ -61,6 +61,11 @@ inline Buffer *GetBuffer(String name) {
|
|||||||
return Buffers[0].o;
|
return Buffers[0].o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline Buffer *GetBufferStrict(String name) {
|
||||||
|
For(Buffers) if (it.o->name == name) return it.o;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
inline Buffer *BufferNameExists(String name) {
|
inline Buffer *BufferNameExists(String name) {
|
||||||
For(Buffers) if (it.o->name == name) return it.o;
|
For(Buffers) if (it.o->name == name) return it.o;
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -258,24 +263,21 @@ Int ConvertUTF8ToUTF16UnixLine(String string, wchar_t *buffer, Int buffer_cap) {
|
|||||||
// - This is a worry for later time, also we want to handle weird names and so on
|
// - This is a worry for later time, also we want to handle weird names and so on
|
||||||
// 3. If file exists we read it, convert to utf16, tabs to spaces etc.
|
// 3. If file exists we read it, convert to utf16, tabs to spaces etc.
|
||||||
//
|
//
|
||||||
|
// We don't really care about opening buffers that don't have proper paths
|
||||||
Buffer *BufferOpenFile(String path) {
|
Buffer *BufferOpenFile(String path) {
|
||||||
Allocator sys_allocator = GetSystemAllocator();
|
Allocator sys_allocator = GetSystemAllocator();
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
|
|
||||||
|
path = GetAbsolutePath(scratch, path);
|
||||||
Buffer *buffer = GetBuffer(path);
|
Buffer *buffer = GetBuffer(path);
|
||||||
if (!IsNull(buffer)) {
|
if (!IsNull(buffer) || (IsNull(buffer) && buffer->name == path)) {
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
if (IsNull(buffer) && buffer->name == path) {
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FileExists(path)) {
|
if (!FileExists(path)) {
|
||||||
path = GetAbsolutePath(scratch, path);
|
|
||||||
path = Intern(&GlobalInternTable, path);
|
path = Intern(&GlobalInternTable, path);
|
||||||
buffer = CreateBuffer(sys_allocator, path);
|
buffer = CreateBuffer(sys_allocator, path);
|
||||||
} else if (IsDir(path)) {
|
} else if (IsDir(path)) {
|
||||||
path = GetAbsolutePath(scratch, path);
|
|
||||||
path = Intern(&GlobalInternTable, path);
|
path = Intern(&GlobalInternTable, path);
|
||||||
buffer = CreateBuffer(sys_allocator, path, 4096 * 2);
|
buffer = CreateBuffer(sys_allocator, path, 4096 * 2);
|
||||||
buffer->is_directory = true;
|
buffer->is_directory = true;
|
||||||
@@ -284,7 +286,6 @@ Buffer *BufferOpenFile(String path) {
|
|||||||
IKnowWhatImDoing_Appendf(buffer, "%.*s\n", FmtString(it.filename));
|
IKnowWhatImDoing_Appendf(buffer, "%.*s\n", FmtString(it.filename));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
path = GetAbsolutePath(scratch, path);
|
|
||||||
path = Intern(&GlobalInternTable, path);
|
path = Intern(&GlobalInternTable, path);
|
||||||
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);
|
||||||
|
|||||||
@@ -81,7 +81,14 @@ void ApplyTitleBarChangesToWindow(Window *window, View *view, Buffer *buffer) {
|
|||||||
|
|
||||||
String filepath = ToString(scratch, buffer_string);
|
String filepath = ToString(scratch, buffer_string);
|
||||||
if (filepath != last_buffer->name && !BufferNameExists(filepath)) {
|
if (filepath != last_buffer->name && !BufferNameExists(filepath)) {
|
||||||
last_buffer->name = Intern(&GlobalInternTable, filepath);
|
filepath = GetAbsolutePath(scratch, filepath);
|
||||||
|
Buffer *find_buffer = GetBufferStrict(filepath);
|
||||||
|
if (find_buffer) {
|
||||||
|
ReportWarningf("couldn't set name for buffer: %.*s, there is already buffer with that name", FmtString(filepath));
|
||||||
|
} else {
|
||||||
|
String new_name = Intern(&GlobalInternTable, filepath);
|
||||||
|
last_buffer->name = new_name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Int buffer_pos = XYToPos(*last_buffer, {column, line});
|
Int buffer_pos = XYToPos(*last_buffer, {column, line});
|
||||||
|
|||||||
@@ -1,9 +1,20 @@
|
|||||||
- garbage collect the buffers, views - store them in free list on destroy
|
- garbage collect the buffers, views - store them in free list on destroy
|
||||||
- PageUp for some reason stops at 2 line before last line
|
|
||||||
- adding items to directory should create files on save - it should ask the user (syntax: dir/ | file)
|
- adding items to directory should create files on save - it should ask the user (syntax: dir/ | file)
|
||||||
|
- refresh the directory - whem opening up again?
|
||||||
|
- refresh the file content, periodically check file timestamp for changes and update if neccessary
|
||||||
|
- ask user if he really wants to quit even though he has an unsaved buffer - popup window
|
||||||
|
- add plumb rules for some web stuff
|
||||||
|
- test the code editor: try writing in it, try browsing in it, create test tooling
|
||||||
|
- event serialization to lua object format
|
||||||
|
- Execute enclosure which is going to execute on every keypress, modification
|
||||||
|
- Change mouse keybindings again (left+ctrl could be load - left+ctrl could be add new cursor), exec could be middle mouse
|
||||||
|
- Store editor metadata in user accessible buffers? (read only)
|
||||||
|
- Find matches using grep, change things in that buffer then apply those changes to all items
|
||||||
|
- assert buffer name unique when createing and changing name
|
||||||
|
|
||||||
- apply clang format
|
- apply clang format
|
||||||
- apply clang format on save
|
- apply clang format on save
|
||||||
|
- Wait for process and get string
|
||||||
- OnWindowCommand allow config user to overwrite the WindowCommand keybinding, introduce his own
|
- OnWindowCommand allow config user to overwrite the WindowCommand keybinding, introduce his own
|
||||||
|
|
||||||
- ctrl + f - should find Search and select content or add Search
|
- ctrl + f - should find Search and select content or add Search
|
||||||
@@ -30,24 +41,20 @@
|
|||||||
- change size of command window because it's wacky
|
- change size of command window because it's wacky
|
||||||
- combine glyph and selection rendering
|
- combine glyph and selection rendering
|
||||||
|
|
||||||
|
|
||||||
Windows
|
|
||||||
- better teminology then 'active' 'last active' 'current'
|
|
||||||
- switch to previous view (ctrl + tab)
|
- switch to previous view (ctrl + tab)
|
||||||
- shift + ctrl + click should open a new window and then with alt it probably should kill it
|
- shift + ctrl + click should open a new window and then with alt it probably should kill it
|
||||||
- layout using a tree!!
|
|
||||||
- I don't think we need WindowIDs
|
|
||||||
- layouting, resize windows
|
- layouting, resize windows
|
||||||
- try to incorporate the acme square which allows you to put windows wherever and also scale the border
|
- try to incorporate the acme square which allows you to put windows wherever and also scale the border
|
||||||
BUG: there is a click hang when switching windows sometimes, you click after select and it doesn't switch active window
|
BUG: there is a click hang when switching windows sometimes, you click after select and it doesn't switch active window
|
||||||
|
|
||||||
|
- PageUp for some reason stops at 2 line before last line
|
||||||
|
- page up and down should also scroll and leave you in exactly same scroll
|
||||||
|
|
||||||
backlog
|
backlog
|
||||||
- expose a coroutine based scripting enviorment where user can execute shell commands wait for them and perform actions in very linear manner
|
- expose a coroutine based scripting enviorment where user can execute shell commands wait for them and perform actions in very linear manner
|
||||||
- Test stdin writing code
|
- Test stdin writing code
|
||||||
- Implement shell interaction (last line should have a '$'' symbols, if you press enter it should send that line to stdin of a running shell)
|
- Implement shell interaction (last line should have a '$'' symbols, if you press enter it should send that line to stdin of a running shell)
|
||||||
- drop text into window
|
- drop text into window
|
||||||
- page up and down should also scroll and leave you in exactly same scroll
|
|
||||||
- I think the way sublime text and we display line highlights is confusing with multiple cursors (line highlight can be confused with selection)
|
- I think the way sublime text and we display line highlights is confusing with multiple cursors (line highlight can be confused with selection)
|
||||||
- text_editor --record events.txt text_editor --playback events.txt
|
- text_editor --record events.txt text_editor --playback events.txt
|
||||||
- make the editor replayable, store events and then replay, be careful about globals
|
- make the editor replayable, store events and then replay, be careful about globals
|
||||||
@@ -57,4 +64,3 @@ backlog
|
|||||||
- font cache and on demand unicode loads
|
- font cache and on demand unicode loads
|
||||||
- Set scroll centered, what was the use case for this?
|
- Set scroll centered, what was the use case for this?
|
||||||
- color parens, braces
|
- color parens, braces
|
||||||
- auto register commands, but we need to figure out how to properly structure lua stuff
|
|
||||||
Reference in New Issue
Block a user