Is there any way to forbid insertion of text before and after specific overlay? (I mean on the same line that displays overlay.) Forbid means that either changes cancelled somehow or immediately reverted, or something like this. I'm ready to consider other options as well.
Indeed @Dan's advice helped me. My final solution is:
Mark all text beginning one character before overlay (that is including newline before it) and ending where overlay ends as read-only:
(set-text-properties (1- beg) end '(read-only t))
Now create overlay.
When it's time to remove overlay don't forget to remove
read-onlyproperty as well:
(let ((inhibit-read-only t)) (remove-text-properties (1- beg) end '(read-only nil)))