Assignment 3: MyEditor
Due Friday, Oct 3rd, before midnight
In this multi-week assignment, you will build your VIM editor using the ncurses library.
The goals for this assignment are:
-
Work with pointer-based data structure
-
Design a user application
-
Design data structures that support good performance
-
Work with C: structs, malloc/free, etc
-
Work with the ncurses API for working with files and the terminal
Update your repository
We will use the same repository as Assignment 1
First, you must accept the pull requst on your repository on Github (screenshot).
$ cd cs223-f25-classwork
$ git pull
Your repository should now contain a new folder named A03-Editor.
Background: NCurses
We will the ncurses library to render text to the screen and respond to user input.
The program below initializes a terminal screen, prints "Hello World!",
and exits when the user presses any key. All ncurses applications need to
initialize (initscr) and cleanup (endwin) the terminal at the start and end
of the program.
#include <ncurses.h>
int main()
{
initscr(); /* Start curses mode */
printw("Hello World !!!"); /* Print Hello World */
refresh(); /* Print it on to the real screen */
getch(); /* Wait for user input */
endwin(); /* End curses mode */
return 0;
}
1. Milestone 1
-
Due Tuesday, September 23rd*
$ ./myeditor
usage: myeditor <filename>
$ ./myeditor bee.xt
bee.xt not found
$ ./myeditor tolstoy.txt
Features
-
Loading a file from the command line
-
Quitting with
:q
2. Milestone 2
Due on Friday, September 26 Students must check-in with the TA during office hours for full credit
Features:
-
Scrolling through the file using the arrow keys
-
Displaying the current row, column, and filename in a banner on the last row
-
Searching with '/'. Typing '/' will set the current search word. Pressing 'n' will go to the next match and pressing 'p' will go to the previous match.
3. Milestone 3
-
Due Friday, Oct 3rd*
-
Students must check-in during lab and during TA office hours for full credit*
Required features:
-
Pressing 'i' should go into edit mode and allow the user to edit the file.
-
Saving the file with ':w'
Choose your own adventure (Choose at least two additional VIM features to implement):
-
Show line numbers
-
Goto line with the command ':<linenum>'
-
'Y' to copy a line
-
'dd' to delete a line
-
'x' to delete a character
-
'I' to insert characters at the beginning of the line
-
'A' to append characters at the end of the line
-
'G' to go to the end of the file
-
Show a welcome screen before editing
-
Support creating new files
-
Show the number of lines in the file in the banner bar
-
etc!
Be sure to document which features you implement
4. Extra Credit
Highlight misspelled words. Use binary search to check spellings in the provided dictionary file.
5. Submit your Work
Push you work to Github to submit your work.
$ cd A03-Editor
$ git add *.c
$ git commit -m "A03-Editor milestone complete"
$ git push
Grading Rubric
Assignment rubrics
Grades are out of 4 points.
Code rubrics
-
Code checkins
-
View features
-
Search features
-
Edit features
For full credit, your C programs must be feature-complete, robust (e.g. run without memory errors or crashing) and have good style.
-
Some credit lost for missing features or bugs, depending on severity of error
-
-12.5% for style errors. See the class coding style here.
-
-50% for memory errors
-
-100% for failure to checkin work to Github
-
-100% for failure to compile on linux using make