Add debug references to ids
This commit is contained in:
@@ -29,9 +29,9 @@ Window *ScrollbarSelected = NULL;
|
||||
Window *DocumentSelected = NULL;
|
||||
Range DocumentRangeAnchor;
|
||||
|
||||
inline ViewID AllocViewID() { return {ViewIDs.id++}; }
|
||||
inline WindowID AllocWindowID() { return {WindowIDs.id++}; }
|
||||
inline BufferID AllocBufferID() { return {BufferIDs.id++}; }
|
||||
inline ViewID AllocViewID(View *view) { return {ViewIDs.id++, view}; }
|
||||
inline WindowID AllocWindowID(Window *window) { return {WindowIDs.id++, window}; }
|
||||
inline BufferID AllocBufferID(Buffer *buffer) { return {BufferIDs.id++, buffer}; }
|
||||
|
||||
inline Window *GetWindow(WindowID id) {
|
||||
For(Windows) if (it.id.id == id.id) return ⁢
|
||||
@@ -65,7 +65,7 @@ inline Window *GetActiveWindow() { return GetWindow(ActiveWindow); }
|
||||
inline View *GetActiveView(Window *window) { return GetView(window->active_view); }
|
||||
|
||||
void InitBuffer(Allocator allocator, Buffer *buffer, String name, Int size = 4096) {
|
||||
buffer->id = AllocBufferID();
|
||||
buffer->id = AllocBufferID(buffer);
|
||||
buffer->name = name;
|
||||
buffer->cap = size;
|
||||
buffer->data = AllocArray(allocator, U16, buffer->cap);
|
||||
@@ -97,13 +97,13 @@ Window *CreateWindow() {
|
||||
w->visible = true;
|
||||
w->draw_scrollbar = StyleDrawScrollbar;
|
||||
w->draw_line_numbers = StyleDrawLineNumbers;
|
||||
w->id = AllocWindowID();
|
||||
w->id = AllocWindowID(w);
|
||||
return w;
|
||||
}
|
||||
|
||||
View *CreateView(BufferID active_buffer) {
|
||||
View *w = Alloc(&Views);
|
||||
w->id = AllocViewID();
|
||||
w->id = AllocViewID(w);
|
||||
w->active_buffer = active_buffer;
|
||||
Add(&w->carets, {0, 0});
|
||||
return w;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// clang-format off
|
||||
struct BufferID { Int id; };
|
||||
struct ViewID { Int id; };
|
||||
struct WindowID { Int id; };
|
||||
struct Buffer; struct Window; struct View;
|
||||
struct BufferID { Int id; Buffer *d; };
|
||||
struct ViewID { Int id; View *d; };
|
||||
struct WindowID { Int id; Window *d; }; // @warning refs are for debug !!!
|
||||
|
||||
union Range { struct { Int min; Int max; }; Int e[2]; };
|
||||
struct Caret { union { Range range; Int pos[2]; }; Int ifront;};
|
||||
@@ -112,18 +113,17 @@ String ExeDir;
|
||||
Arena Perm;
|
||||
float DPIScale = 1.0f;
|
||||
|
||||
String16 EvalString(Allocator allocator, String16 string16);
|
||||
Rect2I GetVisibleCells(Window *window);
|
||||
void AfterEdit(View *view, Array<Edit> edits);
|
||||
Scroller ComputeScrollerRect(Window *window);
|
||||
void Command_EvalLua(View *view, String16 string);
|
||||
void MergeCarets(View *view, Range *mouse_selection_anchor = NULL);
|
||||
inline BufferID AllocBufferID();
|
||||
void Command_SelectEntireBuffer(View *view);
|
||||
void Command_Replace(View *view, String16 string);
|
||||
void Open(String path);
|
||||
void Open(String16 path);
|
||||
void UpdateScroll(Window *window, bool update_caret_scrolling);
|
||||
String16 EvalString(Allocator allocator, String16 string16);
|
||||
Rect2I GetVisibleCells(Window *window);
|
||||
void AfterEdit(View *view, Array<Edit> edits);
|
||||
Scroller ComputeScrollerRect(Window *window);
|
||||
void Command_EvalLua(View *view, String16 string);
|
||||
void MergeCarets(View *view, Range *mouse_selection_anchor = NULL);
|
||||
void Command_SelectEntireBuffer(View *view);
|
||||
void Command_Replace(View *view, String16 string);
|
||||
void Open(String path);
|
||||
void Open(String16 path);
|
||||
void UpdateScroll(Window *window, bool update_caret_scrolling);
|
||||
|
||||
void ReportErrorf(const char *fmt, ...);
|
||||
void ReportWarningf(const char *fmt, ...);
|
||||
Reference in New Issue
Block a user