Add todos
This commit is contained in:
@@ -131,7 +131,6 @@ Cursor ChangeFront(Cursor cursor, int64_t front) {
|
|||||||
void AddEdit(Array<Edit> *edits, Range range, String string) {
|
void AddEdit(Array<Edit> *edits, Range range, String string) {
|
||||||
edits->add({range, string});
|
edits->add({range, string});
|
||||||
}
|
}
|
||||||
// SortKey = range.min
|
|
||||||
|
|
||||||
bool InBounds(const Buffer &buffer, int64_t pos) {
|
bool InBounds(const Buffer &buffer, int64_t pos) {
|
||||||
bool result = pos >= 0 && pos < buffer.len;
|
bool result = pos >= 0 && pos < buffer.len;
|
||||||
|
|||||||
@@ -191,6 +191,8 @@ int main() {
|
|||||||
windows.add(window);
|
windows.add(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @todo: multiple ui elements, add focus
|
||||||
|
// @todo: immediate mode interface for all this
|
||||||
Vec2 camera_offset_world_to_render_units = {};
|
Vec2 camera_offset_world_to_render_units = {};
|
||||||
while (!WindowShouldClose()) {
|
while (!WindowShouldClose()) {
|
||||||
For(windows) {
|
For(windows) {
|
||||||
@@ -211,6 +213,7 @@ int main() {
|
|||||||
focused_window->scroll.y -= mouse_wheel;
|
focused_window->scroll.y -= mouse_wheel;
|
||||||
focused_window->scroll.y = ClampBottom(focused_window->scroll.y, 0.f);
|
focused_window->scroll.y = ClampBottom(focused_window->scroll.y, 0.f);
|
||||||
|
|
||||||
|
BeforeEdit(focused_window); // Merge cursors
|
||||||
if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_A)) {
|
if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_A)) {
|
||||||
focused_window->cursors.clear();
|
focused_window->cursors.clear();
|
||||||
focused_window->cursors.add(MakeCursor(0, focused_window->buffer.len));
|
focused_window->cursors.add(MakeCursor(0, focused_window->buffer.len));
|
||||||
@@ -332,8 +335,8 @@ int main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BeforeEdit(focused_window);
|
|
||||||
|
|
||||||
|
// @todo: improve behaviour of all copy pasting
|
||||||
if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_C)) {
|
if (IsKeyDown(KEY_LEFT_CONTROL) && IsKeyPressed(KEY_C)) {
|
||||||
Array<String> strings = {FrameArena};
|
Array<String> strings = {FrameArena};
|
||||||
For(focused_window->cursors) {
|
For(focused_window->cursors) {
|
||||||
@@ -354,7 +357,6 @@ int main() {
|
|||||||
ApplyEdits(&focused_window->buffer, edits);
|
ApplyEdits(&focused_window->buffer, edits);
|
||||||
AfterEdit(focused_window, edits);
|
AfterEdit(focused_window, edits);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsKeyDown(KEY_LEFT_CONTROL) && (IsKeyPressed(KEY_X) || IsKeyPressedRepeat(KEY_X))) {
|
if (IsKeyDown(KEY_LEFT_CONTROL) && (IsKeyPressed(KEY_X) || IsKeyPressedRepeat(KEY_X))) {
|
||||||
// First, if there is no selection - select the entire line
|
// First, if there is no selection - select the entire line
|
||||||
For(focused_window->cursors) {
|
For(focused_window->cursors) {
|
||||||
@@ -396,7 +398,9 @@ int main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo: scrolling
|
if (IsKeyDown(KEY_LEFT_CONTROL) && (IsKeyPressed(KEY_D) || IsKeyPressedRepeat(KEY_D))) {
|
||||||
|
}
|
||||||
|
|
||||||
if (IsKeyPressed(KEY_DELETE) || IsKeyPressedRepeat(KEY_DELETE)) {
|
if (IsKeyPressed(KEY_DELETE) || IsKeyPressedRepeat(KEY_DELETE)) {
|
||||||
if (IsKeyDown(KEY_LEFT_SHIFT)) {
|
if (IsKeyDown(KEY_LEFT_SHIFT)) {
|
||||||
}
|
}
|
||||||
@@ -558,7 +562,6 @@ int main() {
|
|||||||
Assert(rows.len);
|
Assert(rows.len);
|
||||||
|
|
||||||
// @todo: x axis
|
// @todo: x axis
|
||||||
// @tood: moving using mouse
|
|
||||||
// Update the scroll based on first cursor
|
// Update the scroll based on first cursor
|
||||||
if (!AreEqual(window.main_cursor_begin_frame, window.cursors[0])) {
|
if (!AreEqual(window.main_cursor_begin_frame, window.cursors[0])) {
|
||||||
Vec2 rect_in_render_units = GetSize(window_text_rect_in_render_units_clamped_to_screen);
|
Vec2 rect_in_render_units = GetSize(window_text_rect_in_render_units_clamped_to_screen);
|
||||||
@@ -591,7 +594,9 @@ int main() {
|
|||||||
|
|
||||||
// Mouse in text area
|
// Mouse in text area
|
||||||
{
|
{
|
||||||
// @todo: test for focus
|
// @todo: click twice to select word
|
||||||
|
// @tood: scrolling when selecting (Y and X)
|
||||||
|
// @todo: change cursors
|
||||||
Vec2 mouse_in_render_units = GetMousePosition();
|
Vec2 mouse_in_render_units = GetMousePosition();
|
||||||
if (CheckCollisionPointRec(mouse_in_render_units, ToRectangle(window_text_rect_in_render_units_clamped_to_screen))) {
|
if (CheckCollisionPointRec(mouse_in_render_units, ToRectangle(window_text_rect_in_render_units_clamped_to_screen))) {
|
||||||
ForItem(row, rows) {
|
ForItem(row, rows) {
|
||||||
|
|||||||
Reference in New Issue
Block a user