Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: evaluation depth in prompts

On Aug 29,  5:16pm, Peter Stephenson wrote:
} In case anyone's still following, here's the original script updated.
} This now gives reliable tracing of who's calling whom

Here's a related idea/suggestion which adds indentation to the output
of _complete_debug.  There's no convenient way to produce ${(%):-%e}
spaces for arbitrary depths without turning on promptsubst, so this
generates a bunch of %N(e. .) expressions and glues them together.
If completion goes more than 20 function calls deep there's probably
something wrong anyway.

I couldn't decide whether to put the indentation after the leading "+"
or before it.  This has it before.

(This is another one I won't commit without positive feedback.)

diff --git a/Completion/Base/Widget/_complete_debug b/Completion/Base/Widget/_complete_debug
index eff0f8e..6c0d9a3 100644
--- a/Completion/Base/Widget/_complete_debug
+++ b/Completion/Base/Widget/_complete_debug
@@ -12,6 +12,8 @@ integer debug_fd=-1
     exec {debug_fd}>&2 2>| $tmp
+  local -a debug_indent; debug_indent=( '%'{3..20}'(e. .)' )
+  local PROMTP4 PS4="${(j::)debug_indent}+%N:%i> "
   setopt xtrace

Messages sorted by: Reverse Date, Date, Thread, Author