Previously since shrs_line and shrs_core were kept separate, there was a lot of spaghetti state flow. In particular, we passed in Shell, Runtime and Context to line so line could mutate/read shell state for the purposes of keybindings, theme, triggering hooks etc. However, this breaks down when we would like to access line state from shell, for example modifying the contents of the line from a hook / keybinding / builtin.
Overall all this state flow is very messy. Take a look at reedline crate to see how they manage passing state between the readline and nushell itself.
An easy way to make things a bit cleaner is to tackle LineCtx first. Currently it contains Shell, Runtime, and Context all bundled together along with state the line uses. We should at least separate out the Line specific stuff and create a new 'bundle struct' that just holds Shell, Runtime, Context and LineCtx to reduce the number of arguments we are passing around
What would you like to see added?
Previously since
shrs_line
andshrs_core
were kept separate, there was a lot of spaghetti state flow. In particular, we passed inShell
,Runtime
andContext
to line so line could mutate/read shell state for the purposes of keybindings, theme, triggering hooks etc. However, this breaks down when we would like to access line state from shell, for example modifying the contents of the line from a hook / keybinding / builtin.Overall all this state flow is very messy. Take a look at
reedline
crate to see how they manage passing state between the readline and nushell itself.An easy way to make things a bit cleaner is to tackle
LineCtx
first. Currently it containsShell
,Runtime
, andContext
all bundled together along with state the line uses. We should at least separate out the Line specific stuff and create a new 'bundle struct' that just holdsShell
,Runtime
,Context
andLineCtx
to reduce the number of arguments we are passing around