Huh, that line tool behavior is weird! I think I encountered this as well, but I thought it was a quirk with pen pressure (or my failure to control the pressure correctly). I never saw this with mouse input.
But getting back to the issue at hand. Looks like you were right. Indeed, the rotation is calculated over and over with very small increments and applied each time. This means the error accumulates very rapidly, at least on some systems, apparently.
So anyway, I took a stab at it and I might have actually fixed it.
You can see the results from my test below:
Live - Krita 5.1.5
Dev build with the fix - based on 4930b33b5ffe87820efee866274a13e67960722d
The change didn’t turn out too terrible (I think?), although hard for me to tell if it will play nicely with all potential dependencies (I have zero Krita development experience
). Essentially, I did the natural thing; Rather than applying many small angle increments, the rotation is always calculated from the stable initial state (when the user started dragging) and applied permanently at the end (when the user releases the keys). This way we avoid the issue of accumulating error.
I’ll eyeball the code again tomorrow and see about posting a patch.