Report errors idea using titlebar
This commit is contained in:
@@ -1,25 +1,25 @@
|
|||||||
Style.WaitForEvents = 0
|
-- Style.WaitForEvents = 0
|
||||||
|
|
||||||
AddCo(function()
|
-- AddCo(function()
|
||||||
Play{
|
-- Play{
|
||||||
{kind = 10, key = KEY_DOWN, xwindow = 1280, ywindow = 720},
|
-- {kind = 10, key = KEY_DOWN, xwindow = 1280, ywindow = 720},
|
||||||
{kind = 10, key = KEY_DOWN, xwindow = 1280, ywindow = 720},
|
-- {kind = 10, key = KEY_DOWN, xwindow = 1280, ywindow = 720},
|
||||||
{kind = 10, key = KEY_DOWN, xwindow = 1280, ywindow = 720},
|
-- {kind = 10, key = KEY_DOWN, xwindow = 1280, ywindow = 720},
|
||||||
{kind = 10, key = KEY_DOWN, xwindow = 1280, ywindow = 720},
|
-- {kind = 10, key = KEY_DOWN, xwindow = 1280, ywindow = 720},
|
||||||
{kind = 10, key = KEY_DOWN, xwindow = 1280, ywindow = 720},
|
-- {kind = 10, key = KEY_DOWN, xwindow = 1280, ywindow = 720},
|
||||||
{kind = 10, key = KEY_DOWN, xwindow = 1280, ywindow = 720},
|
-- {kind = 10, key = KEY_DOWN, xwindow = 1280, ywindow = 720},
|
||||||
{kind = 10, key = KEY_DOWN, xwindow = 1280, ywindow = 720},
|
-- {kind = 10, key = KEY_DOWN, xwindow = 1280, ywindow = 720},
|
||||||
{kind = 10, key = KEY_Q , xwindow = 1280, ywindow = 720, ctrl = 1},
|
-- {kind = 10, key = KEY_Q , xwindow = 1280, ywindow = 720, ctrl = 1},
|
||||||
{kind = 10, key = KEY_PAGE_DOWN, xmouse = 0, ymouse = 0, xwindow = 1280, ywindow = 720},
|
-- {kind = 10, key = KEY_PAGE_DOWN, xmouse = 0, ymouse = 0, xwindow = 1280, ywindow = 720},
|
||||||
{kind = 111},
|
-- {kind = 111},
|
||||||
}
|
-- }
|
||||||
-- for i = 1,8 do coroutine.yield() end
|
-- -- for i = 1,8 do coroutine.yield() end
|
||||||
while coroutine.yield().kind ~= 111 do end
|
-- while coroutine.yield().kind ~= 111 do end
|
||||||
|
|
||||||
local buffer_name = GetActiveMainWindowBufferName()
|
-- local buffer_name = GetActiveMainWindowBufferName()
|
||||||
Print("buffer name = "..buffer_name)
|
-- Print("buffer name = "..buffer_name)
|
||||||
if buffer_name == "C:/Work/text_editor/src/text_editor/buffer_history.cpp" then
|
-- if buffer_name == "C:/Work/text_editor/src/text_editor/buffer_history.cpp" then
|
||||||
Play{{kind = 2}}
|
-- Play{{kind = 2}}
|
||||||
end
|
-- end
|
||||||
end)
|
-- end)
|
||||||
|
|
||||||
|
|||||||
@@ -210,12 +210,9 @@ void ReportWarningf(const char *fmt, ...) {
|
|||||||
View *null_view = GetView(NullViewID);
|
View *null_view = GetView(NullViewID);
|
||||||
Command_Append(null_view, string, true);
|
Command_Append(null_view, string, true);
|
||||||
|
|
||||||
// @todo: proper warning
|
void Command_InsertTitlebarCommand(BSet title, String16 needle, String16 string, bool select_entire);
|
||||||
// Window *window = GetWindowWithView(null_view->id);
|
BSet title = GetActiveTitleSet();
|
||||||
// if (!window) window = GetActiveMainSet().window;
|
Command_InsertTitlebarCommand(title, L"#Error(\"", ToString16(scratch, string), true);
|
||||||
// CheckpointBeforeGoto(window);
|
|
||||||
// window->active_view = null_view->id;
|
|
||||||
// ActiveWindow = window->id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Command_MoveCursorsByPageSize(Window *window, int direction, bool shift = false) {
|
void Command_MoveCursorsByPageSize(Window *window, int direction, bool shift = false) {
|
||||||
@@ -887,26 +884,41 @@ void Command_FuzzySort(View *view, String16 needle) {
|
|||||||
Command_SelectRangeOneCursor(view, Rng(0));
|
Command_SelectRangeOneCursor(view, Rng(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Command_SelectTitlebarCommand(Window *window, String16 needle) {
|
void Command_InsertTitlebarCommand(BSet title, String16 needle, String16 initial_value, bool select_entire_thing) {
|
||||||
BSet title = GetTitleSet(window);
|
|
||||||
String16 buffer_string = GetString(title.buffer);
|
|
||||||
ActiveWindow = title.window->id;
|
|
||||||
title.window->auto_enclose = true;
|
|
||||||
|
|
||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
String16 quoted16 = {};
|
String16 quoted16 = {};
|
||||||
{
|
{
|
||||||
String needle8 = ToString(scratch, needle);
|
String needle8 = ToString(scratch, needle);
|
||||||
String quoted = Format(scratch, "%.*s\")", FmtString(needle8));
|
String initial_value8 = ToString(scratch, initial_value);
|
||||||
quoted16 = ToString16(scratch, quoted);
|
String quoted = Format(scratch, "%.*s%.*s\")", FmtString(needle8), FmtString(initial_value8));
|
||||||
|
quoted16 = ToString16(scratch, quoted);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t index = 0;
|
Range needle_range = {};
|
||||||
|
int64_t index = 0;
|
||||||
|
String16 buffer_string = GetString(title.buffer);
|
||||||
if (Seek(buffer_string, needle, &index)) {
|
if (Seek(buffer_string, needle, &index)) {
|
||||||
Command_SelectRangeOneCursor(title.view, Rng(index + needle.len));
|
Range range = EncloseExecWord(title.buffer, index);
|
||||||
|
Command_SelectRangeOneCursor(title.view, Rng(range.min - 1, range.max));
|
||||||
|
Command_Replace(title.view, quoted16);
|
||||||
|
needle_range = {index + needle.len, index + needle.len + initial_value.len};
|
||||||
} else {
|
} else {
|
||||||
Command_SelectRangeOneCursor(title.view, GetEndAsRange(title.buffer));
|
Command_SelectRangeOneCursor(title.view, GetEndAsRange(title.buffer));
|
||||||
Command_Replace(title.view, quoted16);
|
Command_Replace(title.view, quoted16);
|
||||||
Command_SelectRangeOneCursor(title.view, GetEndAsRange(title.buffer) - 2);
|
Int end = GetEndAsRange(title.buffer).max - 2;
|
||||||
|
needle_range = {end - initial_value.len, end};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (select_entire_thing) {
|
||||||
|
needle_range.min -= needle.len;
|
||||||
|
needle_range.max += 2;
|
||||||
|
}
|
||||||
|
Command_SelectRangeOneCursor(title.view, MakeCaret(needle_range.max, needle_range.min));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Command_SelectTitlebarCommand(Window *window, String16 needle) {
|
||||||
|
BSet title = GetTitleSet(window);
|
||||||
|
ActiveWindow = title.window->id;
|
||||||
|
title.window->auto_enclose = true;
|
||||||
|
Command_InsertTitlebarCommand(title, needle, L"", false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -449,6 +449,10 @@ void OnCommand(Event event) {
|
|||||||
Open(name);
|
Open(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CtrlPress(SDLK_T)) {
|
||||||
|
ActiveWindow = GetWindow(active.window->title_bar_window)->id;
|
||||||
|
}
|
||||||
|
|
||||||
if (CtrlShiftPress(SDLK_G)) {
|
if (CtrlShiftPress(SDLK_G)) {
|
||||||
} else if (CtrlPress(SDLK_G)) {
|
} else if (CtrlPress(SDLK_G)) {
|
||||||
Command_SelectTitlebarCommand(active.window, L"#FuzzySort(\"");
|
Command_SelectTitlebarCommand(active.window, L"#FuzzySort(\"");
|
||||||
|
|||||||
@@ -469,7 +469,7 @@ bool EvalString(Allocator allocator, String16 string16) {
|
|||||||
String string = ToString(scratch, string16);
|
String string = ToString(scratch, string16);
|
||||||
if (luaL_dostring(LuaState, string.data) != LUA_OK) {
|
if (luaL_dostring(LuaState, string.data) != LUA_OK) {
|
||||||
const char *error_message = lua_tostring(LuaState, -1);
|
const char *error_message = lua_tostring(LuaState, -1);
|
||||||
ReportConsolef("Execution error! %s", error_message);
|
ReportWarningf("Execution error! %s", error_message);
|
||||||
lua_pop(LuaState, 1);
|
lua_pop(LuaState, 1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ BSet GetActiveMainSet() {
|
|||||||
|
|
||||||
BSet GetActiveTitleSet() {
|
BSet GetActiveTitleSet() {
|
||||||
Window *window = GetWindow(ActiveWindow);
|
Window *window = GetWindow(ActiveWindow);
|
||||||
if (window->is_title_bar) window = GetWindow(window->title_bar_window);
|
if (!window->is_title_bar) window = GetWindow(window->title_bar_window);
|
||||||
return GetBSet(window);
|
return GetBSet(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ void Test(mco_coro *co) {
|
|||||||
Add(&EventPlayback, {EVENT_KEY_PRESS, SDLK_DOWN, 1280, 720});
|
Add(&EventPlayback, {EVENT_KEY_PRESS, SDLK_DOWN, 1280, 720});
|
||||||
Add(&EventPlayback, {EVENT_KEY_PRESS, SDLK_Q, 1280, 720});
|
Add(&EventPlayback, {EVENT_KEY_PRESS, SDLK_Q, 1280, 720});
|
||||||
GetLast(EventPlayback)->ctrl = 1;
|
GetLast(EventPlayback)->ctrl = 1;
|
||||||
Add(&EventPlayback, {EVENT_KEY_PRESS, SDLK_PAGEDOWN, 1280, 720});
|
|
||||||
Add(&EventPlayback, {111});
|
Add(&EventPlayback, {111});
|
||||||
|
|
||||||
for (Event *event = Yield(co); event->kind != 111; event = Yield(co)) {
|
for (Event *event = Yield(co); event->kind != 111; event = Yield(co)) {
|
||||||
|
|||||||
@@ -317,8 +317,9 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
InitLuaConfig();
|
InitLuaConfig();
|
||||||
|
|
||||||
StyleWaitForEvents = false;
|
// :Tests
|
||||||
AddCo(Test);
|
// StyleWaitForEvents = false;
|
||||||
|
// AddCo(Test);
|
||||||
|
|
||||||
Serializer ser = {EventBuffer};
|
Serializer ser = {EventBuffer};
|
||||||
while (AppIsRunning) {
|
while (AppIsRunning) {
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
- Find matches using grep, change things in that buffer then apply those changes to all items
|
- Find matches using grep, change things in that buffer then apply those changes to all items
|
||||||
- group history entries so the you can rollback through multiple ones at once and not waste time on skipping whitespace trimming or deleting every character
|
- group history entries so the you can rollback through multiple ones at once and not waste time on skipping whitespace trimming or deleting every character
|
||||||
|
|
||||||
- Fuzzy search buffer which uses titlebar as query!
|
|
||||||
- ReportWarning should be signaled visibly but you should be able to do things! no focus switching
|
- ReportWarning should be signaled visibly but you should be able to do things! no focus switching
|
||||||
|
- fix fucking conversions between strings!!!!!! we need to have stb_sprintf 16
|
||||||
|
|
||||||
- OnWindowCommand allow config user to overwrite the WindowCommand keybinding, introduce his own
|
- OnWindowCommand allow config user to overwrite the WindowCommand keybinding, introduce his own
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user