Adopt common v0.8.0 and preserve canceled hardware settings

This commit is contained in:
Storm Dragon committed 2026-11-16 20:10:47 -05:00
1 parent b21fceb311
commit 5dfa038706
410 files changed
+5353 -4803

No files matched your search

+10 -10
View File
@@ -167,7 +167,7 @@ func (v *viewport) setFrame(frame Frame) error {
func (v *viewport) route(key Key) (RoutingEvent, bool) {
cell := int(key - RouteBase)
if key < RouteBase || cell < 0 || cell >= v.width || v.offset+cell >= v.visible_end() {
if key < RouteBase || cell < 0 || cell >= v.width || v.offset+cell >= v.visibleEnd() {
return RoutingEvent{}, false
}
return RoutingEvent{ID: v.id, Offset: v.inputPositions[v.offset+cell]}, true
@@ -184,7 +184,7 @@ func (v *viewport) pan(key Key) bool {
v.offset = max(0, v.offset-v.width)
}
case PanRight:
if next := v.visible_end(); next < len(v.text) {
if next := v.visibleEnd(); next < len(v.text) {
v.panHistory = append(v.panHistory, v.offset)
v.offset = next
}
@@ -193,34 +193,34 @@ func (v *viewport) pan(key Key) bool {
}
func (v *viewport) frame() string {
end := v.visible_end()
end := v.visibleEnd()
return string(v.text[v.offset:end]) + strings.Repeat(" ", v.width-(end-v.offset))
}
func (v *viewport) displayDots() []byte {
result := make([]byte, v.width)
copy(result, v.dots[v.offset:v.visible_end()])
copy(result, v.dots[v.offset:v.visibleEnd()])
return result
}
func (v *viewport) displayCursor() int {
if v.cursor < v.offset || v.cursor >= v.visible_end() {
if v.cursor < v.offset || v.cursor >= v.visibleEnd() {
return 0
}
return v.cursor - v.offset + 1
}
func braille_space(cell rune) bool { return cell == ' ' || cell == '\u2800' }
func brailleSpace(cell rune) bool { return cell == ' ' || cell == '\u2800' }
// Pad the remainder of a wrapped page instead of showing half of the next
// word. Overlong words still advance by the display width. Do not hide a caret
// which the initial viewport was positioned to show.
func (v *viewport) visible_end() int {
func (v *viewport) visibleEnd() int {
end := min(len(v.text), v.offset+v.width)
if v.wordWrap && end < len(v.text) && !braille_space(v.text[end]) &&
!braille_space(v.text[end-1]) {
if v.wordWrap && end < len(v.text) && !brailleSpace(v.text[end]) &&
!brailleSpace(v.text[end-1]) {
for boundary := end - 1; boundary > v.offset; boundary-- {
if braille_space(v.text[boundary]) {
if brailleSpace(v.text[boundary]) {
if v.cursor >= boundary+1 && v.cursor < end {
return end
}