Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 9.3% on proxy.golang.org

proxy.golang.org : github.com/Release-Candidate/go-gap-buffer

This library implements a gap buffer, which is a data structure to be used as the container of the text for a (simple or not so simple) text editor. Movements to the left or right and deletion to the left and right work on Unicode runes. It supports line movements (up and down a line from the current one), it splits lines based on the newline character '\n'. Caveats: A gap buffer is an array with a "gap" - unused elements in the array - at the cursor position, where text is to be inserted and deleted. The string "Hello world!" with the cursor at the end of "Hello" - "Hello| world!" - looks like this in a gap buffer array: Movement in the gap buffer works by moving the start and end of the gap, same with deletion of unicode runes in both directions. Moving the cursor two runes to the left: Deleting three runes to the left: Insertion happens at the cursor position by appending at the start of the gap and moving the start of the gap accordingly. New|< gap start, the cursor position gap end >|lo world! Implementation Detail: The line lengths are stored in a another gap buffer, which is synchronized with the gap buffer of the text itself.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/%21release-%21candidate/go-gap-buffer
Keywords: data-structures, gap-buffer, go, golang, library, text, text-editing
License: MIT
Latest release: 25 days ago
Namespace: github.com/Release-Candidate
Stars: 0 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 25 days ago