@mfikes: Sorry to ping you but I've been trying to figure this out on my own to no avail. I have two questions relating to the form_prompt()
function in planck-c/repl.c
.
(1) Why is the number two subtracted from the namespace length?
(2) What significance does the #_
have in the sprintf()
call? It doesn't seem to be a formatting character as best as I can tell but it presumably does something. I looked at linenoise.c
and it doesn't seem to be part of the API there either.
@mike858 That's all related to the secondary prompt
cljs.user=> [1
#_=> 2
012345678901234
In this case, cljs.user
has a length of 9, and the space before the #_
has a length of 9 - 2 = 7. (This is where the 2
comes from in the code.)
The length of "#_=> "
is 5, and adding an extra for the trailing \0
, you get 6, the other constant 6
you see in that bit of code.@mfikes: Ahhhhh, now it all makes sense. Thank you!