fix oob in notes and viewport

This commit is contained in:
2026-01-04 17:11:01 +00:00
parent 3a2f63551d
commit 1aaeec8e12
2 changed files with 10 additions and 2 deletions
+7 -2
View File
@@ -310,6 +310,9 @@ func extractHints(content string) []string {
}
func (m NoteView) renderNote() string {
if m.path == "" {
return "" // no note is loaded, don't need to bother with anything
}
var titleText, contentText string
if len(m.sections) > 0 {
titleText = m.sections[m.currentSectionIndex].Title
@@ -330,8 +333,10 @@ func (m NoteView) renderNote() string {
case StateContent:
body, err2 = m.mdRenderer.Render(contentText)
case StateHints:
var currentHints []string
currentHints = m.sections[m.currentSectionIndex].Hints
currentHints := []string{}
if m.currentSectionIndex < len(m.sections) {
currentHints = m.sections[m.currentSectionIndex].Hints
}
if len(currentHints) == 0 {
body = "No hints available."