2026-03-19 21:40:57 +01:00

103 lines
2.1 KiB
C

#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
#include <ncurses.h>
#include <locale.h>
#define STB_DS_IMPLEMENTATION
#include "../include/stb_ds.h"
int main(int ac, char** av, char** envp) {
(void)ac;
(void)av;
(void)envp;
if (!setlocale(LC_ALL, "")) {
printf("Unable to set local attributes from environment\n");
return (-1);
}
bool running = true;
WINDOW* editor = 0;
WINDOW* edit_tab = 0;
WINDOW* edit_ruler = 0;
WINDOW* term = 0;
WINDOW* document = 0;
WINDOW* doc_tab = 0;
WINDOW* doc_ruler = 0;
initscr();
cbreak();
noecho();
noqiflush();
keypad(stdscr, TRUE);
start_color();
timeout(20);
//nodelay(stdscr, TRUE);
printf("%ix%i\n", LINES, COLS);
//2line for tab
//1 colomn for middle sep
//1 line for terminput
//2 line for sep
edit_tab = subwin(stdscr, 1, COLS / 2, 0, 0);
editor = subwin(stdscr, LINES - 4, COLS / 2, 2, 0);
edit_ruler = subwin(stdscr, 1, COLS / 2, 1, 0);
doc_tab = subwin(stdscr, 1, COLS / 2, 0, COLS / 2);
document = subwin(stdscr, LINES - 7, COLS / 2, 2, COLS / 2);
doc_ruler = subwin(stdscr, 1, COLS / 2, LINES - 2, COLS / 2);
term = subwin(stdscr, 3, COLS - COLS % 2, LINES - 3, 0);
//terminfo();
rl_initialize();
rl_inhibit_completion = true;//non zero = bypasscompletion
//now need to have all my "window"
int i = 0;
while (running) {
clear();
wborder(editor, '|', '|', '-', '-', '-', '-', '-', '-');
wborder(document, '|', '|', '-', '-', '-', '-', '-', '-');
//box(editor, ACS_VLINE, ACS_HLINE);
//box(document, ACS_VLINE, ACS_HLINE);
box(term, ACS_VLINE, ACS_HLINE);
refresh();
wrefresh(edit_tab);
wrefresh(editor);
wrefresh(edit_ruler);
wrefresh(doc_tab);
wrefresh(document);
wrefresh(doc_ruler);
wrefresh(term);
//move();
int ch = getch();
if (ch != ERR) {
//process
running = false;
}
i++;
}
endwin();
/* free(editor);
free(edit_tab);
free(edit_ruler);
free(term);
free(document);
free(doc_tab);
free(doc_ruler);
*/
printf("number of loop:%i\n", i);
return (0);
}