When I use Spacemacs with the Treemacs feature inside it, like the picture, I opened it by Alt Shift m + p + t 
Then use Ctrl x + u to open undo-tree 
When I move the cursor on the undo-tree by Ctrl + p, the layout had been resized 
Even I close the undo-tree window, the layout didn't back to the first picture. 
Why it happened? How to avoid it?
undo-treeand am unaware of any code that resizes windows. It only usesswitch-to-buffer-other-window,switch-to-bufferanddisplay-buffer. The culprit may possibly lie elsewhere.treemacs, but did a quick git clone and grep forshrinkandenlargeand came up with the functiontreemacs--set-width. In your debugging quest, consider copyingtreemacs--set-widthto a*scratch*buffer and modify it by making it do nothing. e.g., comment out everything and then evaluate the modified function; e.g., the new function that could be evaluated looks like(defun treemacs--set-width (width) "Doc-string." nil)You could even just typeM-x eval-expression RET (defun treemacs--set-width (width) "Doc-string." nil) RET; and, then repeat your test.shrinkandenlargein their names are most likely responsible (with a few unlikely exceptions, e.g., where analistto adisplay-bufferfamily of functions is expressly set with a particular width). Once you track down the function responsible, then you can work your way backwards to where the function is called, and then devise a plan to deal with the situation. You could even just put in some messages in the function mentioned in my previous comment to see when it gets called ...