How to use the ctrl left/right arrow keys to move the cursor by words rather than by characters?

I’m using: SWI-Prolog version 8.5.16 for x86_64-linux. I want to use the ctrl left/right arrow keys to move the cursor by words rather than by characters. What I’m getting is the characters “;5D” and “;5C” printed and no movement of the cursor.

This functionality works as expected when using a prolog terminal from the Eclipse/CDP environment but fails when using swipl from the comand line. This screencast shows the correct behaviour in the Eclipse/CDP environment in the uper part and the unexpected behaviour in the botom:

Peek 2022-11-18 12-55