gui_cat_list (Raggle::Interfaces::NcursesInterface::Key)

    # File raggle, line 2626
            def Key::gui_cat_list
              id = NcursesInterface::get_win_id('cat')
              if id == -1
                cats = $config['feeds'].categories

                # determine window width/height
                w = $config['w'] - 40
                h = $config['h'] - 5
                h = cats.size + 3 if h > cats.size + 3

                # create window and add it to window list
                $wins << win = NcursesInterface::ListWindow::new({
                  'title'   => $config['msg_cat_title'],
                  'key'     => 'cat',
                  'coords'  => [20, 3, w, h],
                  'colors'  => $wins[NcursesInterface::get_win_id('item')].colors,
                })

                # build item list
                win.items << {
                  'title' => build_cat_title('all', $config['feeds'].size, w - 3),
                  'cat'   => 'all'
                }

                # iterate and append
                cats.each_with_index do |c, i|
                  win.items << {
                    'title' => build_cat_title(c.title, c.count, w - 3),
                    'cat'   => c.title
                  }
                  win.activate(i + 1) if $category == c.title
                end

                # add window to window list, draw and activate
                win.draw_items
                NcursesInterface::set_active_win(NcursesInterface::get_win_id('cat'))
              else
                if id == $a_win # window open; toggle to closed
                  $wins[id].close(true)
                else # window open but not selected; select it
                  NcursesInterface::set_active_win(id)
                end
              end
            end