This commit is contained in:
Krzosa Karol
2024-08-04 14:22:42 +02:00
parent d59a8d9c8b
commit 7e35e0cbed
4 changed files with 12 additions and 16 deletions

View File

@@ -449,11 +449,13 @@ Range EncloseScope(Buffer *buffer, Int pos, wchar_t open, wchar_t close) {
for (Int i = pos; i >= 0; i -= 1) {
if (buffer->str[i] == open) {
result.min = i;
break;
}
}
for (Int i = pos; i < buffer->len; i += 1) {
if (buffer->str[i] == close) {
result.max = i + 1;
break;
}
}
return result;

View File

@@ -658,7 +658,7 @@ void WindowCommand(Event event, Window *window, View *view) {
search = true;
}
if (Ctrl(SDLK_W)) {
if (Ctrl(SDLK_T)) {
Int pos = view->carets[0].range.min;
Range range = EncloseScope(buffer, pos, L'{', L'}');
view->carets[0] = MakeCaret(range.max, range.min);
@@ -833,6 +833,8 @@ void WindowCommand(Event event, Window *window, View *view) {
Vec2I mouse = MouseVec2I();
Int p = ScreenSpaceToBufferPos(window, view, buffer, mouse);
Insert(&view->carets, MakeCaret(p, p), 0);
// @todo: hold - create a rectangle selection with multiple cursors on each line
}
}

View File

@@ -42,6 +42,7 @@ void ReplaceDebugData() {
float xmouse, ymouse;
SDL_GetMouseState(&xmouse, &ymouse);
Appendf(buffer, "mouse: [%f, %f]\n", xmouse, ymouse);
Appendf(buffer, "window count: %d view count: %d buffer count: %d\n", (int)Windows.len, (int)Views.len, (int)Buffers.len);
Appendf(buffer, "C:/Work/text_editor/src/text_editor/text_editor.cpp\n");
// String view_list = DebugViewList(scratch);

View File

@@ -1,19 +1,10 @@
- bugs:
- 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)
- 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)
- mouse needs a rewrite
- hand cursor on hover over underlined word
- maybe we don't need multiple cursors on mouse???
- ctrl + left mouse to load / ctrl + right mouse to go back
- alt + left to exec / alt + right to toggle console or something related
- similar mirroring on keyboard with W/Q Ctrl/Alt
- mid click to create new cursor?
- bug: Latin-1 is matched as column for some reason in ApplyRules!!
- mid click - create new cursor
- mid click hold - create a rectangle selection with multiple cursors on each line
- delete multiple spaces (based on indent size) on delete instead one by one. It should only work at beginning of line, in indent area
- select space between parens,braces but make it good
- switch to previous view (ctrl + tab)
- we could rewrite kill lines with simpler commands - extend selection to encompass lines->replace
- should be able click on title bar of windows which disappear on losing focus
@@ -21,7 +12,6 @@
- experiment with using multiple cursors to select command and it's input
- search as a command to execute which is going to be in the title bar
- Ctrl + G should select the line number in bar
- auto register commands, but we need to figure out how to properly structure lua stuff
- console window should close on esacpe but make it more coherent
- make the editor replayable, store events and then replay, be careful about globals
- I want a way to assign flags to buffers/views/windows from user perspective so that console window concept can be created from user space
@@ -34,8 +24,9 @@
- Search and replace
- Search result buffer
- yeet sheet
- select space between parens,braces
- color parens, braces
- auto register commands, but we need to figure out how to properly structure lua stuff
- double click - start enclosing word, triple click - start enclosing lines, merge 2 cursor selection - start treating it as anchor