console goto build results
This commit is contained in:
@@ -76,6 +76,7 @@ Int ScreenSpaceToBufferPosErrorOutOfBounds(Window *window, View *view, Buffer *b
|
||||
return result;
|
||||
}
|
||||
|
||||
void Command_OpenForLoadWord(String16 string) { Command_Open(string); }
|
||||
void MouseLoadWord(Event event, void (*cmd_function)(String16 string)) {
|
||||
Vec2I mouse = MouseVec2I();
|
||||
BSet active = GetActiveSet();
|
||||
@@ -779,22 +780,35 @@ void Command_GotoNextInList(Window *window, Int line_offset = 1) {
|
||||
window->active_view = view_goto->id;
|
||||
|
||||
Buffer *buffer_goto = GetBuffer(view_goto->active_buffer);
|
||||
int64_t pos = GetFront(view_goto->carets[0]);
|
||||
int64_t pos = window->goto_list_pos;
|
||||
Int line = PosToLine(buffer_goto, pos);
|
||||
|
||||
bool opened = false;
|
||||
for (Int i = line + line_offset; i >= 0 && i < buffer_goto->line_starts.len; i += line_offset) {
|
||||
Range line_range = GetLineRangeWithoutNL(buffer_goto, line + line_offset);
|
||||
Range line_range = GetLineRangeWithoutNL(buffer_goto, i);
|
||||
String16 line = GetString(buffer_goto, line_range);
|
||||
view_goto->carets[0] = MakeCaret(line_range.min);
|
||||
window->goto_list_pos = line_range.min;
|
||||
line = Trim(line);
|
||||
|
||||
MergeCarets(buffer_goto, &view_goto->carets);
|
||||
IF_DEBUG(AssertRanges(view_goto->carets));
|
||||
if (line.len == 0) continue;
|
||||
if (line.len == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bool windows_path = IsAlphabetic(line.data[0]) && line.data[1] == ':';
|
||||
bool unix_path = line.data[0] == '/';
|
||||
if (!windows_path && !unix_path) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CheckpointBeforeGoto(window, active_view);
|
||||
Command_Open(line);
|
||||
BSet set = Command_Open(line);
|
||||
if (set.window == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
opened = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ void OnCommand(Event event) {
|
||||
if (Shift() && Ctrl() && Mouse(LEFT)) {
|
||||
MouseLoadWord(event, Command_Eval);
|
||||
} else if (Ctrl() && Mouse(LEFT)) {
|
||||
MouseLoadWord(event, Command_Open);
|
||||
MouseLoadWord(event, Command_OpenForLoadWord);
|
||||
} else if (Mouse(LEFT)) { // Uses Alt and shift
|
||||
Vec2I mouse = MouseVec2I();
|
||||
{
|
||||
|
||||
@@ -123,10 +123,10 @@ BSet Command_Open(String path) {
|
||||
return main;
|
||||
}
|
||||
|
||||
void Command_Open(String16 path) {
|
||||
BSet Command_Open(String16 path) {
|
||||
Scratch scratch;
|
||||
String string = ToString(scratch, path);
|
||||
Command_Open(string);
|
||||
return Command_Open(string);
|
||||
}
|
||||
|
||||
int Lua_C(lua_State *L) {
|
||||
@@ -185,16 +185,19 @@ int Lua_Cmd(lua_State *L) {
|
||||
String destination = lua_tostring(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
||||
BSet main = GetActiveMainSet();
|
||||
if (destination == "console") {
|
||||
BSet set = GetConsoleSet();
|
||||
main.window->active_goto_list = set.view->id;
|
||||
main.window->goto_list_pos = set.buffer->len;
|
||||
Command_SelectRangeOneCursor(set.view, Rng(set.buffer->len));
|
||||
Command_BeginJump(&set);
|
||||
Exec(set.view->id, true, cmd, working_dir);
|
||||
Command_EndJump(set);
|
||||
} else {
|
||||
BSet set = GetActiveMainSet();
|
||||
Command_JumpNew(&set);
|
||||
Exec(set.view->id, true, cmd, working_dir);
|
||||
ActiveWindow = set.window->id;
|
||||
Command_JumpNew(&main);
|
||||
Exec(main.view->id, true, cmd, working_dir);
|
||||
ActiveWindow = main.window->id;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -42,6 +42,7 @@ struct Window {
|
||||
Array<GotoCrumb> goto_redo;
|
||||
|
||||
ViewID active_goto_list;
|
||||
Int goto_list_pos;
|
||||
|
||||
double mouse_scroller_offset;
|
||||
int z;
|
||||
@@ -111,7 +112,7 @@ Rect2I GetVisibleCells(Window *window);
|
||||
void AfterEdit(View *view, Array<Edit> edits);
|
||||
Scroller ComputeScrollerRect(Window *window);
|
||||
BSet Command_Open(String path);
|
||||
void Command_Open(String16 path);
|
||||
BSet Command_Open(String16 path);
|
||||
void UpdateScroll(Window *window, bool update_caret_scrolling);
|
||||
|
||||
void Command_SelectEntireBuffer(View *view);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
- buffer_list shouldn't be a thing
|
||||
- Scroll the console properly
|
||||
- commands for scrolling: center, cursor_at_bottom_of_screen, cursor_at_top
|
||||
- Maybe instead of WorkingDir use directory of null buffer?
|
||||
|
||||
--------------
|
||||
buffer = make_buffer()
|
||||
|
||||
Reference in New Issue
Block a user