← Back
TextArea
[intermediate]Multi-line text editor with insert/normal modes
Multi-line text editor with insert/normal modes
For the full interactive experience:
$ mix raxol.playground
Code
line_rows =
model.lines
|> Enum.with_index()
|> Enum.map(fn {line, i} ->
prefix = if i == model.cursor_line, do: ">", else: " "
num = String.pad_leading("#{i + 1}", @line_number_pad)
text("#{prefix} #{num} | #{line}")
end)