chros73 / rtorrent-ps-ch

:art: Extended rTorrent distribution with UI enhancements, colorization, and some added features.

Home Page:https://github.com/chros73/rtorrent-ps-ch/#rtorrent-ps-ch-fork-notes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Backport and modify canvas v2 from rtorrent-ps

chros73 opened this issue · comments

A. Backport canvas v2 from rtorrent-ps:

  • replace the previous rtorrent-ps-ch canvas with canvas v2 engine

Take a look at canvas v2 of rTorrent Handbook for more info.

B. Backport patches from rtorrent-ps:

  • lt-ps_all_02-better-bencode-errors_all.patch
  • ps-dl-ui-find.patch
    • fix ^F binding for 'find' input
  • ps-event-view_all.patch
  • ps-fix-log-xmlrpc-close_all.patch
  • ps-import.return_all.patch
  • ps-object_std-map-serialization_all.patch
  • ps-silent-catch_all.patch

C. Also backport new commands from rtorrent-ps:

  • string.len, string.join, string.split, string.substr, string.shorten, string.equals, string.stratswith, string.endswith, string.strip, string.lstrip, string.rstrip, string.lpad, string.rpad
  • array.at
  • system.has, system.has.list, system.has.private_methods, system.has.public_methods, system.client_version.as_value
  • d.custom.if_z, d.custom.set_if_z, d.custom.erase, d.custom.keys, d.custom.items, d.custom.toggle, d.custom.as_value
  • import.return, do
  • d.tracker_alias, d.message.alert
  • ui.canvas_color[.set]
  • ui.column.spec, ui.column.hide, ui.column.show, ui.column.is_hidden, ui.column.hidden.list, ui.column.sacrificial.list, ui.column.sacrificed
  • ui.find.next, ui.find.term
  • ui.color.custom[x]
  • convert.time_delta

Take a look at command reference of rTorrent Handbook for more info.

D. Remove old commands from rtorrent-ps-ch:

  • d.ui.* commands
  • chars.* command group: chars.chop, chars.pad
    • use string.substr/string.shorten, string.lpad/string.rpad instead

E. Modify canvas v2 a bit:

  • move column titles with couple of characters
  • in render_columns method:
    • chop column title as well (not just column content)
    • auto-add +1 character at "Advance position"
      • shorten column/color lengths by 1
      • remove the unnecessary extra character from column definitions
    • define extra colorization:
      • COL_ACTIVE_TIME (C70) for "Uprate or approximate time since last active state" column
      • COL_UNSAFE_DATA (C71) for "Unsafe data" column
      • COL_THROTTLE_CH (C72) for "Throttle" column
      • COL_ETA_TIME (C73) for "ETA/last_xfer" column
  • remove F bindings from ui.find.term, F3 still works
    • F binding is for tempfilter
  • make and (connected peers) built in columns sacrificiable
  • make (message or alert) and (ratio) built-in columns 1 character width (instead of 2)
  • modify (progress) built-in column to take into account partially done downloads
    • don't modify corresponding colorizing, so it can be clear which downloads are only partially done
  • remove spacer between Name and Flagged columns
  • remove deprecated ui.style.progress and ui.style.ratio commands
  • remove (again) the seemingly unnecessary/buggy Canvas::cleanup() call

F. Fixes:

  • fix endless loop in ui_find_next() when no download is selected and term couldn't be find

G. Others:

  • update color schemes in contrib directory

Big thanks to @pyroscope for his work!

@pyroscope: your changes are freeking awesome! Thanks! I like the auto sacrifitial columns, the extra color defs, the find feature is just amazing :)

I modified a bit, the changes are small (there're couple of revert commits as well :) ), please go through it (apart from the first big commit). These are the important ones:

  • chop column title as well (not just column content)
  • auto-add +1 character at "Advance position" (shorten column/color lengths by 1, remove the unnecessary extra character from column definitions)
    • it's not just a cosmetic change: e.g. we can get rid of 1 math command from progress and ratio columns, and we don't have to use extra commands (e.g. string.substr) for columns that contain variable lenght text (e.g. data dir)
  • fix ^F binding for 'find' input (the override didn't work in 0.9.7 for whatever reason)
  • I added 2 new commands as well :)

Maybe I'll change the column order and/or color definitions (I'm not sure yet), but I won't change anything else logic wise.