-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scrolling & Multiple Shells & 1 screen per shell #1
base: main
Are you sure you want to change the base?
Conversation
LejusV
commented
Jul 2, 2024
- Scrolling
- Command history
- Multiple shells (nested shells supported)
- Each shell has its own screen context
- Command history (buffer) - Scroll screen (buffer) - Register process - Visible screen saved per process (buffer)
We always have at least main shell on
9954487
to
7f6bace
Compare
docker: | ||
docker run -i --platform linux/amd64 --entrypoint 'make' --workdir /psys-base --rm -v $(PWD):/psys-base gcc:11.4.0 | ||
docker.msw: | ||
docker run -i --platform linux/amd64 --entrypoint 'make' --workdir /KrapOS --rm -v C:\_Lejus\KrapOS:/KrapOS gcc:11.4.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!! Do not use absolute path.
Make could provide something like $(PWD).
echo = on; | ||
} | ||
|
||
int cons_read(char *string, unsigned long length){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cons_read
in kbd.c file ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could benefit from another file like cons.c/h
// Add cmd to history | ||
if (running->shell_props != NULL) { | ||
cmd_hist_t* cmd_hist = running->shell_props->cmd_hist; | ||
if (read > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would happen if the "read
" is > 0 but it's not a shell.
For example : Process has shell_props (it's a shell) and calls a function that reads from user (shell built-in function asking for parameters or whatever)
// A shell is its own shell to send output to | ||
running->shell_pid = running->pid; | ||
if (shell_pid >= 0) { | ||
// save_screen(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dead code ?
@@ -308,3 +363,64 @@ process_t* get_process(int pid){ | |||
} | |||
return NULL; | |||
} | |||
|
|||
int cmd_hist_up() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hist_up in process.c ?
Could also benefit from a separated file (term.c ? or could find it's place in screen.c)
} | ||
} else { | ||
for (int i = 0; i < MAX_COMMAND_LENGTH; i++) { | ||
char del[2] = {127, '\0'}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why redefining del ?
char del[2] = {127, '\0'}; |
uint8_t i = 0; | ||
uint32_t prev_index = hist->index; | ||
while((c = hist->buf[prev_index][i]) != '\0' && i < MAX_COMMAND_LENGTH) { | ||
// printf("%c", c); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dead code
@@ -15,13 +16,39 @@ | |||
#define SS_USER 0x4B | |||
#define CS_USER 0x43 | |||
#define EFLAGS 0x202 | |||
#define SCREEN_BUFFER_LEN 128 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as for hist_up, could be moved to another file
@@ -18,9 +18,7 @@ void ps(){ | |||
|
|||
void permanent_ps(){ | |||
while(1){ | |||
cli(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
for (int i = 0; i < NB_COL -1 ; i++){ | ||
for (int j = 0; j < NB_LINE - 1 ; j++){ | ||
write_char(j,i,' ', 15, 0); | ||
} | ||
} | ||
} | ||
|
||
void place_cursor(uint32_t lig, uint32_t col){ | ||
void cleanup_line() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could probably benefit from using this function when going up and down in the command history