github egoist/mygo v0.4.8
MyGo 0.4.8

latest releases: v0.9.1, v0.9.0, native-sqlitecore...
one month ago

Code editor and diff viewer

New package ui/editor, a code editor and a diff viewer for native UI, designed after Zed's editor and Pierre's diffs (#289).

  • editor.View: a code editor that lays out and paints only the lines in view, so a file of a million lines scrolls and edits as one of ten.
    • Several carets: select next and all, add above and below, column selection.
    • Select larger and smaller, line commands, auto-closing and auto-indent.
    • Folding, find and replace with regular expressions, go to line.
    • Completions, hovers, diagnostics, inlay hints and suggestions from the app or a language server.
    • Changes against a DiffBase in the gutter, input methods, and Zed's key bindings.
  • editor.DiffView: the changes between two buffers.
    • Split or unified, with words changed highlighted and unchanged lines collapsed.
    • Annotations, line selection, Revert and Keep on each change.
    • Unified patches (ParsePatch, Apply, SetPatch), and an editable new side re-diffed as it is typed.
  • Highlighting goes through a Highlighter interface. A parser such as tree-sitter can plug in as Language.Highlighter and drive selections, folds, brackets and indentation. A line-state tokenizer with 28 languages is the default.
  • Styling: a Theme colors everything. The find bar, completions, hovers, diff separators, hunk actions and the gutter button can each be built by the app (RenderFindBar, RenderSeparator, …), with the defaults exported to wrap.
  • Buffers keep their text in a persistent rope, now also behind ui.TextBuffer. Several editors and both sides of a diff can share one buffer, and its methods are safe from any goroutine.
  • ui gains Painter.TextLine, Painter.Visible, Element.KeepFocus and Element.Access for packages like this one.

Docs: Code editor and Diff viewer, with live previews. Try it with go run ./examples/code-editor.

Browsers

  • Touch keyboards show only for text inputs, not for every tap on a window's canvas (#288).

Full Changelog: v0.4.7...v0.4.8

Don't miss a new mygo release

NewReleases is sending notifications on new releases.