1    let number_lines =
2        let lines = List<TextLine>.new
3        for i = 1 to 10000 do
4            let line = TextLine.new
5            line.insert 0 "$i\n"
6            line.set_color FontColor.light_gray
7            lines.add line
8    
9        lines
10   
11   type MultilineTextBox
12       text_display.set_z Control.offset_z
13       numbers_display.set_z Control.offset_z
14   
15       def update_mesh self =
16           let (visible_up, visible_down) = self.scroller.visible_y
17           self.text_display.text = self.display_text.lines.as_slice
18                             visible_up = visible_up
19                             visible_down = visible_down
20                             selection = self.selection
21                             font = self.font
22                             update.push
23   
24           if self.show_line_numbers then
25               val numbers_selection = Some (TextPos.new, TextPos.max)
26               self.numbers_display.text =
27                   number_lines.as_slice.take self.display_text.lines.size
28   
29               self.numbers_display.visible_up = visible_up
30                                    visible_down = visible_down
31                                    selection = numbers_selection
32                                    font = self.font
33                                    update.push
34           else
35               self.numbers_display.set_fixed_width 0
36                                    set_fixed_height 0
37   
38       def update =
39           update_mesh
40           update_offset
41   
42       scroller.visible_y@atom.subscribe { update_mesh } |> push_token
43   
44   end@ multiline_text_box
45