Skip to content

Latest commit

 

History

37 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

notepad--

Since Windows 11 Notepad is garbage and buggy as hell, I took the responsibility on my shoulders and made a better version. (Because apparently, opening a 2MB text file without a progress bar is a lost art).

notepad-- is a text editor built fully using C++ and the SFML library for maximum performance. It runs as native code, doing exactly what a notepad should do: put letters on a screen as fast as you can type them.


Main Features & Demos

Everything you expect from a solid text editor. Fast, reliable, and exactly what you asked for.

Typing & Formatting

Direct input, quick backspaces, and proper tab indentations (4 spaces, as it should be). No unnecessary frills, just smooth text editing.

Typing.mp4

Navigation & Selection

Highlight exactly what you need using mouse drag or standard keyboard shortcuts. It's precise, responsive, and wonderfully predictable.

Navigation.and.Selection.mp4

Clipboard Actions

The essentials: Copy, Paste, and Cut. Move your text around intuitively without worrying about weird hidden formatting transferring over.

Clipboard.Actions.mp4

Zoom & Line Wrapping

Readability matters. Zoom in and out effortlessly with the mouse wheel. Plus, the editor automatically wraps lines to fit the window — and features smart word-wrapping so an individual long word won't break your layout or force horizontal scrolling.

Zoom.and.Line.Wrapping.mp4

Architecture & Implementation

notepad-- is built from scratch with an emphasis on performance and clean architectural separation. It avoids heavy GUI frameworks by relying directly on SFML for accelerated windowing and font rendering, while all internal text structures and layout calculations are meticulously hand-written.

1. The Gap Buffer Data Structure

At the core of the editor is a custom Gap Buffer (GapBuffer.cpp). Instead of storing text as a single massive string or a linked list of lines, the application allocates a continuous block of memory with a "gap" (blank capacity) positioned exactly where the user's cursor is.

  • Performance: Inserting or deleting characters at the cursor executes in O(1) amortized time.
  • Scaling: When the gap is exhausted, the buffer grows linearly. Moving the cursor simply shifts the gap memory, meaning the editor stays highly responsive regardless of the document size.

2. Logical vs. Visual Separation

A major design pillar of the project is the strict boundary between the document's pure raw data and how it is formatted for the screen.

  • Logical Data: The raw file dataset managed efficiently within the Gap Buffer, completely untouched by any layout modifiers.
  • Visual Data: The string actually rendered to the screen. When the user resizes the window or long words wrap, a translated "visual string" is generated and mapped back to the buffer via a translation array (visual_to_logical). This crucial separation means that visual operations (like inserting a soft line-break to fit text on the screen) never mutate the actual saved file data, while maintaining instantaneous cursor synchronization between UI clicks and backend edits.

Functionalities and Shortcuts

All current features and their bindings, mapped exactly where you'd expect them to be.

Functionality Shortcut
Type text Direct input
Delete character / selection Backspace
Insert tab Tab
New line Enter
Move cursor left Left Arrow
Move cursor right Right Arrow
Move cursor up Up Arrow
Move cursor down Down Arrow
Select while moving left Shift + Left Arrow
Select while moving right Shift + Right Arrow
Select while moving up Shift + Up Arrow
Select while moving down Shift + Down Arrow
Copy selection Ctrl + C
Paste clipboard Ctrl + V
Cut selection Ctrl + X
Select all Ctrl + A
Save file Ctrl + S
Mouse click to place cursor Left Click
Mouse drag to select Left Click + Drag
Scroll document Mouse Wheel
Zoom editor Ctrl + Mouse Wheel

Installation & Setup

Prerequisites

Before you begin, ensure you have the following installed on your system:

  • C++ Compiler (supporting C++17 or later, e.g., MSVC, MinGW, or GCC)
  • CMake (v4.0 or newer)
  • Note: SFML will be automatically downloaded and built by CMake via FetchContent.

First, clone the repository to your local machine:

git clone https://github.com/Hemdan47/notepad--.git
cd notepad--

Build and Run Locally (Testing)

Use this if you just want to test the app from the build output folder without installing it globally.

cmake -B build
cmake --build build --config Release

Run it from the build output:

cd build
notepad-- <your_file_path>

Install Globally (Daily Use)

Use this if you want to call notepad-- globally from any terminal path.

  1. Build first (if not already built):
cmake -B build
cmake --build build --config Release
  1. Install to Program Files.

IMPORTANT: Run your terminal (Command Prompt or PowerShell) as Administrator for this step, or installation will fail with permission errors.

cmake --install build --config Release --prefix "C:\Program Files\notepad--"
  1. Add this folder to Windows PATH:

C:\Program Files\notepad--\bin

  1. Restart your terminal.

Now you can invoke the editor globally from anywhere:

notepad-- <your_file_path>

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

notepad-- is a text editor built fully using C++ and the SFML library for maximum performance. It runs as native code, doing exactly what a notepad should do: put letters on a screen as fast as you can type them.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages