AnthonyDiGirolamo / todotxt-machine

an interactive terminal based todo.txt file editor with an interface similar to mutt
https://pypi.python.org/pypi/todotxt-machine/
GNU General Public License v3.0
244 stars 37 forks source link

Crash when adding new task #55

Closed geekpete closed 12 months ago

geekpete commented 5 years ago

Saw this when adding a new task:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urwid/listbox.py", line 177, in set_focus
    raise ValueError
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/todotxt-machine", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/todotxt_machine/cli.py", line 129, in main
    view.main()
  File "/usr/local/lib/python3.7/site-packages/todotxt_machine/urwid_ui.py", line 944, in main
    self.loop.run()
  File "/usr/local/lib/python3.7/site-packages/urwid/main_loop.py", line 286, in run
    self._run()
  File "/usr/local/lib/python3.7/site-packages/urwid/main_loop.py", line 384, in _run
    self.event_loop.run()
  File "/usr/local/lib/python3.7/site-packages/urwid/main_loop.py", line 788, in run
    self._loop()
  File "/usr/local/lib/python3.7/site-packages/urwid/main_loop.py", line 825, in _loop
    self._watch_files[fd]()
  File "/usr/local/lib/python3.7/site-packages/urwid/raw_display.py", line 404, in <lambda>
    event_loop, callback, self.get_available_raw_input())
  File "/usr/local/lib/python3.7/site-packages/urwid/raw_display.py", line 502, in parse_input
    callback(processed, processed_codes)
  File "/usr/local/lib/python3.7/site-packages/urwid/main_loop.py", line 411, in _update
    self.process_input(keys)
  File "/usr/local/lib/python3.7/site-packages/urwid/main_loop.py", line 517, in process_input
    something_handled |= bool(self.unhandled_input(k))
  File "/usr/local/lib/python3.7/site-packages/urwid/main_loop.py", line 563, in unhandled_input
    return self._unhandled_input(input)
  File "/usr/local/lib/python3.7/site-packages/todotxt_machine/urwid_ui.py", line 533, in keystroke
    self.add_new_todo(position='append')
  File "/usr/local/lib/python3.7/site-packages/todotxt_machine/urwid_ui.py", line 571, in add_new_todo
    self.listbox.set_focus(new_index)
  File "/usr/local/lib/python3.7/site-packages/urwid/listbox.py", line 581, in set_focus
    self._body.set_focus(position)
  File "/usr/local/lib/python3.7/site-packages/urwid/listbox.py", line 179, in set_focus
    raise IndexError("No widget at position %s" % (position,))
IndexError: No widget at position 113
geekpete commented 5 years ago

To reproduce this, you need to try to create a new task after you do a search and are in the filtered search results view.

So create a new todo file and add some tasks to it, eg:

test1
test2

then open it with todotxt-machine and do a search for test2. With the test1 item filtered out by the search, then try to create a new task and you'll get the crash with the error as mentioned above.