Skip to content
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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

LejusV
Copy link
Collaborator

@LejusV LejusV commented Jul 2, 2024

  • Scrolling
  • Command history
  • Multiple shells (nested shells supported)
  • Each shell has its own screen context

@LejusV LejusV self-assigned this Jul 2, 2024
@LejusV LejusV force-pushed the feature/vertical_scrolling branch from 9954487 to 7f6bace Compare July 3, 2024 20:23
@LejusV LejusV requested a review from Krapoviche July 3, 2024 20:32
@LejusV LejusV marked this pull request as ready for review July 3, 2024 20:32
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
Copy link
Owner

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){
Copy link
Owner

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 ?

Copy link
Owner

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) {
Copy link
Owner

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();
Copy link
Owner

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() {
Copy link
Owner

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'};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why redefining del ?

Suggested change
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);
Copy link
Owner

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
Copy link
Owner

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();
Copy link
Owner

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() {
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants