Skip to content

v0.8.2

Latest

Choose a tag to compare

@oligo oligo released this 16 Oct 07:48

gvcode v0.8.2

This release focuses on extensibility (new hooks and public marker APIs), editor correctness, and significant text-layout performance work, plus a dependency bump that brings Linux IME support.

New Features

Hooks

  • EnterHook — called when Enter/Return is pressed. Return true to replace the default line-break behavior.
  • TextInputHook — called before normal text input is processed, giving access to the key.EditEvent. Return true to skip default handling.
  • Both are registered via new options: AddEnterHook(...) and AddTextInputHook(...).
  • BeforePasteHook moved to a dedicated hook.go; AddBeforePasteHook(...) now initializes the editor like the other hooks.

Public marker API

  • Exported the position-tracking marker system:
    • Types/constants: Marker, MarkerBias, BiasForward, BiasBackward
    • Methods: Editor.CreateMarker(...) and Editor.RemoveMarker(...)
  • Markers survive text edits and can be used to track dynamic ranges (decoration/snippet use cases).

Text view access

  • Editor.TextView() now exposes the underlying *textview.TextView for advanced, fine-grained manipulation.

Completion

  • CompletionCandidate.SortText — used when comparing/ordering items (falls back to Label).
  • CompletionCandidate.FilterText — used when filtering items (falls back to Label).
  • Semantics match the corresponding LSP sortText / filterText fields.

Performance

  • Reduced text-layout allocations by caching shaped paragraphs and glyphs and reusing paragraph buffers across layouts, with incremental reuse of unchanged paragraphs.
  • Improved large-document deletion performance.

Bug Fixes

  • Self-paired brackets (e.g. $…$, $$): fixed NearestMatchingBrackets so opening/closing is resolved by position, and fixed indentation when Enter is pressed between a self-paired pair.
  • Edit-event batching is preserved so a single input isn't reported as multiple changes; command handlers that already report a change now consume the buffer flag to avoid duplicate ChangeEvents.
  • Text input state kept consistent across edits; IME state is reset on SetText and focus (including ungrouping in-flight composition ops).
  • Auto-inserted bracket/quote tracking (autoInsertions) is now correctly remapped when text is inserted/replaced, and stale entries are no longer left behind.
  • ReadRuneAt now performs bounds checking and returns io.EOF for out-of-range offsets.

Dependencies

  • gioui.org v0.10.1 → v0.10.3 — brings Linux IME support and fixes a font-fallback regression.
  • github.com/go-text/typesetting v0.3.4 → v0.3.5
  • github.com/rdleal/intervalst v1.4.1 → v1.5.0
  • github.com/andybalholm/stroke, golang.org/x/exp, golang.org/x/image, golang.org/x/net, golang.org/x/sys, golang.org/x/text updated.
  • Go directive bumped 1.25 → 1.26.0; adds github.com/godbus/dbus/v5 (indirect).

Documentation

  • README feature list refreshed and the "How To Use" example corrected to the current API.
  • Updated screenshot.

Full Changelog: v0.8.1...v0.8.2 (v0.8.1...v0.8.2)