Assignment 6: MyEditor Part 2
Due Friday, February 27, before midnight
The goals for this assignment are:
-
Work with pointer-based data structures
-
Strengthen C programming with strings and files
1. Update your repository
This assignment uses the same basecode as last week (folder A06).
2. Editor
In the file, myeditor.c, implement the following features.
-
Pressing 'i' should go into edit mode and allow the user to edit the current line.
-
Save the file to
test.txtwith ':w'. We will save to a different filename to make debugging easier.
3. Spell checker
In the file, myeditor.c, implement a feature that highlights misspelled words. Your solution should
-
Load the file
dictionaryinto a large array of strings. Each row contains a single word, already in alphabetical order. You may hard-code the number of strings in the file and assume no word is longer than 24 bytes (e.g. you can hardcode a 2D array with size NUMLINES and MAXWORDSIZE). -
Refactor your code to highlight misspelled words (according to the dictionary).
-
Implement a function that uses binary search to check the spelling. The loaded dictionary is already sorted, so you can search the array inline.
-
Using the ncurses library, highlight misspelled words with either colors or a stylistic effect.
-
4. Choose your own adventure
Choose two more Vim feature of your choice to implement. Below are some ideas. Be sure to document which features you implement, either in a README file or in a header comment!
-
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
-
Searching with '/', 'n', and 'p'.
-
etc!
5. Submit your work
Push you work to github to submit your work.
$ cd {ASST}
$ git status
$ git add *.c
$ git status
$ git commit -m "assignment complete"
$ git status
$ git push
$ git status
6. Grading Rubric
Assignment rubrics
Grades are out of 4 points.
-
(1 points) Insert mode and save
-
(2 points) Spell checker
-
(0.5 points) loads dictionary and implements binary search
-
(0.5 points) highlights misspelled words (both in command and insert mode)
-
-
(1 points) Choose your own adventure: two features
Code rubrics
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
-
-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