String Linked List Project Task in this project is to write a command-based text editor.
This text editor will print the contents of a file to the screen, page by page. Each page consist of 10 lines. Program keeps the contents of the file in certain data structures,and supports certain commands described below.
Lines -string objects- are kept in alinked list structure. Each line is stored in a separate node. Astack utilized in order to keep track of all actions carried out so that undo actions can be done. While program is running, it repeatedly prints the contents of thecurrent file, and asks the user what user would like do. Valid commands are:
open filename: Opens the file whose name is provided inthe fieldfilename
and loads each line into linked list.save filename: Writes the contents of the linked list to thefile whose name is provided in thefilename
field.insert n text: Inserts a new line in the text at then th line,which contains the string provided in the fieldtext
( hello my friend ).delete n: Deletes the line at positionn .move n m: Moves the line at positionn to positionm .replace n text: Program replaces the text inside linen with thestring provided intext
.next: Contents of the file does not change, but displaysthe next page.prev: Contents of the file does not change, but displaysthe previous page.undo: Reverts the last taken action. User is able to call as manyundo commands. Careful! Undo command does not include previous save or undo actions.