Commit e17d2dcf authored by Steffen Michels's avatar Steffen Michels

InteractionHandlers.onEdit does not update view value

parent bafd6c78
Pipeline #28948 failed with stage
in 2 minutes and 19 seconds
......@@ -89,7 +89,7 @@ instance toString OSException
*/
:: InteractionHandlers l r w v =
{ onInit :: !(r -> (l, EditMode v))
, onEdit :: !(v l (Maybe v) -> (l, v, Maybe (r -> w)))
, onEdit :: !(v l (Maybe v) -> (l, Maybe (r -> w)))
, onRefresh :: !(r l (Maybe v) -> (l, v, Maybe (r -> w)))
}
......
......@@ -110,7 +110,7 @@ evalInteract l v st mode sds handlers editor writefun event=:(EditEvent eTaskId
# change = case change of NoChange = NoChange; _ = ChangeUI [] [(1,ChangeChild change)]
= case editor.Editor.valueFromState st of
Just nv
# (l, v, mbf) = handlers.InteractionHandlers.onEdit nv l v
# (l, mbf) = handlers.InteractionHandlers.onEdit nv l v
= case mbf of
//We have an update function
Just f = writefun f sds NoValue (\_->change)
......@@ -119,19 +119,19 @@ evalInteract l v st mode sds handlers editor writefun event=:(EditEvent eTaskId
// Therefore we delay it by returning the continuation in a value instead of directly:
(\w event {TaskEvalOpts|lastEval} iworld->
(ValueResult
(Value (l, v) False)
(Value (l, nv) False)
(mkTaskEvalInfo lastEval)
change
(Task (evalInteract l (Just v) st mode sds handlers editor writefun))
(Task (evalInteract l (Just nv) st mode sds handlers editor writefun))
, iworld))
event evalOpts iworld
//There is no update function
Nothing
= (ValueResult
(Value (l, v) False)
(Value (l, nv) False)
(mkTaskEvalInfo lastEval)
change
(Task (evalInteract l (Just v) st mode sds handlers editor writefun))
(Task (evalInteract l (Just nv) st mode sds handlers editor writefun))
, iworld)
Nothing
= (ValueResult
......
......@@ -95,40 +95,40 @@ enterInformation options = enterInformation` (enterEditor options)
enterInformation` (EnterUsing fromf editor)
= interactRW unitShare handlers editor @ (\((),v) -> fromf v)
where
handlers = {onInit = const ((), Enter), onEdit = \v l _ -> (l,v,Nothing), onRefresh = \r l _ -> (l,undef,Nothing)}
handlers = {onInit = const ((), Enter), onEdit = \_ l _ -> (l, Nothing), onRefresh = \r l _ -> (l,undef,Nothing)}
viewInformation :: ![ViewOption m] !m -> Task m | iTask m
viewInformation options m = viewInformation` (viewEditor options) m
viewInformation` (ViewUsing tof editor) m
= interactR unitShare {onInit = const ((),View $ tof m), onEdit = \v l _ -> (l,v,Nothing), onRefresh = \r l (Just v) -> (l,v,Nothing)} editor @! m
= interactR unitShare {onInit = const ((),View $ tof m), onEdit = \_ l _ -> (l, Nothing), onRefresh = \r l (Just v) -> (l,v,Nothing)} editor @! m
updateInformation :: ![UpdateOption m] m -> Task m | iTask m
updateInformation options m = updateInformation` (updateEditor options) m
updateInformation` (UpdateUsing tof fromf editor) m
= interactRW unitShare {onInit = const ((), Update $ tof m), onEdit = \v l _ -> (l,v,Nothing), onRefresh = \r l (Just v) -> (l,v,Nothing)}
= interactRW unitShare {onInit = const ((), Update $ tof m), onEdit = \_ l _ -> (l, Nothing), onRefresh = \r l (Just v) -> (l,v,Nothing)}
editor @ (\((),v) -> fromf m v)
updateSharedInformation :: ![UpdateSharedOption r w] !(sds () r w) -> Task r | iTask r & iTask w & RWShared sds
updateSharedInformation options sds = updateSharedInformation` (updateSharedEditor options) sds
updateSharedInformation` (UpdateSharedUsing tof fromf conflictf editor) sds
= interactRW sds {onInit = \r -> (r, Update $ tof r), onEdit = \v l _ -> (l,v,Just (\r -> fromf r v)), onRefresh = \r _ (Just v) -> (r,conflictf (tof r) v, Nothing)}
= interactRW sds {onInit = \r -> (r, Update $ tof r), onEdit = \v l _ -> (l, Just (\r -> fromf r v)), onRefresh = \r _ (Just v) -> (r,conflictf (tof r) v, Nothing)}
editor @ fst
updateSharedInformation` (UpdateSharedUsingAuto tof fromf conflictf editor) sds
= interactRW sds {onInit = \r -> (r, maybe Enter Update (tof r)), onEdit = \v l _ -> (l,v,Just (\r -> fromf r v))
= interactRW sds {onInit = \r -> (r, maybe Enter Update (tof r)), onEdit = \v l _ -> (l, Just (\r -> fromf r v))
, onRefresh = \r _ (Just v) -> (r, maybe v (\r` -> conflictf r` v) (tof r), Nothing)}
editor @ fst
viewSharedInformation :: ![ViewOption r] !(sds () r w) -> Task r | iTask r & TC w & Registrable sds
viewSharedInformation options sds = viewSharedInformation` (viewEditor options) sds
viewSharedInformation` (ViewUsing tof editor) sds
= interactR sds {onInit = \r -> (r, View $ tof r), onEdit = \v l _ -> (l,v,Nothing), onRefresh = \r _ _ -> (r,tof r,Nothing)} editor @ fst
= interactR sds {onInit = \r -> (r, View $ tof r), onEdit = \_ l _ -> (l, Nothing), onRefresh = \r _ _ -> (r,tof r,Nothing)} editor @ fst
updateInformationWithShared :: ![UpdateSharedOption (r,m) m] !(sds () r w) m -> Task m | iTask r & iTask m & TC w & RWShared sds
updateInformationWithShared options sds m = updateInformationWithShared` (updateSharedEditor options) sds m
updateInformationWithShared` (UpdateSharedUsing tof fromf conflictf editor) sds m
= interactRW sds
{onInit = \r -> ((r,m), Update $ tof (r,m))
,onEdit = \v (r,m) _ -> let nm = fromf (r,m) v in ((r,nm),v,Nothing)
,onEdit = \v (r,m) _ -> let nm = fromf (r,m) v in ((r,nm),Nothing)
,onRefresh = \r (_,m) _ -> ((r,m),tof (r,m),Nothing)
} gEditor{|*|} @ (snd o fst)
......@@ -137,7 +137,7 @@ editSelection options container sel = editSelection` (selectAttributes options)
editSelection` attributes (SelectUsing toView fromView editor) container sel
= interactRW unitShare
{onInit = \r -> ((), Update (toView container,sel))
,onEdit = \v l _ -> (l,v,Nothing)
,onEdit = \_ l _ -> (l, Nothing)
,onRefresh = \_ l (Just v) -> (l,v,Nothing)
} (attributes @>> editor) @ (\(_,(_,sel)) -> fromView container sel)
......@@ -146,7 +146,7 @@ editSelectionWithShared options sharedContainer initSel = editSelectionWithShare
editSelectionWithShared` attributes (SelectUsing toView fromView editor) sharedContainer initSel
= interactRW sharedContainer
{onInit = \r -> (r, Update(toView r, initSel r))
,onEdit = \v l _ -> (l,v,Nothing)
,onEdit = \_ l _ -> (l, Nothing)
,onRefresh = \r l (Just (v,sel)) -> (r,(toView r,sel),Nothing)
} (attributes @>> editor) @ (\(container,(_,sel)) -> fromView container sel)
......@@ -154,8 +154,8 @@ editSharedSelection :: ![SelectOption c a] c (Shared sds [Int]) -> Task [a] | iT
editSharedSelection options container sharedSel = editSharedSelection` (selectAttributes options) (selectEditor options) container sharedSel
editSharedSelection` attributes (SelectUsing toView fromView editor) container sharedSel
= interactRW sharedSel
{onInit = \r -> ((), Update (toView container,r))
,onEdit = \(vt,vs) l _ -> (l,(vt,vs),Just (const vs))
{onInit = \r -> ((), Update (toView container,r))
,onEdit = \(_,vs) l _ -> (l, Just (const vs))
,onRefresh = \r l (Just (vt,vs)) -> (l,(vt,r),Nothing)
} (attributes @>> editor) @ (\(_,(_,sel)) -> fromView container sel)
......@@ -165,7 +165,7 @@ editSharedSelectionWithShared options sharedContainer sharedSel
editSharedSelectionWithShared` attributes (SelectUsing toView fromView editor) sharedContainer sharedSel
= interactRW (sharedContainer |*< sharedSel)
{onInit = \(rc, rs) -> (rc, Update (toView rc,rs))
,onEdit = \v=:(_, vs) l _ -> (l, v, Just (const vs))
,onEdit = \(_, vs) l _ -> (l, Just (const vs))
,onRefresh = \(rc, rs) _ _ -> (rc, (toView rc, rs), Nothing)
} (attributes @>> editor) @ (\(container, (_, sel)) -> fromView container sel)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment