Project 6: A Basic Text Editor

A simple text editor from scratch. It will have a multi-line text area, a menu bar with “Open” and “Save” actions, and basic text editing capabilities.

Quick Reference

Attribute Value
Primary Language C++
Alternative Languages N/A
Difficulty Level 3: Advanced
Time Estimate 2 weeks
Knowledge Area Application Development / Data Structures
Tooling LibGUI, LibGfx, LibCore
Prerequisites Projects 2 & 3, good C++ skills.

What You Will Build

A simple text editor from scratch. It will have a multi-line text area, a menu bar with “Open” and “Save” actions, and basic text editing capabilities.

Why It Matters

This project builds core skills that appear repeatedly in real-world systems and tooling.

Core Challenges

  • Using the GUI::TextEditor widget → maps to the core of your application
  • Implementing “Open” and “Save” functionality → maps to file dialogs and Core::File
  • Creating a menu bar → maps to using GUI::Action and GUI::Menu
  • Managing the document state (modified, path, etc.) → maps to application-level logic

Key Concepts

  • Actions and Menus: Look at how other apps create their File menu.
  • File Dialogs: GUI::MessageBox and GUI::FileChooser.
  • Text Widget: The GUI::TextEditor widget provides a lot of functionality out of the box.

Real-World Outcome

Deliver a working demo with observable output that proves the feature is correct.


Implementation Guide

  1. Reproduce the simplest happy-path scenario.
  2. Build the smallest working version of the core feature.
  3. Add input validation and error handling.
  4. Add instrumentation/logging to confirm behavior.
  5. Refactor into clean modules with tests.

Milestones

  • Milestone 1: Minimal working program that runs end-to-end.
  • Milestone 2: Correct outputs for typical inputs.
  • Milestone 3: Robust handling of edge cases.
  • Milestone 4: Clean structure and documented usage.

Validation Checklist

  • Output matches the real-world outcome example
  • Handles invalid inputs safely
  • Provides clear errors and exit codes
  • Repeatable results across runs

References

  • Main guide: LEARN_SERENITYOS_DEEP_DIVE.md
  • “Data Structures and Algorithms in C++” by Michael T. Goodrich