mirror of
https://github.com/godotengine/emacs-gdscript-mode.git
synced 2026-01-03 10:09:25 +03:00
Preserve the window pos rather than jumping to the top of the file
This inspired by how blacken.el does it:
3bdb26788e/blacken.el (L140)
This commit is contained in:
@@ -52,8 +52,12 @@
|
||||
(defun gdscript-format-buffer()
|
||||
"Format the entire current buffer using `gdformat'"
|
||||
(interactive)
|
||||
(gdscript-format--format-region
|
||||
(point-min) (point-max)))
|
||||
(let ((original-point (point))
|
||||
(original-window-pos (window-start)))
|
||||
(gdscript-format--format-region
|
||||
(point-min) (point-max))
|
||||
(goto-char original-point)
|
||||
(set-window-start (selected-window) original-window-pos)))
|
||||
|
||||
(provide 'gdscript-format)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user