From e2e440d45aa3604a1be0050bf4aab2c2d010b2a3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 18 Dec 2025 03:07:40 +0000 Subject: [PATCH] Address code review: improve docstrings to clarify clamping behavior Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com> --- tp.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tp.el b/tp.el index 32fe1dd..09975e6 100644 --- a/tp.el +++ b/tp.el @@ -1974,6 +1974,7 @@ Calling conventions: FROM-ID can be an integer index or a layer name symbol. TO-IDX must be an integer index. 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." (let* ((len (length stack)) ;; 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. Positive N moves the layer up (toward top/visible). 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." (let* ((found (tp--get-layer-by-idx-or-name stack from-id)) (actual-from (when found (car found))))