53 lines
1.0 KiB
Go
53 lines
1.0 KiB
Go
// Copyright (c) 2026 Storm Dragon
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package review
|
|
|
|
import (
|
|
"git.stormux.org/storm/fenrir/internal/i18n"
|
|
"git.stormux.org/storm/fenrir/internal/presentation"
|
|
)
|
|
|
|
func (r *Review) screen_boundary(forward bool) string {
|
|
if r.suppressScreenBoundary {
|
|
return ""
|
|
}
|
|
if forward {
|
|
r.result.Cue = presentation.Bottom
|
|
return i18n.T("end of screen")
|
|
}
|
|
r.result.Cue = presentation.Top
|
|
return i18n.T("start of screen")
|
|
}
|
|
|
|
func (r *Review) line_break() {
|
|
if !r.suppressLineBreak {
|
|
r.result.After.Text, r.result.After.Cue = i18n.T("line break"), presentation.LineEnd
|
|
}
|
|
}
|
|
|
|
func (r *Review) move_character(forward bool) string {
|
|
if forward {
|
|
if r.x == r.screen.Cols-1 {
|
|
if r.y == r.screen.Rows-1 {
|
|
return r.screen_boundary(true)
|
|
}
|
|
r.x, r.y = 0, r.y+1
|
|
r.line_break()
|
|
} else {
|
|
r.x++
|
|
}
|
|
} else {
|
|
if r.x == 0 {
|
|
if r.y == 0 {
|
|
return r.screen_boundary(false)
|
|
}
|
|
r.x, r.y = r.screen.Cols-1, r.y-1
|
|
r.line_break()
|
|
} else {
|
|
r.x--
|
|
}
|
|
}
|
|
return r.currentCharacter()
|
|
}
|