https://github.com/deadpixi/rope
A persistent rope in Go
https://github.com/deadpixi/rope
go golang text text-editor
Last synced: about 1 year ago
JSON representation
A persistent rope in Go
- Host: GitHub
- URL: https://github.com/deadpixi/rope
- Owner: deadpixi
- License: lgpl-2.1
- Created: 2022-05-11T06:21:37.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-09T03:52:43.000Z (almost 4 years ago)
- Last Synced: 2025-03-24T06:03:23.325Z (over 1 year ago)
- Topics: go, golang, text, text-editor
- Language: Go
- Homepage:
- Size: 67.4 KB
- Stars: 84
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ropes in Go
A value-oriented, immutable, functional rope in Go.
# Introduction
This module provides an implementation of the [rope data structure](https://en.wikipedia.org/wiki/Rope_(data_structure)) in Go.
Ropes allow for the efficient manipulation of long strings of text.
The rope structure implemented by this module is immutable, value-oriented, and immutable.
There is no way to modify an existing rope:
all operations on a rope return a new rope.
One notable use case that this makes particularly nice is undo/redo:
simply keep the old versions of the rope around.
# Example
A simple example:
```go
rope := NewString("hello")
rope = rope.AppendString(", world!")
fmt.Printf("The value of the rope is: %v\n", rope.String())
```
# Documentation
Documentation is included inline and is also available at https://pkg.go.dev/github.com/deadpixi/rope
# License
rope - a persistent rope data structure
Copyright (C) 2022 Rob King
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA