  This paper has three main goals.
  First, we study fixed subgroups of automorphisms of right-angled Artin and
Coxeter groups. If $\varphi$ is an untwisted automorphism of a RAAG, or an
arbitrary automorphism of a RACG, we prove that ${\rm Fix}~\varphi$ is finitely
generated and undistorted. Up to replacing $\varphi$ with a power, we show that
${\rm Fix}~\varphi$ is quasi-convex with respect to the standard word metric.
This implies that ${\rm Fix}~\varphi$ is separable and a special group in the
sense of Haglund-Wise.
  By contrast, there exist "twisted" automorphisms of RAAGs for which ${\rm
Fix}~\varphi$ is undistorted but not of type $F$ (hence not special), of type
$F$ but distorted, or even infinitely generated.
  Secondly, we introduce the notion of "coarse-median preserving" automorphism
of a coarse median group, which plays a key role in the above results. We show
that automorphisms of RAAGs are coarse-median preserving if and only if they
are untwisted. On the other hand, all automorphisms of Gromov-hyperbolic groups
and right-angled Coxeter groups are coarse-median preserving. These facts also
yield new or more elementary proofs of Nielsen realisation for RAAGs and RACGs.
  Finally, we show that, for every special group $G$ (in the sense of
Haglund-Wise), every infinite-order, coarse-median preserving outer
automorphism of $G$ can be realised as a homothety of a finite-rank median
space $X$ equipped with a "moderate" isometric $G$-action. This generalises the
classical result, due to Paulin, that every infinite-order outer automorphism
of a hyperbolic group $H$ projectively stabilises a small $H$-tree.
