Red Text is a lightweight text editor built with C++. I had a lot of fun during the process of building.
My goal was to boost my C++ and OOP skills. In addition to that, I wanted to extend my portfolio with a desktop GUI (Graphic User Interface) application as a software developer.
At The Beginning
I started the project by installing SFML which is a library for writing games in C++. SFML helps developers create games by providing them with cross-platform access to graphics and input devices.
I created the necessary classes for the operation of the application, such as Document
, Cursor
, EditorLine
etc.
More Functionnalities
Wonderful! With the successful functionality of my application, I can now seamlessly load files, modify their content, adjust cursor positioning, and more.
Our next step involves enhancing the application's capabilities even further, thereby increasing its depth and usefulness.
After some hard smart work, I added the dark/light mode switching. Also, I give the user the ability to open a file from his device.
I added a header to hold the opened file name, and list the main action: open a file, save the content, and change the theme.
Edit History
Amazing! I can't describe my feelings, the application is just working fine. However, it needs to be moved to the next level.
Have you ever felt like you need a Ctrl-Z
in your life? That's what happen to me when I started testing my application.
When I delete something and I need to bring it back, I found that the edit history must be supported.
To make this happen, I designed a History
class. Its purpose is to keep track of different versions of the content (snapshots) and allow easy navigation between them.
Feel free to make mistakes, you can always undo them.
Text Selection
The most challenging feature, due to the way I store my documents lines, I need to be aware of many cases:
- When the user selects a portion of a line
- When the user selects many lines
- When the user selects the whole line
- and so one ...
Addressing this challenge involves establishing a method to create a reference for the selected text. This reference will enable seamless manipulation of the selected content. For example, the user can copy, cut, or delete the selected text.
Importantly, this has to be accomplished without introducing unnecessary complications into the codebase.
Finally
Thank you for reaching the end of this description. If you have any questions, or suggestions, or need help feel free to contact me.
Have a nice day ^_^