Hmm, a bit bigger script than I anticipated… lots of logic to go through, but I think I see a “flicker free” solution:
Limit your lcd.clear();
commands only to places where you actually need a clear screen. Then, when overwriting a longer message with a shorter one, just add spaces to overwrite past characters.
This will not limit the amount of lcd writes (that would probably require more counters, flags and if-then logic), but it will prevent the flicker.
PS, I still had to edit your post to add in the required backticks for proper code viewing. Now I am done for the night