Address code review: improve docstrings to clarify clamping behavior
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
This commit is contained in:
parent
cc98ac4ed8
commit
e2e440d45a
2
tp.el
2
tp.el
@ -1974,6 +1974,7 @@ Calling conventions:
|
|||||||
FROM-ID can be an integer index or a layer name symbol.
|
FROM-ID can be an integer index or a layer name symbol.
|
||||||
TO-IDX must be an integer index.
|
TO-IDX must be an integer index.
|
||||||
Both indices refer to positions before the move and can be negative (counting from end).
|
Both indices refer to positions before the move and can be negative (counting from end).
|
||||||
|
TO-IDX is clamped to valid range (0 to stack length - 1) if out of bounds.
|
||||||
Returns the new stack, or nil if FROM-ID is invalid."
|
Returns the new stack, or nil if FROM-ID is invalid."
|
||||||
(let* ((len (length stack))
|
(let* ((len (length stack))
|
||||||
;; Resolve from-id to actual index
|
;; Resolve from-id to actual index
|
||||||
@ -1998,6 +1999,7 @@ Returns the new stack, or nil if FROM-ID is invalid."
|
|||||||
FROM-ID can be an integer index or a layer name symbol.
|
FROM-ID can be an integer index or a layer name symbol.
|
||||||
Positive N moves the layer up (toward top/visible).
|
Positive N moves the layer up (toward top/visible).
|
||||||
Negative N moves the layer down (toward bottom).
|
Negative N moves the layer down (toward bottom).
|
||||||
|
The resulting position is clamped to valid range (0 to stack length - 1).
|
||||||
Returns the new stack, or nil if FROM-ID is invalid."
|
Returns the new stack, or nil if FROM-ID is invalid."
|
||||||
(let* ((found (tp--get-layer-by-idx-or-name stack from-id))
|
(let* ((found (tp--get-layer-by-idx-or-name stack from-id))
|
||||||
(actual-from (when found (car found))))
|
(actual-from (when found (car found))))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user