Skip to content

Add a Windows backend - #7

Merged
freakboy3742 merged 28 commits into
beeware:mainfrom
kattni:windows-backend
Oct 12, 2026
Merged

freakboy3742 merged 28 commits into
beeware:mainfrom
kattni:windows-backend

Conversation

@kattni

@kattni kattni commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

Adds a toga_winforms backend, so CodeEditor runs on Windows with the same features as the Cocoa, iOS, and Android backends.

  • The gutter is a panel docked beside the RichTextBox inside a bordered frame, painted from RichEdit's own line positions (EM_CHARFROMPOS and EM_POSFROMCHAR), so wrapped lines and the trailing empty line need no special cases.
  • Highlights are painted through the text box's selection, with undo recording and screen updates suspended through the Text Object Model (ITextDocument.Undo(tomSuspend) and Freeze, reached with ctypes), so Ctrl+Z still undoes typing and the paint does not flicker.
  • URL auto-detection and RichEdit's paragraph shortcuts are off, Tab inserts a tab, and Ctrl+V and Shift+Insert paste plain text.
  • Entry point, coverage exclusion, README notes, and a Windows section in the example app. No interface changes and no new unit tests: the module cannot import off Windows.

Checked on a Windows 11 ARM64 VM with Python 3.13 and the .NET 10 Desktop Runtime: highlighting, gutter alignment including wrapped and trailing lines, undo, keyboard scrolling, paste, the toolbar controls, and a few-thousand-line buffer.

Known limitations, also in the README: theme colors do not follow the system appearance, text dragged from other apps is not accepted, and the whole buffer is repainted on each debounced pass.

The change note follows in a second commit, named after this PR's number.

PR Checklist:

  • I will abide by the BeeWare Code of Conduct
  • I have read and have followed the CONTRIBUTING.md file
  • This PR was generated or assisted using an AI tool
    Assisted-by: Claude Fable 5.1

kattni and others added 28 commits October 10, 2026 00:09
# Conflicts:
#	docs/superpowers/specs/2026-10-06-code-editor-design.md
#	tests/test_highlighting.py

@freakboy3742 freakboy3742 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor cleanups, simplifying the initial widget setup, and some ReST documentation cleanup; but otherwise, this looks great - Thanks!

@freakboy3742
freakboy3742 merged commit 36ea4d1 into beeware:main Oct 12, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants