.. index:: colour prompt, stack sensitive prompt, garbage on the stack .. _ssp: Stack Sensitive Prompt ====================== Data left on the stack is a common bug, it's inevitable and was a issue for me when I was learning Forth. Yes ... it still happens now, but it's so infrequent it really catches me out when it occurs. I began to add ".s" to the end of every new Word just to be sure the Stack was clean, and that worked fine but was a bit messy. Recently I read a post by Albert Van Der Horst on Comp.Language.Forth (C.L.F) where he suggested colouring the Forth prompt to indicate the Stack status. What a great idea. Here is my solution, it is based on code by Glen Worstell; Note that when the stack has NO items, the prompt is the normal colour, but when the stack has one or more items, the prompt is RED. I think this is a excellent solution as it uses no extra screen real-estate, and red is very eye catching. Who could miss a non empty stack now ? A stack sensitive prompt ------------------------ .. image:: projects/stack-sensitive-prompt/stack-sensitive-prompt.jpg The code -------- .. raw:: html :file: projects/stack-sensitive-prompt/f103-red-stack-prompt.fs.html :download:`Download: f103-red-stack-prompt.fs`