When discussing DFT, you have to remember two things:
- you're windowing your true signal $x[n]$ (which is periodic, and then infinitely long) with a window $w[n]$ (here a rectangular window) to obtain a truncated version $x'[n]$ of it
$$x'[n] = x[n]w[n].$$
- you're sampling the Fourier Transform $X'(e^{j\Omega})$ of your signal at normalized pulsation $\Omega_k = \frac{2\pi k}{N}$ where $N$ is the number of points of your signal (and thus the number of points of your DFT)
$$X'[k] = X'(e^{j\Omega_k}).$$
So now, let's discuss your specific example. The real Fourier transform $X(e^{j\Omega})$ of your signal $x[n]$ is composed of two delta's at $\pm 1$Hz or $\Omega = \pm \frac{2\pi}{10}$ in normalized pulsation (i.e. $\Omega = 2\pi f/f_s$ where $f_s$ is your sampling frequency). This is illustrated in the figure below.

Then, in the time domain, you're applying a rectangular window $w[n]$ of length $N$ to $x[n]$, this is equivalent to convolving the real spectrum $X(e^{j\Omega})$ with the Fourier transform $W(e^{j\Omega})$ of your rectangular window, which is a sinc function
$$X'(e^{j\Omega}) = X(e^{j\Omega}) \circledast W(e^{j\Omega})$$
where $\circledast$ represents the convolution.
Those sinc functions are null at multiples of $\Omega = \frac{2\pi}{N}$. Convolving with a delta is equivalent to moving the signal centered on this delta and so you end up with two sinc functions centered around $\Omega = \pm \frac{2\pi}{10}$. The Fourier Transform of $x'[n]$ is illustrated in the figure below (for the case of $N = 100$). To obtain such a plot showing what is "hidden" in $X'(e^{j\Omega})$, you can use zero-padding on $x'[n]$.

Finally, you're sampling the spectrum $X'(e^{j\Omega})$ of your truncated version of $x[n]$ at $\Omega _k = \frac{2\pi k}{N}$ to obtain the DFT $X[k]$. For $N = 100$ (i.e. an integer multiple of the period of $x[n]$), you will thus exactly sample at the places where
- the sinc functions are centered (for $k = \pm 10$, $\Omega_k$ coincides with the center of the two sinc functions $\Omega = \pm \frac{2\pi}{10}$), and
- the sinc functions are null.
And so you go back to the two delta's at $k = \pm 10$ you observed in the first figure.
For $N = 128$ however, the sinc functions are no longer well positionned (the places where the sinc are null do no longer coincides with the pulsation $\Omega_k$ where you will sample). This leads to the second figure you have.