From da86f9ac1a4204e257d9f13a0be188956023c706 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Tue, 16 Jun 2020 11:05:04 -0400 Subject: [PATCH] Renderer comments --- renderer.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/renderer.go b/renderer.go index 9a677a7..35449b4 100644 --- a/renderer.go +++ b/renderer.go @@ -10,9 +10,21 @@ import ( ) const ( + // BlankSymbol, in this case, is used to signal to the renderer to skip + // over a given cell and not perform any rendering on it. The const is + // literally the Unicode "BLANK SYMBOL" (U+2422). + // + // This character becomes useful when handing of portions of the screen to + // a separate renderer. + BlankSymbol = "␢" + + // defaultFramerate specifies the maximum interval at which we should + // update the view. defaultFramerate = time.Second / 60 ) +// renderer is a timer-based renderer, updating the view at a given framerate +// to avoid overloading the terminal emulator. type renderer struct { out io.Writer buf bytes.Buffer @@ -74,8 +86,9 @@ func (r *renderer) flush() { // 1) We'd need to maintain the terminal dimensions internally and listen // for window size changes. // - // 2) We'd need to measure the width of lines, accounting for double-byte - // widths. We'd use something like go-runewidth + // 2) We'd need to measure the width of lines, accounting for multi-cell + // rune widths, commonly found in Chinese, Japanese, Korean, emojis and so + // on. We'd use something like go-runewidth // (http://github.com/mattn/go-runewidth). // // 3) We'd need to measure the width of lines excluding ANSI escape