[Idea] Set Row Count Between Events As Step Length Shortcut

Here’s a more automatic version. Paste into the main.lua file of trotch.com.test.xrnx

[luabox]
function main()

local rns = renoise.song()

local my_pattern = rns.selected_pattern_index
local my_track = rns.selected_track_index
local my_col = rns.selected_note_column_index
local my_line = rns.selected_line_index
local my_inst = rns.selected_instrument_index

local my_iter = rns.pattern_iterator:lines_in_pattern_track(my_pattern, my_track)
for pos,line in my_iter do
local col = line.note_columns[my_col]
if col and not col.is_empty then
if pos.line < my_line then
my_inst = col.instrument_value + 1
else
break
end
end
end

local start = -1
local finish = -1

my_iter = rns.pattern_iterator:lines_in_pattern_track(my_pattern, my_track)
for pos,line in my_iter do
local col = line.note_columns[my_col]
if col and not col.is_empty then
if pos.line < my_line and col.instrument_value + 1 == my_inst then
start = pos.line
elseif col.instrument_value + 1 == my_inst then
finish = pos.line
break
end
end
end

my_inst = string.upper(string.format("%02x", my_inst - 1))

if start ~= -1 and finish ~= -1 then
rns.transport.edit_step = finish - start
renoise.app():show_status(
"Selected Instrument " … my_inst … “, Edit Step changed to " … (finish - start) … “.”
)
else
renoise.app():show_status(
“Selected Instrument " … my_inst …”, unable to calculate Edit Step!”
)
end

end

renoise.tool():add_keybinding {
name = “Pattern Editor:Edit Step:For Jonas”,
invoke = main
}

renoise.tool():add_menu_entry {
name = “Main Menu:Tools:For Jonas”,
invoke = main
}
[/luabox]

Better? Discuss amongst yourselves and hack away! I’m dropping out for real now :)