A search for long-lived charginos produced either directly or in the cascade decay of heavy prompt gluino states is presented. The search is based on proton–proton collision data collected at a centre-of-mass energy of s = 13 TeV between 2015 and 2018 with the ATLAS detector at the LHC, corresponding to an integrated luminosity of 136 fb- 1. Long-lived charginos are characterised by a distinct signature of a short and then disappearing track, and are reconstructed using at least four measurements in the ATLAS pixel detector, with no subsequent measurements in the silicon-microstrip tracking volume nor any associated energy deposits in the calorimeter. The final state is complemented by a large missing transverse-momentum requirement for triggering purposes and at least one high-transverse-momentum jet. No excess above the expected backgrounds is observed. Exclusion limits are set at 95% confidence level on the masses of the chargino and gluino for different chargino lifetimes. Chargino masses up to 660 (210) GeV are excluded in scenarios where the chargino is a pure wino (higgsino). For charginos produced during the cascade decay of a heavy gluino, gluinos with masses below 2.1 TeV are excluded for a chargino mass of 300 GeV and a lifetime of 0.2 ns.