Skip to content

Commit

Permalink
adding random prose mode
Browse files Browse the repository at this point in the history
  • Loading branch information
KappaDistributive committed Mar 24, 2024
1 parent f16444e commit 30fe42f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions v1/selection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down

0 comments on commit 30fe42f

Please sign in to comment.