Skip to content

Commit 82c8483

Browse files
refactor: offsets match functionality
1 parent afaaace commit 82c8483

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

engine.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ func (e *engine) render() {
120120
}
121121
switch block.Alignment {
122122
case Right:
123-
fmt.Print(e.renderer.carriageReturn())
123+
fmt.Print(e.renderer.carriageForward())
124124
blockText := e.renderBlockSegments(block)
125-
cursorMove := e.renderer.setCursorForRightWrite(blockText, block.VerticalOffset)
125+
cursorMove := e.renderer.setCursorForRightWrite(blockText, block.HorizontalOffset)
126126
fmt.Print(cursorMove)
127127
fmt.Print(blockText)
128128
default:

renderer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,12 @@ func (r *Renderer) lineBreak() string {
124124
return r.formats.linebreak
125125
}
126126

127-
func (r *Renderer) carriageReturn() string {
127+
func (r *Renderer) carriageForward() string {
128128
return fmt.Sprintf(r.formats.left, 1000)
129129
}
130130

131131
func (r *Renderer) setCursorForRightWrite(text string, offset int) string {
132-
strippedLen := r.lenWithoutANSI(text) + offset
132+
strippedLen := r.lenWithoutANSI(text) + -offset
133133
return fmt.Sprintf(r.formats.right, strippedLen)
134134
}
135135

0 commit comments

Comments
 (0)