Ticket #233: rtorrent-vi-bindings.patch

File rtorrent-vi-bindings.patch, 5.0 KB (added by ccowart@berkeley.edu, 6 years ago)

Patch for vi-bindings

  • src/ui/download.cc

    diff -rub rtorrent-0.5.1/src/ui/download.cc rtorrent-0.5.1-patched/src/ui/download.cc
    old new  
    275275  (*m_bindings)[KEY_UP]   = sigc::mem_fun(this, &Download::receive_prev); 
    276276  (*m_bindings)[KEY_DOWN] = sigc::mem_fun(this, &Download::receive_next); 
    277277 
     278  //Vi-style 
     279  (*m_bindings)['k']   = sigc::mem_fun(this, &Download::receive_prev); 
     280  (*m_bindings)['j'] = sigc::mem_fun(this, &Download::receive_next); 
     281 
    278282  // Key bindings for sub-ui's. 
    279283  m_uiArray[DISPLAY_PEER_LIST]->get_bindings()[KEY_RIGHT]   = sigc::bind(sigc::mem_fun(this, &Download::receive_change), DISPLAY_FILE_LIST); 
    280284  m_uiArray[DISPLAY_PEER_INFO]->get_bindings()[KEY_LEFT]    = sigc::bind(sigc::mem_fun(this, &Download::receive_change), DISPLAY_PEER_LIST); 
     
    282286  m_uiArray[DISPLAY_TRACKER_LIST]->get_bindings()[KEY_LEFT] = sigc::bind(sigc::mem_fun(this, &Download::receive_change), DISPLAY_PEER_LIST); 
    283287  m_uiArray[DISPLAY_CHUNKS_SEEN]->get_bindings()[KEY_LEFT]  = sigc::bind(sigc::mem_fun(this, &Download::receive_change), DISPLAY_PEER_LIST); 
    284288 
     289  //Vi-style 
     290  m_uiArray[DISPLAY_PEER_LIST]->get_bindings()['l']   = sigc::bind(sigc::mem_fun(this, &Download::receive_change), DISPLAY_FILE_LIST); 
     291  m_uiArray[DISPLAY_PEER_INFO]->get_bindings()['h']    = sigc::bind(sigc::mem_fun(this, &Download::receive_change), DISPLAY_PEER_LIST); 
     292  m_uiArray[DISPLAY_FILE_LIST]->get_bindings()['h']    = sigc::bind(sigc::mem_fun(this, &Download::receive_change), DISPLAY_PEER_LIST); 
     293  m_uiArray[DISPLAY_TRACKER_LIST]->get_bindings()['h'] = sigc::bind(sigc::mem_fun(this, &Download::receive_change), DISPLAY_PEER_LIST); 
     294  m_uiArray[DISPLAY_CHUNKS_SEEN]->get_bindings()['h']  = sigc::bind(sigc::mem_fun(this, &Download::receive_change), DISPLAY_PEER_LIST); 
     295 
    285296  // Doesn't belong here. 
    286297  m_uiArray[DISPLAY_PEER_LIST]->get_bindings()['*'] = sigc::mem_fun(this, &Download::receive_snub_peer); 
    287298  m_uiArray[DISPLAY_PEER_INFO]->get_bindings()['*'] = sigc::mem_fun(this, &Download::receive_snub_peer); 
  • src/ui/download_list.cc

    diff -rub rtorrent-0.5.1/src/ui/download_list.cc rtorrent-0.5.1-patched/src/ui/download_list.cc
    old new  
    240240 
    241241  m_uiDownload->activate(); 
    242242  m_uiDownload->get_bindings()[KEY_LEFT] = sigc::mem_fun(*this, &DownloadList::receive_exit_download); 
     243   
     244  //Vi-style 
     245  m_uiDownload->get_bindings()['h'] = sigc::mem_fun(*this, &DownloadList::receive_exit_download); 
    243246} 
    244247 
    245248void 
     
    422425  (*m_bindings)[KEY_UP]        = sigc::mem_fun(*this, &DownloadList::receive_prev); 
    423426  (*m_bindings)[KEY_DOWN]      = sigc::mem_fun(*this, &DownloadList::receive_next); 
    424427  (*m_bindings)[KEY_RIGHT]     = sigc::mem_fun(*this, &DownloadList::receive_view_download); 
    425   (*m_bindings)['l']           = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change), DISPLAY_LOG); 
     428  (*m_bindings)['L']           = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change), DISPLAY_LOG); 
     429   
     430  //Vi-style 
     431  (*m_bindings)['k']        = sigc::mem_fun(*this, &DownloadList::receive_prev); 
     432  (*m_bindings)['j']      = sigc::mem_fun(*this, &DownloadList::receive_next); 
     433  (*m_bindings)['l']     = sigc::mem_fun(*this, &DownloadList::receive_view_download); 
    426434 
    427435  (*m_bindings)['1']           = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change_view), "main"); 
    428436  (*m_bindings)['2']           = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_change_view), "name"); 
  • src/ui/element_file_list.cc

    diff -rub rtorrent-0.5.1/src/ui/element_file_list.cc rtorrent-0.5.1-patched/src/ui/element_file_list.cc
    old new  
    5656  m_bindings['*'] = sigc::mem_fun(*this, &ElementFileList::receive_change_all); 
    5757  m_bindings[KEY_DOWN] = sigc::mem_fun(*this, &ElementFileList::receive_next); 
    5858  m_bindings[KEY_UP] = sigc::mem_fun(*this, &ElementFileList::receive_prev); 
     59   
     60  //Vi-style 
     61  m_bindings['j'] = sigc::mem_fun(*this, &ElementFileList::receive_next); 
     62  m_bindings['k'] = sigc::mem_fun(*this, &ElementFileList::receive_prev); 
    5963} 
    6064 
    6165void 
  • src/ui/element_tracker_list.cc

    diff -rub rtorrent-0.5.1/src/ui/element_tracker_list.cc rtorrent-0.5.1-patched/src/ui/element_tracker_list.cc
    old new  
    5757  m_bindings[KEY_UP]   = sigc::mem_fun(*this, &ElementTrackerList::receive_prev); 
    5858  m_bindings[' ']      = sigc::mem_fun(*this, &ElementTrackerList::receive_cycle_group); 
    5959  m_bindings['*']      = sigc::mem_fun(*this, &ElementTrackerList::receive_disable); 
     60 
     61  //Vi-style 
     62  m_bindings['j'] = sigc::mem_fun(*this, &ElementTrackerList::receive_next); 
     63  m_bindings['k']   = sigc::mem_fun(*this, &ElementTrackerList::receive_prev); 
    6064} 
    6165 
    6266void