From 30fe42f3a4fc71aec540380e677bd83cd315db21 Mon Sep 17 00:00:00 2001 From: Stefan Mesken Date: Sun, 24 Mar 2024 10:23:58 +0100 Subject: [PATCH] adding random prose mode --- v1/selection.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/v1/selection.go b/v1/selection.go index 6c6844c..5d92a15 100644 --- a/v1/selection.go +++ b/v1/selection.go @@ -91,6 +91,14 @@ func createSelection(cursorPos int) Selection { lessons = append(lessons, lesson) content.Rows = append(content.Rows, lesson.Title) + lesson = Lesson{ + Title: "Random Prose", + Content: "", + Tag: PROSE_MODE, + } + lessons = append(lessons, lesson) + content.Rows = append(content.Rows, lesson.Title) + // Load lessons from directory files, err := ioutil.ReadDir(home + LessonsDir) if err != nil { @@ -110,6 +118,8 @@ func createSelection(cursorPos int) Selection { content.Rows = append(content.Rows, lesson.Title) } + lessons[1].Content = lessons[rand.Intn(len(lessons) - 2) + 2].Content + content.SetRect(MainMinX, MainMinY, MainMaxX, MainMaxY) content.SelectedRowStyle = ui.NewStyle(ui.ColorGreen) content.SelectedRow = cursorPos