After commit c018f5fd29 Fenrir is being switched over to go. If you do not want to be part of the testing process, please switch to master.

This commit is contained in:
Storm Dragon committed 2026-10-27 20:30:55 -04:00
1 parent c018f5fd29
commit 0e50de4c76
1047 files changed
+58364 -63747

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
// Copyright (c) 2026 Storm Dragon
// SPDX-License-Identifier: GPL-3.0-or-later
package review
import (
"strings"
"git.stormux.org/storm/fenrir/internal/command"
"git.stormux.org/storm/fenrir/internal/i18n"
"git.stormux.org/storm/fenrir/internal/presentation"
)
func (r *Review) spelling_text(scope command.ID, phonetic bool) string {
var text string
if r.tableMode && scope != command.CurrentLine {
cells := table_cells(r.screen.Line(r.y))
if len(cells) == 0 || r.tableColumn >= len(cells) {
return i18n.T("no table data")
}
cell := cells[r.tableColumn]
if scope == command.CurrentWord {
// Spell the complete selected cell, excluding its spoken header.
text = string(r.screen.Line(r.y)[cell.start:cell.end])
} else if cell.start != cell.end {
first, last := min(cell.start, r.screen.Cols-1), min(cell.end-1, r.screen.Cols-1)
if r.x < first || r.x > last {
r.x = first
}
text = string(r.screen.Line(r.y)[r.x])
}
} else {
switch scope {
case command.CurrentLine:
text = r.screen.Text(r.y)
case command.CurrentWord:
text = r.raw_word()
case command.CurrentChar:
text = string(r.screen.Line(r.y)[r.x])
}
}
if strings.TrimSpace(text) == "" {
r.result.Cue = presentation.Blank
return i18n.T("blank")
}
r.result.Spelling = &presentation.Spelling{Text: text, Phonetic: phonetic}
return text
}