diff --git a/TODO.txt b/TODO.txt index d04d4f3a..c8e91345 100644 --- a/TODO.txt +++ b/TODO.txt @@ -277,17 +277,15 @@ DONE-handlers should return preview action -probably do [x] start | [x] end -default line can be one sided maybe? -make flip button more clear - -upgrade xcode or something to get brew working?? -clean unused dependencies -figure out how to run dependency detector -DONE-add upper bounds to all packages +- --tutorial to open tutorial otherwise empty by default + ::HIGH PRIORITY:: -DONE-BUG `invalid = error "toggling of LHS_XXX_InheritTrue elements disallowed"` - -repro is make a chain of folders, select one in the middle and lock - -the issue is we prevent locking/hiding if parent is locked/hidden but not if parents parent etc is -DONE-BUG textarea handler crashes +DONE-BUG asserting `r = fmap (\(i, sall) -> (internal_getSAutoLineLabelPosition (larlist `debugBangBang` _sAutoLineLabel_index sall) sal sall, i, sall)) sortedlls` + -repro is to make a line label with midpoint, add text between midpoint and thene delete the midpoint in either direction -line labels still cropping on right side -allow new lines in line labels :O -LHRESS_ChildSelected graphic broken during drag and just in general @@ -409,7 +407,11 @@ DONE-BUG textarea handler crashes - +DONE-add upper bounds to all packages +DONE-BUG `invalid = error "toggling of LHS_XXX_InheritTrue elements disallowed"` + -repro is make a chain of folders, select one in the middle and lock + -the issue is we prevent locking/hiding if parent is locked/hidden but not if parents parent etc is +DONE-BUG textarea handler crashes DONE/IGNORE-add box border toggle IGONRE-TESTING check for leaks again DONE-BUG after renaming folder, clicking on canvas pane does not finalize the folder rename action until you click back on the layers pane diff --git a/src/Potato/Flow/Controller/Manipulator/Line.hs b/src/Potato/Flow/Controller/Manipulator/Line.hs index 38b8deca..d45557f2 100644 --- a/src/Potato/Flow/Controller/Manipulator/Line.hs +++ b/src/Potato/Flow/Controller/Manipulator/Line.hs @@ -493,9 +493,7 @@ sAutoLine_addMidpoint mpindex pos sline = r where newmidpoints = L.insertAt mpindex (SAutoLineConstraintFixed pos) (_sAutoLine_midpoints sline) - -- TODO update line label position - - + -- TODO update line label position (whether you adjust index will depend on the position relative to where midpoint is added, right now we always assume label is to the left) fmapfn ll = if _sAutoLineLabel_index ll > mpindex then ll { _sAutoLineLabel_index = _sAutoLineLabel_index ll + 1} else ll @@ -523,8 +521,8 @@ sAutoLine_modifyMidpoint mpindex pos sline = r where sAutoLine_deleteMidpoint :: Int -> SAutoLine -> SAutoLine sAutoLine_deleteMidpoint mpindex sline = r where newmidpoints = L.deleteAt mpindex (_sAutoLine_midpoints sline) - -- TODO update line label position - fmapfn ll = if _sAutoLineLabel_index ll >= mpindex + -- TODO update line label position (whether you adjust index will depend on the position relative to where midpoint is added, right now we always assume label is to the left) + fmapfn ll = if _sAutoLineLabel_index ll > mpindex then ll { _sAutoLineLabel_index = _sAutoLineLabel_index ll - 1} else ll newlabels = fmap fmapfn (_sAutoLine_labels sline) diff --git a/src/Potato/Flow/DebugHelpers.hs b/src/Potato/Flow/DebugHelpers.hs index eeb8a4dd..916a1413 100644 --- a/src/Potato/Flow/DebugHelpers.hs +++ b/src/Potato/Flow/DebugHelpers.hs @@ -48,4 +48,6 @@ instance MonadPotatoLogger PotatoLogger where debugBangBang :: (HasCallStack) => [a] -> Int -> a -debugBangBang l i = assert (i >=0 && i < length l) (l L.!! i) +debugBangBang l i = if (i >=0 && i < length l) + then (l L.!! i) + else error $ "debugBangBang: index " <> show i <> " out of bounds in list of length " <> show (length l) diff --git a/test/Potato/Flow/Controller/Manipulator/LineSpec.hs b/test/Potato/Flow/Controller/Manipulator/LineSpec.hs index 7c2dd1d4..0fdfeafe 100644 --- a/test/Potato/Flow/Controller/Manipulator/LineSpec.hs +++ b/test/Potato/Flow/Controller/Manipulator/LineSpec.hs @@ -217,6 +217,43 @@ midpoint_double_adjacent_delete_test = hSpecGoatTesterWithOwlPFState blankOwlPFS canvasMouseDown (50, 2) expectMidpointCount 3 +midpoint_delete_with_label_test :: Spec +midpoint_delete_with_label_test = hSpecGoatTesterWithOwlPFState blankOwlPFState $ do + + initSimpleLine + + setMarker "add a midpoint" + canvasMouseDown (50, 0) + canvasMouseDown (55, 0) + canvasMouseUp (55, 0) + expectMidpointCount 1 + + setMarker "add a label" + canvasMouseDownUp (25,0) + pressKeys "meow" + verifyMostRecentlyCreatedLinesLatestLineLabelHasText "meow" + + setMarker "delete the midpoint by going left" + canvasMouseDown (55, 0) + canvasMouseDownUp (0, 0) + expectMidpointCount 0 + verifyMostRecentlyCreatedLinesLatestLineLabelHasText "meow" + + setMarker "add a midpoint" + canvasMouseDown (50, 0) + canvasMouseDown (55, 0) + canvasMouseUp (55, 0) + expectMidpointCount 1 + verifyMostRecentlyCreatedLinesLatestLineLabelHasText "meow" + + setMarker "delete the midpoint by going right" + canvasMouseDown (55, 0) + canvasMouseDownUp (100, 0) + expectMidpointCount 0 + verifyMostRecentlyCreatedLinesLatestLineLabelHasText "meow" + + + initUnitBox :: (Int, Int) -> GoatTester () initUnitBox (x, y) = do @@ -564,6 +601,7 @@ spec = do describe "basic_cancel" $ basic_cancel_test describe "midpoint_modify_basic" $ midpoint_modify_basic_test describe "midpoint_double_adjacent_delete" $ midpoint_double_adjacent_delete_test + describe "midpoint_delete_with_label_test" $ midpoint_delete_with_label_test describe "attaching_delete_test" $ attaching_delete_test -- TODO reenable once you fix the issue in Box.hs -- THE REASON YOU DID THIS IS TO PREVENT FULLY ATTACHED LINES FROM BEING MOVED --describe "attaching_fully_attached_wont_move_test" $ attaching_fully_attached_wont_move_test