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;
|
||||
}
|
||||
|
||||
inline Buffer *GetBufferStrict(String name) {
|
||||
For(Buffers) if (it.o->name == name) return it.o;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline Buffer *BufferNameExists(String name) {
|
||||
For(Buffers) if (it.o->name == name) return it.o;
|
||||
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
|
||||
// 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) {
|
||||
Allocator sys_allocator = GetSystemAllocator();
|
||||
Scratch scratch;
|
||||
|
||||
path = GetAbsolutePath(scratch, path);
|
||||
Buffer *buffer = GetBuffer(path);
|
||||
if (!IsNull(buffer)) {
|
||||
return buffer;
|
||||
}
|
||||
if (IsNull(buffer) && buffer->name == path) {
|
||||
if (!IsNull(buffer) || (IsNull(buffer) && buffer->name == path)) {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
if (!FileExists(path)) {
|
||||
path = GetAbsolutePath(scratch, path);
|
||||
path = Intern(&GlobalInternTable, path);
|
||||
buffer = CreateBuffer(sys_allocator, path);
|
||||
} else if (IsDir(path)) {
|
||||
path = GetAbsolutePath(scratch, path);
|
||||
path = Intern(&GlobalInternTable, path);
|
||||
buffer = CreateBuffer(sys_allocator, path, 4096 * 2);
|
||||
buffer->is_directory = true;
|
||||
@@ -284,7 +286,6 @@ Buffer *BufferOpenFile(String path) {
|
||||
IKnowWhatImDoing_Appendf(buffer, "%.*s\n", FmtString(it.filename));
|
||||
}
|
||||
} else {
|
||||
path = GetAbsolutePath(scratch, path);
|
||||
path = Intern(&GlobalInternTable, path);
|
||||
String string = ReadFile(scratch, path);
|
||||
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);
|
||||
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});
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
- 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)
|
||||
- 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 on save
|
||||
- Wait for process and get string
|
||||
- OnWindowCommand allow config user to overwrite the WindowCommand keybinding, introduce his own
|
||||
|
||||
- ctrl + f - should find Search and select content or add Search
|
||||
@@ -30,24 +41,20 @@
|
||||
- change size of command window because it's wacky
|
||||
- combine glyph and selection rendering
|
||||
|
||||
|
||||
Windows
|
||||
- better teminology then 'active' 'last active' 'current'
|
||||
- switch to previous view (ctrl + tab)
|
||||
- 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
|
||||
- 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
|
||||
|
||||
- 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
|
||||
- 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
|
||||
- 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
|
||||
- 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)
|
||||
- text_editor --record events.txt text_editor --playback events.txt
|
||||
- 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
|
||||
- Set scroll centered, what was the use case for this?
|
||||
- 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