Reinier Lamers <tux_roc...@reinier.de> added the comment: >[resolve issue1839: k broken in interactive selection >Florent Becker <florent.bec...@ens-lyon.org>**20100527211710 > Ignore-this: 4f64f36ce0c6645537e16a99bd7f73b2 >] hunk ./src/Darcs/SelectChanges.hs 348 > FL (TaggedPatch p) C(x y) -> PatchChoices p C(x y) > -> PatchSelectionM p IO (PatchChoices p C(x y)) > textSelect whch tps pcs = do >- userSelection <- execStateT (textSelect' whch) $ >+ userSelection <- execStateT (skipMundane whch "Skipped" >> textSelect' > whch) $ ISC { total = lengthFL tps > , current = 0 > , tps = FZipper NilRL tps
This skipMundane call used to be inside textSelect'. >hunk ./src/Darcs/SelectChanges.hs 359 > InteractiveSelectionM p C(x y) () > textSelect' whch = do > z <- gets tps >- skipMundane whch "Skipped" > when (not $ rightmost z) $ > do > textSelectOne whch Here we see it's removed from textSelect'. textSelect' is a recursive function, called again after every keypress. When you used 'k' to go back to a patch you already decided about, this skipMundane call would skip that decided-about patch. So you would see the same patch as you saw before you pressed 'k'. >hunk ./src/Darcs/SelectChanges.hs 603 > jn_cap = (toUpper $ head jn) : tail jn > yorn <- promptUser singleFile the_default > case yorn of >- 'y' -> decide whichch True tp >> skipOne >- 'n' -> decide whichch False tp >> skipOne >- 'w' -> postponeNext >> skipOne >+ 'y' -> decide whichch True tp >> skipOne >> skipMundane > whichch "Skipped" + 'n' -> decide whichch False tp >> skipOne > >> skipMundane whichch "Skipped" + 'w' -> postponeNext >> > skipOne >> skipOne >> skipMundane whichch "Skipped" 'e' | (Just s) <- spl > -> splitCurrent s > 's' -> currentFile >>= maybe > (return ()) >hunk ./src/Darcs/SelectChanges.hs 609 >- (\f -> decideWholeFile whichch f False) >+ (\f -> decideWholeFile whichch f False) >> > skipMundane whichch "Skipped" 'f' -> currentFile >>= maybe > (return ()) >hunk ./src/Darcs/SelectChanges.hs 612 >- (\f -> decideWholeFile whichch f True) >+ (\f -> decideWholeFile whichch f True) >> > skipMundane whichch "Skipped" 'v' -> liftIO $ unseal2 printPatch reprCur > 'p' -> liftIO $ unseal2 printPatchPager reprCur > 'l' -> printSelected whichch Now that skipMundane is gone from the top of textSelect', we must call it explicitly after those keys have been pressed that do have to take us to the next undecided patch. >[resolve issue1843: interactive 'v' prints double entries >Florent Becker <florent.bec...@ens-lyon.org>**20100527211945 > Ignore-this: bdcec9798ec4b536bb628dad0c337949 >] hunk ./src/Darcs/SelectChanges.hs 348 > FL (TaggedPatch p) C(x y) -> PatchChoices p C(x y) > -> PatchSelectionM p IO (PatchChoices p C(x y)) > textSelect whch tps pcs = do >- userSelection <- execStateT (skipMundane whch "Skipped" >> textSelect' > whch) $ + userSelection <- execStateT (skipMundane whch "Skipped" >> >+ showCur whch >> >+ textSelect' whch) $ > ISC { total = lengthFL tps > , current = 0 > , tps = FZipper NilRL tps In this patch, with the 'showCur whch' line, we do something similar to what we did with the 'skipMundane whch "Skipped"' line in the previous patch. Instead of calling it in one place in the loop, where it was called too often, we move the call to a couple of places where we actually need it. >hunk ./src/Darcs/SelectChanges.hs 597 > o <- asks opts > let singleFile = isSingleFile (tpPatch tp) > reprCur = repr whichch (Sealed2 (tpPatch tp)) >- liftIO . (unseal2 (printFriendly o)) $ reprCur > options' <- options singleFile > theSlot <- liftChoices $ patchSlot' tp > let This change makes darcs not always show the current patch before a prompt >hunk ./src/Darcs/SelectChanges.hs 603 > the_default = get_default (whichch == Last || whichch == > FirstReversed) theSlot jn_cap = (toUpper $ head jn) : tail jn > yorn <- promptUser singleFile the_default >+ let nextPatch = skipMundane whichch "Skipped" >> showCur whichch > case yorn of This defines a helper action 'nextPatch' that makes darcs skip to the next undecided patch and show it to the user. >hunk ./src/Darcs/SelectChanges.hs 605 >- 'y' -> decide whichch True tp >> skipOne >> skipMundane > whichch "Skipped" - 'n' -> decide whichch False tp >> skipOne > >> skipMundane whichch "Skipped" - 'w' -> postponeNext >> > skipOne >> skipOne >> skipMundane whichch "Skipped" - 'e' | > (Just s) <- spl -> splitCurrent s >+ 'y' -> decide whichch True tp >> skipOne >> nextPatch >+ 'n' -> decide whichch False tp >> skipOne >> nextPatch >+ 'w' -> postponeNext >> skipOne >> skipOne >> nextPatch >+ 'e' | (Just s) <- spl -> splitCurrent s >> showCur whichch > 's' -> currentFile >>= maybe > (return ()) >hunk ./src/Darcs/SelectChanges.hs 611 >- (\f -> decideWholeFile whichch f False) >> > skipMundane whichch "Skipped" + (\f -> > decideWholeFile whichch f False) >> nextPatch 'f' -> currentFile >>= maybe > (return ()) >hunk ./src/Darcs/SelectChanges.hs 614 >- (\f -> decideWholeFile whichch f True) >> > skipMundane whichch "Skipped" + (\f -> > decideWholeFile whichch f True) >> nextPatch 'v' -> liftIO $ unseal2 > printPatch reprCur > 'p' -> liftIO $ unseal2 printPatchPager reprCur >hunk ./src/Darcs/SelectChanges.hs 617 >- 'l' -> printSelected whichch >+ 'l' -> printSelected whichch >> showCur whichch > 'x' -> liftIO $ unseal2 printSummary reprCur > 'd' -> skipAll > 'a' -> >hunk ./src/Darcs/SelectChanges.hs 628 > 'q' -> liftIO $ > do putStrLn $ jn_cap++" cancelled." > exitWith $ ExitSuccess >- 'j' -> skipOne >- 'k' -> backOne >+ 'j' -> skipOne >> showCur whichch >+ 'k' -> backOne >> showCur whichch > _ -> do liftIO . putStrLn $ helpFor jn options' These make darcs show the patch where it is needed. >hunk ./src/Darcs/SelectChanges.hs 6`32 >+showCur :: forall p C(x y) . Patchy p => WhichChanges >+ -> InteractiveSelectionM p C(x y) () >+showCur whichch = do >+ o <- asks opts >+ c <- currentPatch >+ case c of >+ Nothing -> return () >+ Just (Sealed2 tp) -> do >+ let reprCur = repr whichch (Sealed2 (tpPatch tp)) >+ liftIO . (unseal2 (printFriendly o)) $ reprCur >+ >+ > text_view :: forall p C(x y u r s). Patchy p => [DarcsFlag] -> Maybe Int -> > Int -> [Sealed2 p] -> [Sealed2 p] > -> IO () This defines a function to show the current patch. reprCur is duplicated in textSelectOne, but it's only 6 words. I'm going to push it, thanks! Reinier __________________________________ Darcs bug tracker <b...@darcs.net> <http://bugs.darcs.net/patch245> __________________________________ _______________________________________________ darcs-users mailing list darcs-users@darcs.net http://lists.osuosl.org/mailman/listinfo/darcs-users