Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/canvas.c
Original file line number Diff line number Diff line change
Expand Up @@ -741,3 +741,27 @@ int canvas_eq(Canvas *a, Canvas *b) {
// return 1 if both pass
return 1;
}

int canvas_irow(Canvas *c, int idx, int num) {
char **new_rows = malloc(sizeof(char *)*(c->num_rows+num));
// copy prior to the inserstion
for (int i = 0; i < idx; i++) {
new_rows[i] = c->rows[i];
}
// alloc new rows
for (int n = idx; n < idx+num; n++) {
new_rows[n] = malloc(sizeof(char)*c->num_cols);
}
// copy after the insertion
for (int i = idx; i < c->num_rows; i++) {
new_rows[i+num] = c->rows[i];
}

char** old_rows = c->old_rows;
c->rows = new_rows;
free(old_rows);
}

int canvas_icol(Canvas *c, int idx, int num) {

}
14 changes: 14 additions & 0 deletions src/fe_modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,3 +532,17 @@ int mode_brush(reason_t reason, State *state) {

return 0;
}

int mode_spreadsheet(reason_t reason, State *state) {
if (reason != NEW_KEY) {
return 0;
}

if ((state->ch_in == KEY_LEFT) || (state->ch_in == KEY_RIGHT) ||
(state->ch_in == KEY_UP) || (state->ch_in == KEY_DOWN)) {
switch state->ch_in {
case KEY_LEFT:
canvas_insert_row(canvas, )
}
}
}