Skip to content

Conversation

@Bibliocar-ng
Copy link

@Bibliocar-ng Bibliocar-ng commented Apr 23, 2021

I rewrote large parts of the code as a learning experience, but think that it has resulted in a much more complete editor. I would like to see your branch put under a permissive license, as right now it seems my project can't be used for anything.

Sorry about the whitespace changes, it's mostly a result of your editor.

Changes include:

  • refactoring movement to have bounds checking at every loop instead of in seperate movement functions
  • x and y refer to absolute positions.
  • everything gets inserted as strings
  • reallocating for loops were replaced with memory management functions. It seems to work and compiles.
  • Enter and Backspace now work with rows and strings fully
  • page-up, page-down, end, and home included as commands.

@mazarf
Copy link
Owner

mazarf commented Apr 24, 2021

Hi @Bibliocar-ng, thanks for taking an interest in this project. I haven't revisited it in a long time, but I will take a look at your changes.

I will add a permissive license to this as well so you can use it as you please

@Bibliocar-ng
Copy link
Author

Wow, thank you! I'm having a lot of fun hacking at this!

line.c Outdated
s->size = LINE_SIZE;
s->line = (char *)malloc(LINE_SIZE * sizeof(char));
s->line[0] = '\0';
void init_line(LINE *s){
Copy link
Owner

Choose a reason for hiding this comment

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

Please move the curly brace to its own line

} // init_line

// Insert char into string.
void insert_char(LINE *s, char c, int index){
Copy link
Owner

Choose a reason for hiding this comment

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

Please move the curly brace to its own line

text.c Outdated
return EXIT_SUCCESS;
} // main

int in_range(int integer, int floor, int ceil){
Copy link
Owner

Choose a reason for hiding this comment

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

Rename this to 'clamp'

text.h Outdated
void move_right(PAGE *p, int *x, int *y);
void move_up(PAGE *p, int *x, int *y);
void move_down(PAGE *p, int *x, int *y);
int in_range(int, int, int);
Copy link
Owner

Choose a reason for hiding this comment

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

Please add the parameter names to the function signature

@mazarf
Copy link
Owner

mazarf commented Apr 24, 2021

In addition to the above, could you squash these commits to a single commit? Please put the commit description in this format

Brief, one line description of changes (e.g. 'Rewrite string and position logic, add new features')

More detailed summary of the changes.  You can use the bullet point list of changes here

Other than that, the changes look good to me

@Bibliocar-ng
Copy link
Author

Thank you! Yes I can! I didn't put as much effort into it as I should have, I wasn't expecting a response! Now that I know there's a person on the other hand, I'll polish it up a bit!

@mazarf
Copy link
Owner

mazarf commented Jun 13, 2021

Hi @Bibliocar-ng sorry I think I lost track of this. I think your PR is good to go and I had no issue with the effort. It's just there were some minor details that would make the code style more in-line with the rest of the codebase. If you are still interested in working on this, feel free to update this PR with the above changes and this will be 100% good to go. If you need any assistance with updating the PR let me know

@Bibliocar-ng
Copy link
Author

Sorry. I've been occupied with a major move and haven't been able to work on it. I just got my laptop with this project on it unpacked and running. It's a fun little code base to work on, and I'll have my pull request spiff and polished in no time.

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