def _get_selected_arg(view, com_reg, pos):
 args = com_reg.group('args')
 if (',' not in args):
  return args
 args_region = com_reg.regs[COMMAND_REG.groupindex['args']]
 cursor = (pos - args_region[0])
 if ((cursor < 0) or (len(args) < cursor)):
  message = 'Selection to vague. Directly click on the name inside the command.'
  print message
  sublime.status_message(message)
  return
 before = args[:cursor]
 after = args[cursor:]
 start_before = (before.rfind(',') + 1)
 end_after = after.find(',')
 if (end_after == (-1)):
  end_after = len(after)
 arg = (before[start_before:] + after[:end_after])
 arg = arg.strip()
 return arg

def _get_selected_arg ( view , com_reg , pos ) : args = com_reg . group ( 'args' ) if ( ',' not in args ) : return args args_region = com_reg . regs [ COMMAND_REG . groupindex [ 'args' ] ] cursor = ( pos - args_region [ 0 ] ) if ( ( cursor < 0 ) or ( len ( args ) < cursor ) ) : message = 'Selection to vague. Directly click on the name inside the command.' print message sublime . status_message ( message ) return before = args [ : cursor ] after = args [ cursor : ] start_before = ( before . rfind ( ',' ) + 1 ) end_after = after . find ( ',' ) if ( end_after == ( - 1 ) ) : end_after = len ( after ) arg = ( before [ start_before : ] + after [ : end_after ] ) arg = arg . strip ( ) return arg
retrieves the selected argument in a comma separated list .