Previous part: Command line task manager - 1

Instead of a regular List we better to use a Scrolling List - it consists of a focused item, items left behind (since they are already passed through) and future ones.

enter @(State `WR` Scrolling List Title `JNT` IO)

This time we render a point prefix to distiguish a focused item from the rest:

print cursor title = enter @World
 `yuk___` Run `hv____` point `yokl` Forth `ha` Run `ha` output
 `yuk___` Run `hv____` title `yokl` Forth `ha` Run `ha` output
 `yuk___` Run `hv____` output `hv` Caret Newline where
 
 point = is @Title `hv__` "  -  " `lv` "  -> " `hv_` cursor

If we want to render it so it looks like a regular List we have to do it in a bit tricky way.

To render a focused value, we will use -> prefix to designate a cursor:

 `yuk___` State `ho` New `hv___` Event `hv` auto
 `ha__'he` Scope `hv` at @(Focused Title)
 `yok___` World `ha_'yokl` Forth `ha` Run `ha` print Cursor

What about the rest? Previously passed items we need to traverse backwards, and future ones - forwards:

 `yuk___` State `ho` New `hv___` Event `hv` auto
 `ha__'he` Scope `hv` at @(Shafted List Title)
  `ho_'he` Scope `hv` at @(Reverse List Title)
  `ho_'he` Scope `hv` self @(List Title)
 `yok___` World `ha_'yokl` Prior `ha` Run `ha` print Bullet
 `yuk___` State `ho` New `hv___` Event `hv` auto
 `ha__'he` Scope `hv` at @(Shafted List Title)
  `ho_'he` Scope `hv` at @(Forward List Title)
  `ho_'he` Scope `hv` self @(List Title)
 `yok___` World `ha_'yokl` Forth `ha` Run `ha` print Bullet

This is how the program should work if you run it:

  -> Apply to that new position
  -  Find a way to fix ligatures
  -  Organize a boardgame session
  -  Buy a water gun for Songkran

So we used an advanced data structure for scrolling our list - it’s time to make it scrollable.

Full source code is available here.

Continue this tutorial