From c7a9d7bae91d4e6fc7d5b035c3a23f955a3cfa76 Mon Sep 17 00:00:00 2001 From: Noboru Saito Date: Mon, 16 Dec 2024 19:44:55 +0900 Subject: [PATCH] Shrink content and improve rendering performance Summarize the definition of Content. Unification of content variable names. --- oviewer/content.go | 3 +++ oviewer/draw.go | 6 +++--- oviewer/oviewer.go | 2 -- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/oviewer/content.go b/oviewer/content.go index fc250c8..6bfe97b 100644 --- a/oviewer/content.go +++ b/oviewer/content.go @@ -36,6 +36,9 @@ var SpaceContent = content{ style: tcell.StyleDefault, } +// Shrink is a character that represents a shrunk column. +var Shrink rune = '…' + // ShrinkContent is a content that represents a shrunk column. var ShrinkContent = content{ mainc: Shrink, diff --git a/oviewer/draw.go b/oviewer/draw.go index f12ad4c..8e8b100 100644 --- a/oviewer/draw.go +++ b/oviewer/draw.go @@ -194,11 +194,11 @@ func (root *Root) drawNoWrapLine(y int, startX int, lN int, lineC LineC) (int, i root.clearEOL(root.scr.startX+x, y, lineC.eolStyle) break } - content := DefaultContent + c := DefaultContent if startX+x >= 0 { - content = lineC.lc[startX+x] + c = lineC.lc[startX+x] } - root.Screen.SetContent(root.scr.startX+x, y, content.mainc, content.combc, content.style) + root.Screen.SetContent(root.scr.startX+x, y, c.mainc, c.combc, c.style) } lN++ diff --git a/oviewer/oviewer.go b/oviewer/oviewer.go index fff2423..822510e 100644 --- a/oviewer/oviewer.go +++ b/oviewer/oviewer.go @@ -331,8 +331,6 @@ const ( nameGeneral string = "general" ) -var Shrink rune = '…' - var ( // ErrOutOfRange indicates that value is out of range. ErrOutOfRange = errors.New("out of range")