todotxt / todo.txt-cli

☑️ A simple and extensible shell script for managing your todo.txt file.
http://todotxt.org
GNU General Public License v3.0
5.55k stars 712 forks source link

Refactoring: Use read -p MSG instead of doing echo -n MSG separately #389

Open inkarkat opened 2 years ago

inkarkat commented 2 years ago

I've seen strange readline editing behavior when the editing doesn't start at the first column: I can actually backspace into the prepended message (with Del, Ctrl-W or Ctrl-U), and then the whole edit becomes messed up.

https://user-images.githubusercontent.com/181261/174433887-a38d0930-bfa2-48a4-8337-cc7c8bb582af.mp4

read can output a prompt on its own (hopefully in all versions of Bash that we aim to support - the tests will tell), and that doesn't have this problem, and it's also a bit cleaner and shorter.

The prompt is only displayed if input is coming from a terminal. For the tests (currently only deletion and move confirmations are covered), this means that the prompt itself cannot be covered, and an empty line instead has to be expected. (On the positive side, this removes the ugly trick with $SPACE.)

Before submitting a pull request, please make sure the following is done:

inkarkat commented 2 years ago

@karbassi We're now at 12 PRs that are ready to merge, 8 of those from me. I don't feel comfortable doing any more changes until this backlog has been cleared. The last 2.12.0 release has been almost 2 years ago; I think it's time for another one. At least all the open pull requests should be incorporated; there's too much work in process, and from the outside the project looks stalled.