temp commit
This commit is contained in:
+48
-48
@@ -18,19 +18,19 @@ void splitScreenInit(void) {
|
||||
E.layout.mode = SPLIT_NONE;
|
||||
E.layout.num_panes = 1;
|
||||
E.layout.active_pane = 0;
|
||||
|
||||
|
||||
E.layout.panes = malloc(sizeof(EditorPane) * 2);
|
||||
|
||||
|
||||
// Initialize single fullscreen pane
|
||||
E.layout.panes[0].buffer_id = -1; // No buffer for now
|
||||
E.layout.panes[0].start_row = 0;
|
||||
E.layout.panes[0].start_col = 0;
|
||||
E.layout.panes[0].origin_y = 0;
|
||||
E.layout.panes[0].origin_x = 0;
|
||||
E.layout.panes[0].height = E.screenrows - 2; // Leave room for status bar
|
||||
E.layout.panes[0].width = E.screencols;
|
||||
E.layout.panes[0].cursor_x = 0;
|
||||
E.layout.panes[0].cursor_y = 0;
|
||||
E.layout.panes[0].row_offset = 0;
|
||||
E.layout.panes[0].col_offset = 0;
|
||||
E.layout.panes[0].y_offset = 0;
|
||||
E.layout.panes[0].x_offset = 0;
|
||||
E.layout.panes[0].is_active = 1;
|
||||
}
|
||||
|
||||
@@ -47,40 +47,40 @@ int splitScreenVertical(int buffer_id_left, int buffer_id_right) {
|
||||
editorSetStatusMessage("Error: invalid buffer IDs");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// Reallocate panes array
|
||||
E.layout.panes = realloc(E.layout.panes, sizeof(EditorPane) * 2);
|
||||
E.layout.mode = SPLIT_VERTICAL;
|
||||
E.layout.num_panes = 2;
|
||||
E.layout.active_pane = 0;
|
||||
|
||||
|
||||
int half_width = E.screencols / 2;
|
||||
int pane_height = E.screenrows - 2; // Leave room for status bar
|
||||
|
||||
int pane_height = E.screenrows; // Leave room for status bar
|
||||
|
||||
// Left pane
|
||||
E.layout.panes[0].buffer_id = buffer_id_left;
|
||||
E.layout.panes[0].start_row = 0;
|
||||
E.layout.panes[0].start_col = 0;
|
||||
E.layout.panes[0].origin_y = 0;
|
||||
E.layout.panes[0].origin_x = 0;
|
||||
E.layout.panes[0].height = pane_height;
|
||||
E.layout.panes[0].width = half_width;
|
||||
E.layout.panes[0].cursor_x = 0;
|
||||
E.layout.panes[0].cursor_y = 0;
|
||||
E.layout.panes[0].row_offset = 0;
|
||||
E.layout.panes[0].col_offset = 0;
|
||||
E.layout.panes[0].y_offset = 0;
|
||||
E.layout.panes[0].x_offset = 0;
|
||||
E.layout.panes[0].is_active = 1;
|
||||
|
||||
|
||||
// Right pane
|
||||
E.layout.panes[1].buffer_id = buffer_id_right;
|
||||
E.layout.panes[1].start_row = 0;
|
||||
E.layout.panes[1].start_col = half_width;
|
||||
E.layout.panes[1].origin_y = 0;
|
||||
E.layout.panes[1].origin_x = half_width;
|
||||
E.layout.panes[1].height = pane_height;
|
||||
E.layout.panes[1].width = E.screencols - half_width;
|
||||
E.layout.panes[1].cursor_x = 0;
|
||||
E.layout.panes[1].cursor_y = 0;
|
||||
E.layout.panes[1].row_offset = 0;
|
||||
E.layout.panes[1].col_offset = 0;
|
||||
E.layout.panes[1].y_offset = 0;
|
||||
E.layout.panes[1].x_offset = 0;
|
||||
E.layout.panes[1].is_active = 0;
|
||||
|
||||
|
||||
editorSetStatusMessage("Vertical split: %d | %d", buffer_id_left, buffer_id_right);
|
||||
return 0;
|
||||
}
|
||||
@@ -98,39 +98,39 @@ int splitScreenHorizontal(int buffer_id_top, int buffer_id_bottom) {
|
||||
editorSetStatusMessage("Error: invalid buffer IDs");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// Reallocate panes array
|
||||
E.layout.panes = realloc(E.layout.panes, sizeof(EditorPane) * 2);
|
||||
E.layout.mode = SPLIT_HORIZONTAL;
|
||||
E.layout.num_panes = 2;
|
||||
E.layout.active_pane = 0;
|
||||
|
||||
|
||||
int half_height = (E.screenrows - 2) / 2; // Account for status bar
|
||||
|
||||
|
||||
// Top pane
|
||||
E.layout.panes[0].buffer_id = buffer_id_top;
|
||||
E.layout.panes[0].start_row = 0;
|
||||
E.layout.panes[0].start_col = 0;
|
||||
E.layout.panes[0].origin_y = 0;
|
||||
E.layout.panes[0].origin_x = 0;
|
||||
E.layout.panes[0].height = half_height;
|
||||
E.layout.panes[0].width = E.screencols;
|
||||
E.layout.panes[0].cursor_x = 0;
|
||||
E.layout.panes[0].cursor_y = 0;
|
||||
E.layout.panes[0].row_offset = 0;
|
||||
E.layout.panes[0].col_offset = 0;
|
||||
E.layout.panes[0].y_offset = 0;
|
||||
E.layout.panes[0].x_offset = 0;
|
||||
E.layout.panes[0].is_active = 1;
|
||||
|
||||
|
||||
// Bottom pane
|
||||
E.layout.panes[1].buffer_id = buffer_id_bottom;
|
||||
E.layout.panes[1].start_row = half_height;
|
||||
E.layout.panes[1].start_col = 0;
|
||||
E.layout.panes[1].origin_y = half_height;
|
||||
E.layout.panes[1].origin_x = 0;
|
||||
E.layout.panes[1].height = E.screenrows - 2 - half_height;
|
||||
E.layout.panes[1].width = E.screencols;
|
||||
E.layout.panes[1].cursor_x = 0;
|
||||
E.layout.panes[1].cursor_y = 0;
|
||||
E.layout.panes[1].row_offset = 0;
|
||||
E.layout.panes[1].col_offset = 0;
|
||||
E.layout.panes[1].x_offset = 0;
|
||||
E.layout.panes[1].y_offset = 0;
|
||||
E.layout.panes[1].is_active = 0;
|
||||
|
||||
|
||||
editorSetStatusMessage("Horizontal split: %d / %d", buffer_id_top, buffer_id_bottom);
|
||||
return 0;
|
||||
}
|
||||
@@ -142,13 +142,13 @@ void splitScreenUnify(void) {
|
||||
E.layout.mode = SPLIT_NONE;
|
||||
E.layout.num_panes = 1;
|
||||
E.layout.active_pane = 0;
|
||||
|
||||
E.layout.panes[0].start_row = 0;
|
||||
E.layout.panes[0].start_col = 0;
|
||||
E.layout.panes[0].height = E.screenrows - 2;
|
||||
|
||||
E.layout.panes[0].origin_x = 0;
|
||||
E.layout.panes[0].origin_y = 0;
|
||||
E.layout.panes[0].height = E.screenrows;
|
||||
E.layout.panes[0].width = E.screencols;
|
||||
E.layout.panes[0].is_active = 1;
|
||||
|
||||
|
||||
editorSetStatusMessage("Unified view");
|
||||
}
|
||||
|
||||
@@ -161,17 +161,17 @@ int splitScreenSwitchPane(void) {
|
||||
editorSetStatusMessage("No split to switch");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// Deactivate current pane
|
||||
E.layout.panes[E.layout.active_pane].is_active = 0;
|
||||
|
||||
|
||||
// Move to next pane
|
||||
E.layout.active_pane = (E.layout.active_pane + 1) % E.layout.num_panes;
|
||||
|
||||
|
||||
// Activate new pane
|
||||
E.layout.panes[E.layout.active_pane].is_active = 1;
|
||||
|
||||
editorSetStatusMessage("Switched to pane %d (buffer %d)",
|
||||
|
||||
editorSetStatusMessage("Switched to pane %d (buffer %d)",
|
||||
E.layout.active_pane,
|
||||
E.layout.panes[E.layout.active_pane].buffer_id);
|
||||
return 0;
|
||||
@@ -187,15 +187,15 @@ int splitScreenSetPaneBuffer(int buffer_id) {
|
||||
editorSetStatusMessage("Error: invalid buffer ID");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
EditorPane *active = &E.layout.panes[E.layout.active_pane];
|
||||
active->buffer_id = buffer_id;
|
||||
active->cursor_x = 0;
|
||||
active->cursor_y = 0;
|
||||
active->row_offset = 0;
|
||||
active->col_offset = 0;
|
||||
|
||||
editorSetStatusMessage("Pane %d now showing buffer %d",
|
||||
active->origin_x = 0;
|
||||
active->origin_y = 0;
|
||||
|
||||
editorSetStatusMessage("Pane %d now showing buffer %d",
|
||||
E.layout.active_pane, buffer_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user