This is a simple text editor implemented in C using the ncurses library. The editor allows users to create, edit, and save text files, as well as customize the editor's appearance and behavior using keyboard shortcuts.
- Create, edit, and save text files
- Implement basic editing functions, such as inserting and deleting characters, moving the cursor, and undoing changes
- Support multiple views (or windows) of the same file
- Allow users to customize the editor's appearance and behavior (e.g., font size, line spacing, keyboard shortcuts)
- Use proper error handling and memory management techniques
- C compiler (GCC or Clang recommended)
- Make utility (to build the program)
To build the program, run the following command:
make
To run the program, use the following command:
./text_editor [filename]
Replace [filename] with the name of the file you want to edit. If the file does not exist, a new file will be created. For example, to create or edit a file called test.txt, use the following command:
./text_editor test.txt
The editor's main window will open, displaying the contents of the file. You can use the keyboard to edit the text and navigate the file.
The editor supports the following keyboard shortcuts:
Ctrl+S
: Save the current fileCtrl+O
: Open a new fileCtrl+X
: Cut the selected textCtrl+C
: Copy the selected textCtrl+V
: Paste the copied or cut textCtrl+Z
: Undo the last changeCtrl+Shift+Z
: Redo the last changeCtrl+Q
: Quit the editor
- The code is well-organized and commented for readability.
- The editor uses a simple data structure to represent text (e.g., a linked list of lines).
- The editor uses the ncurses library to create a text-based user interface.
Here is an example of how to use the editor:
- Start the editor and open a file:
./text_editor test.txt
- Type some text into the editor:
This is a test file.
-
Use the arrow keys to move the cursor around the text.
-
Use the Ctrl+S shortcut to save the file.
-
Use the Ctrl+O shortcut to open a new file.
-
Edit the new file and save it.
-
Use the Ctrl+Q shortcut to quit the editor.
- Ahmadi
- Max Base
Copyright 2023, Max Base