Git Product home page Git Product logo

beamacs's Introduction

BeaMACS

BeaMACS is a toy text editor for macOS, written with some minimal SwiftUI and setup to use NSTextView with TextKit 2, which was released in 2021.

The overall design is attempting to recreate an EMACS like setup with modes, shortcuts, and commands.

To get something that is user interactive, there are some modifications to NSTextView that intercepts keyDown: and forwards this and selection range changes to the CommandReader. Regular macOS commands will fail, only shortcuts that are defined in BeaMACS will work.

CommandReader

The CommandReader dispatches on incoming keyboard shortcuts, looking up commands in the current mode that are mapped to keystrokes.

It also handles Undo and Redo. Commands are grouped by time, so commands run in successive order can be undone in one setup, instead of say one letter at a time. This happens in undoNextGroup and redoNextGroup.

All mutating commands have an inverse function that keep track of what is needed to revert its change.

Fundamental Mode

This is the base mode for editing text. It has some basic text editing support. Alphanumeric keys that do not have any modifier keys are assumed to be self inserting, so they will insert themselves into the file at the current selection range.

Demo Video

BeaMACSDemo.mp4

beamacs's People

Contributors

jeffd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.