|
37 | 37 |
|
38 | 38 | ;;; Code: |
39 | 39 |
|
| 40 | +(require 'mule-util) |
40 | 41 | (require 'seq) |
41 | 42 | (require 'subr-x) |
42 | 43 |
|
@@ -227,11 +228,6 @@ For example, Lua, Ruby, etc." |
227 | 228 | :type 'boolean |
228 | 229 | :group 'treesit-fold) |
229 | 230 |
|
230 | | -(defcustom treesit-fold-replacement "..." |
231 | | - "Show this string instead of the folded text." |
232 | | - :type 'string |
233 | | - :group 'treesit-fold) |
234 | | - |
235 | 231 | (defcustom treesit-fold-priority 30 |
236 | 232 | "Fold range overlay's priority." |
237 | 233 | :type 'integer |
@@ -409,7 +405,7 @@ This function is borrowed from `tree-sitter-node-at-point'." |
409 | 405 | (overlay-put ov 'display |
410 | 406 | (propertize (or (and treesit-fold-summary-show |
411 | 407 | (treesit-fold-summary--get (buffer-substring beg end))) |
412 | | - treesit-fold-replacement) |
| 408 | + (truncate-string-ellipsis)) |
413 | 409 | 'mouse-face 'treesit-fold-replacement-mouse-face |
414 | 410 | 'help-echo "mouse-1: unfold this node" |
415 | 411 | 'keymap map)) |
@@ -443,7 +439,7 @@ This function is borrowed from `tree-sitter-node-at-point'." |
443 | 439 | (overlay-put ov 'invisible 'treesit-fold) |
444 | 440 | (overlay-put ov 'display (or (and treesit-fold-summary-show |
445 | 441 | (treesit-fold-summary--get (buffer-substring beg end))) |
446 | | - treesit-fold-replacement)) |
| 442 | + (truncate-string-ellipsis))) |
447 | 443 | (overlay-put ov 'face 'treesit-fold-replacement-face)) |
448 | 444 | (treesit-fold-indicators-refresh)) |
449 | 445 |
|
@@ -800,11 +796,11 @@ more information." |
800 | 796 | "Return the section NODE's end point." |
801 | 797 | (let ((pt (treesit-node-end node)) |
802 | 798 | (children (reverse (treesit-node-children node)))) |
803 | | - (cl-some (lambda (child) |
804 | | - (when (equal 'pair (treesit-node-type child)) |
805 | | - (setq pt (treesit-node-end child)))) |
806 | | - children) |
807 | | - pt)) |
| 799 | + (or (cl-some (lambda (child) |
| 800 | + (when (equal 'pair (treesit-node-type child)) |
| 801 | + (treesit-node-end child))) |
| 802 | + children) |
| 803 | + pt))) |
808 | 804 |
|
809 | 805 | (defun treesit-fold-range-editorconfig-section (node offset) |
810 | 806 | "Return the fold range for `section' NODE in EditorConfig. |
|
0 commit comments