commit 501ec358e270f734a4026a8ed57ac0e77f45815e
parent 68b2d7381b8b28b4063a81ea01e6b8d8ca7e71c3
Author: dwrz <dwrz@dwrz.net>
Date: Sat, 28 Jan 2023 01:24:42 +0000
Document TODOs
Diffstat:
5 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/pkg/editor/buffer/glyph/glyph.go b/pkg/editor/buffer/glyph/glyph.go
@@ -2,6 +2,7 @@ package glyph
import "github.com/mattn/go-runewidth"
+// TODO: handle Unicode marks.
func Width(r rune) int {
switch r {
case '\t':
diff --git a/pkg/editor/buffer/render.go b/pkg/editor/buffer/render.go
@@ -6,6 +6,8 @@ type Output struct {
Lines []string
}
+// TODO: wrap lines.
+// TODO: add highlighting.
func (b *Buffer) Render(height, width int) *Output {
// Vertical scroll.
if b.cursor.line < b.offset.line {
diff --git a/pkg/editor/buffer/save.go b/pkg/editor/buffer/save.go
@@ -7,6 +7,8 @@ import (
"time"
)
+// TODO: save to temporary file, then move over current file.
+// TODO: autosave; track dirty buffer.
func (b *Buffer) Save() error {
var buf bytes.Buffer
switch len(b.lines) {
diff --git a/pkg/editor/editor.go b/pkg/editor/editor.go
@@ -14,6 +14,8 @@ import (
"code.dwrz.net/src/pkg/terminal/input"
)
+// TODO: add undo and redo.
+// TODO: add search and replace.
type Editor struct {
canvas *canvas.Canvas
input chan *input.Event
@@ -37,6 +39,8 @@ type Parameters struct {
Terminal *terminal.Terminal
}
+// TODO: read text piped in from stdin.
+// TODO: pipe buffer texts through shell command.
func New(p Parameters) (*Editor, error) {
var editor = &Editor{
buffers: map[string]*buffer.Buffer{},
diff --git a/pkg/terminal/terminal.go b/pkg/terminal/terminal.go
@@ -6,6 +6,8 @@ import (
"unsafe"
)
+// TODO: support terminfo.
+
const (
ClearScreen = "\u001Bc"
CursorHide = "\u001B[?25l"