Theorem: Diagonalizable matrices share the same eigenvector matrix $S$ iff $AB=BA$
Proof: $(\Leftarrow)$ Suppose $AB=BA$.
$ABx=BAx=B\lambda x=\lambda Bx$ Thus $x$ and $Bx$ are both eigenvectors of $A$, sharing the same $\lambda$. Assume that the eigenvalues of $A$ are distinct (it means the eigenspaces are all one dimensional) then $Bx$ must be a multiple of $x$. In other words $x$ is an eigenvector of $B$ as well as $A$.
Above, I can't follow the meaning of "if the eigenvalues are distinct then the eigenspaces are all one dimensional".
For example, let $A=\begin{pmatrix}4 & -5 \\ 2 & -3\end{pmatrix}$ It has two distinct eigenvalues, $-1$ and $2$. But its eignevectors are $x_1=\begin{pmatrix}1 &1\end{pmatrix}^\mathrm{T}$ and $x_2=\begin{pmatrix}5 &2 \end{pmatrix}^\mathrm{T}$, they are not one dimensional.