So: the shorten_prompt() needs to be kept the way it is right now: by returning the second to the last '\n' in case the '\n' is the last character - to get a non empty prompt. I was assuming that needed to be changed to return the last '\n' (in which case we will get an empty string and a '\n' for every key stroke). Roughly speaking, I will change the part:
write_on_views (plugin,
+ prompt,
+ prompt[len-1] == '\n' ? len -1 : len);
So: the shorten_prompt() needs to be kept the way it is right now: by returning the second to the last '\n' in case the '\n' is the last character - to get a non empty prompt. I was assuming that needed to be changed to return the last '\n' (in which case we will get an empty string and a '\n' for every key stroke). Roughly speaking, I will change the part:
write_on_views (plugin,
+ prompt,
+ prompt[len-1] == '\n' ? len -1 : len);
to
write_on_views (plugin,
+ prompt,
+ len);