IT: Home-Home-Home - how to detect Group?

Hi, I’ve really tried to wrangle Home*2 functionality to work nicely with R3. But I’m meeting a few issues. - How would I go about detecting when the cursor is on Group Effect Column - so that I am moved to the first track’s first column, first row inside the group? also, i am not sure i got it right with the Master + Send tracks, I do get the cursor to go up to the first row with the first Home -press, yet when I press Home again, I’m not taken to the first track’s first column first row.

Ideally if I’m on send2, effect column 8 - first Home will take me to effect column 8 first row, second home will take me to effect column 1 first row, and 3rd home will take me to first track first column first row.

Same with Master, same with Group (except with Group, I go from Effect Column 8 to Effect Column 8 First Row, then to Effect Column 1 First Row, then to Group Track 1 First Column First Row, then to first track first row first column.

function homehome()
  local s = renoise.song()
  local song_pos = s.transport.edit_pos
  local selcol = s.selected_note_column_index
  s.transport.follow_player = false
  s.transport.loop_block_enabled=false

-- If on Master or Send-track, detect and go to 1st track
if s.selected_note_column_index==0 and song_pos.line == 1 and s.selected_note_column_index == nil then
s.selected_track_index = 1
s.selected_note_column_index = 1
return else end

-- If Effect-columns chosen, take you to current effect column's first row.
if s.selected_note_column_index==0 and song_pos.line == 1 then
s.selected_note_column_index=1 return else end

if s.selected_note_column_index==0 then 
song_pos.line = 1
s.transport.edit_pos = song_pos
return else end

-- If Song Position Line is already First Line - but Selected Note Column is not 1
-- Then go to Selected Note Column 1 First Line. Return outside of script immediately.
if song_pos.line == 1 and s.selected_note_column_index > 1 then
s.selected_note_column_index = 1
return
else end

-- If Song Position Line is not 1, and Selected Note Column is not 1
-- Then go to Selected Note Column's First Line. Return outside of script immediately.
if (s.selected_note_column_index > 1) then
s.selected_note_column_index = selcol
song_pos.line = 1
s.transport.edit_pos = song_pos 
return
else 
end

  if (song_pos.line > 1) then
    song_pos.line = 1          
    s.transport.edit_pos = song_pos   
      if s.selected_note_column_index==0 then 
      s.selected_effect_column_index=1 
      else s.selected_note_column_index=1
      end
    return    
  end  
-- Go to first track
  if (s.selected_track_index > 1) then
    s.selected_track_index = 1
    s.selected_note_column_index=1
    return
  end
  s.selected_note_column_index=1
end

renoise.tool():add_keybinding {name="Global:Paketti:Impulse Tracker Home *2 behaviour...", invoke = function() homehome() end }

Hi. You should use this:

renoise.song().tracks[renoise.song().selected_track_index].visible_note_columns

to deduce how many visible note columns there are per track. This will fix Master, this will fix Send. and this will fix groups:

-- If on Master or Send-track, detect and go to first effect column.
if s.selected_note_column_index==0 and s.selected_effect_column_index > 1 and song_pos.line == 1 and renoise.song().tracks[renoise.song().selected_track_index].visible_note_columns==0 then
s.selected_effect_column_index = 1
return else end

-- If on Master or Send-track, detect and go to 1st track and first note column.
if s.selected_note_column_index==0 and song_pos.line == 1 and renoise.song().tracks[renoise.song().selected_track_index].visible_note_columns==0 then
s.selected_track_index = 1
s.selected_note_column_index = 1
return else end