working on seperating main into editor fiels

This commit is contained in:
2025-11-07 18:29:07 -08:00
parent 99c46cec29
commit 3f9bd14056
4 changed files with 92 additions and 34 deletions

View File

@@ -27,6 +27,7 @@
#define COMMAND_MODE 0x01
#define NORMAL_MODE 0x02
#define INSERT_MODE 0x03
#define NOMAI_MODE 0x04
#define MIN_LINE_COUNT_RTB 30
@@ -268,6 +269,29 @@ int main (int argc, char *argv[]) {
}
}
if(mode == NOMAI_MODE) {
if(c == '\e') {
mode = NORMAL_MODE;
}
if(c == 'n') {
unsigned int r = 102391238;
AddBranch(&tr, create_branch(GetSelectedBranch(), (nomi_vec2){0,1}, 100, rand_r(&r)%100));
}
//NomiNavigation(c);
branchId* ids = NomiNavigation(c);
for(int i = 0; i < MAX_BRANCHES; i++) {
str[i] = ids[i]+48;
}
str[MAX_BRANCHES] = '\n';
ids = LocateBranch(&tr);
for(int i = 0; i < MAX_BRANCHES; i++) {
str[1+MAX_BRANCHES+i] = ids[i]+48;
}
term_handled_key();
}
// Key Events
if (c == ':' && mode == NORMAL_MODE) {
@@ -280,22 +304,9 @@ int main (int argc, char *argv[]) {
keyPressed = 0;
term_handled_key();
}
if(mode == NORMAL_MODE) {
//NomiNavigation(c);
branchId* ids = NomiNavigation(c);
for(int i = 0; i < MAX_BRANCHES; i++) {
str[i] = ids[i]+48;
}
str[MAX_BRANCHES] = '\n';
ids = LocateBranch(&tr);
for(int i = 0; i < MAX_BRANCHES; i++) {
str[1+MAX_BRANCHES+i] = ids[i]+48;
}
str[(MAX_BRANCHES*2)+1] = '\n';
ids = LocateBranch(&tr);
for(int i = 0; i < MAX_BRANCHES; i++) {
str[2+(MAX_BRANCHES*2)+i] = ids[i]+48;
}
if (c == 'n' && mode == NORMAL_MODE) {
mode = NOMAI_MODE;
keyPressed = 0;
term_handled_key();
}
keyPressed = 0;