[go: up one dir, main page]

Crash when prompt line length exceeds width of terminal window

When the text inside the prompt field exceeds the terminal's width, the TUI crashes.

This can be reproduced by:

  • start cobib
  • press x to enter the export command prompt
  • spam some key until the terminal width will be exceeded
% python -m cobib -c cobib/docs/debug.ini
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/max/Git/cobib/cobib/__main__.py", line 108, in <module>
    main()
  File "/home/max/Git/cobib/cobib/__main__.py", line 83, in main
    tui()
  File "/home/max/Git/cobib/cobib/tui/__init__.py", line 14, in tui
    curses.wrapper(TUI)
  File "/usr/lib/python3.8/curses/__init__.py", line 105, in wrapper
    return func(stdscr, *args, **kwds)
  File "/home/max/Git/cobib/cobib/tui/tui.py", line 190, in __init__
    self.loop()
  File "/home/max/Git/cobib/cobib/tui/tui.py", line 377, in loop
    TUI.COMMANDS[cmd](self)
  File "/home/max/Git/cobib/cobib/commands/export.py", line 84, in tui
    tui.prompt_handler('export')
  File "/home/max/Git/cobib/cobib/tui/tui.py", line 545, in prompt_handler
    self.prompt.addstr(_, cur_x, chr(key))
_curses.error: addwstr() returned ERR
Edited by Max Rossmannek