Misc
This commit is contained in:
@@ -117,6 +117,13 @@ Rect2 Rect2FromSize(Vec2 pos, Vec2 size) {
|
||||
return result;
|
||||
}
|
||||
|
||||
Rect2 Rect2MidHalf(Vec2 mid, Vec2 half_size) {
|
||||
Rect2 result = {};
|
||||
result.min = mid - half_size;
|
||||
result.max = mid + half_size;
|
||||
return result;
|
||||
}
|
||||
|
||||
Rect2 Shrink(Rect2 result, float v) {
|
||||
result.min.x += v;
|
||||
result.max.x -= v;
|
||||
|
||||
@@ -37,6 +37,16 @@ bool IsLoadWord(wchar_t w) {
|
||||
return result;
|
||||
}
|
||||
|
||||
bool IsBrace(wchar_t c) {
|
||||
bool result = c == '{' || c == '}';
|
||||
return result;
|
||||
}
|
||||
|
||||
bool IsParen(wchar_t c) {
|
||||
bool result = c == '(' || c == ')';
|
||||
return result;
|
||||
}
|
||||
|
||||
bool IsAlphabetic(wchar_t a) {
|
||||
bool result = (a >= 'a' && a <= 'z') || (a >= 'A' && a <= 'Z');
|
||||
return result;
|
||||
|
||||
@@ -355,12 +355,18 @@ bool GlobalCommand(Event event) {
|
||||
} else if (event.clicks >= 2) {
|
||||
view->carets.len = 1;
|
||||
|
||||
// @todo: consider simplifying this, is enclosing a paren even useful?
|
||||
// like it's pretty hard to actually hit with mouse...
|
||||
if (InBounds({caret.range.min - 1, caret.range.max + 1}, p)) {
|
||||
Range range = EncloseWord(buffer, p);
|
||||
wchar_t scope = GetChar(buffer, p);
|
||||
if (scope == '{' || scope == '}') {
|
||||
if (!IsParen(scope) && !IsBrace(scope)) {
|
||||
scope = GetChar(buffer, p);
|
||||
}
|
||||
|
||||
if (IsBrace(scope)) {
|
||||
range = EncloseScope(buffer, p, '{', '}');
|
||||
} else if (scope == '(' || scope == ')') {
|
||||
} else if (IsParen(scope)) {
|
||||
range = EncloseScope(buffer, p, '(', ')');
|
||||
} else {
|
||||
if (event.clicks == 3) {
|
||||
|
||||
@@ -303,7 +303,6 @@ void ReloadLuaConfig() {
|
||||
String16 EvalString(Allocator allocator, String16 string16) {
|
||||
Scratch scratch((Arena *)allocator.object);
|
||||
String string = ToString(scratch, string16);
|
||||
string = Format(scratch, "return %.*s", FmtString(string));
|
||||
if (luaL_dostring(LuaState, string.data) != LUA_OK) {
|
||||
const char *error_message = lua_tostring(LuaState, -1);
|
||||
ReportWarningf("Execution error! %s", error_message);
|
||||
@@ -323,21 +322,7 @@ String16 EvalString(Allocator allocator, String16 string16) {
|
||||
}
|
||||
|
||||
void Command_EvalLua(View *view, String16 string) {
|
||||
Scratch scratch;
|
||||
Buffer *buffer = GetBuffer(view->active_buffer);
|
||||
String16 eval_result = EvalString(scratch, string);
|
||||
|
||||
if (eval_result.len) {
|
||||
Command_SelectEntireBuffer(view);
|
||||
Command_Replace(view, eval_result);
|
||||
Command_SelectRangeOneCursor(view, {});
|
||||
Command_Replace(view, L"\n");
|
||||
Command_SelectRangeOneCursor(view, {});
|
||||
}
|
||||
|
||||
else {
|
||||
Range range = GetLineRangeWithoutNL(*buffer, 0);
|
||||
Command_SelectRangeOneCursor(view, range);
|
||||
Command_Replace(view, {});
|
||||
}
|
||||
Scratch scratch;
|
||||
Buffer *buffer = GetBuffer(view->active_buffer);
|
||||
EvalString(scratch, string);
|
||||
}
|
||||
|
||||
@@ -1,32 +1,26 @@
|
||||
- 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)
|
||||
- ctrl + delete maybe should stop on new line but it keeps on going, sublime is much more careful with deleting
|
||||
BUG: there is a click hang when switching windows sometimes, you click after select and it doesn't switch active window
|
||||
BUG: when redo and ctrl pressed a bugged enclosure rect is shown
|
||||
BUG: when redo and ctrl pressed a bugged enclosure rect is shown - we probably want to pass the event to render and just do everything there!
|
||||
|
||||
- mouse execute
|
||||
- experiment with using multiple cursors to select command and it's input
|
||||
- we should be able to execute selection using mouse and keyboard (for now only main cursor)
|
||||
- we should be able to execute a buffer (even scratch
|
||||
- search as a command to execute which is going to be in the title bar
|
||||
- each buffer needs a directory even the special ones: C:\a\b\c\+errors?
|
||||
- open directories - resulting in buffer with dir listing and proper buffer name
|
||||
|
||||
|
||||
|
||||
- clean \r\n into \n on trim and load
|
||||
|
||||
- Dump editor state to file
|
||||
- make the editor replayable, store events and then replay, be careful about globals
|
||||
|
||||
- global config and local config
|
||||
- load all files in a directory
|
||||
|
||||
- search backwards
|
||||
- draw indentation levels like in sublime (those lines)
|
||||
- load all files in a directory
|
||||
|
||||
- word complete
|
||||
- Search all buffers in 10X style, incrementally searched results popping up on every key press (maybe we need coroutine library in C so this is easier?)
|
||||
- Implement shell interaction (here we also could use the coroutine library)
|
||||
- Search and replace
|
||||
|
||||
- select space between parens,braces but make it good
|
||||
- Implement shell interaction (here we also could use the coroutine library)
|
||||
- word complete
|
||||
- global config and local config
|
||||
- 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)
|
||||
- ctrl + delete maybe should stop on new line but it keeps on going, sublime is much more careful with deleting
|
||||
BUG: there is a click hang when switching windows sometimes, you click after select and it doesn't switch active window
|
||||
|
||||
|
||||
- Windows
|
||||
@@ -39,6 +33,7 @@ BUG: when redo and ctrl pressed a bugged enclosure rect is shown
|
||||
|
||||
|
||||
backlog
|
||||
- make the editor replayable, store events and then replay, be careful about globals
|
||||
- maybe open should return multiple options if there are many more? (like in sublime if many symbols you get a window and you choose and it automatically jumps you to the symbol in the background)
|
||||
- we could rewrite kill lines with simpler commands - extend selection to encompass lines->replace
|
||||
- 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
|
||||
|
||||
@@ -318,7 +318,9 @@ void LayoutWindows() {
|
||||
Window *window = GetWindow(CommandWindowID);
|
||||
if (window->visible) {
|
||||
Rect2 screen_rect = GetScreenRectF();
|
||||
Vec2 size = GetSize(screen_rect);
|
||||
|
||||
Vec2 size = GetSize(screen_rect);
|
||||
|
||||
CutTop(&screen_rect, size.y * 0.05f);
|
||||
CutLeft(&screen_rect, size.x * 0.2f);
|
||||
CutRight(&screen_rect, size.x * 0.2f);
|
||||
|
||||
Reference in New Issue
Block a user