def line_at_cursor(cell, cursor_pos=0):
 offset = 0
 lines = cell.splitlines(True)
 for line in lines:
  next_offset = (offset + len(line))
  if (next_offset >= cursor_pos):
   break
  offset = next_offset
 else:
  line = ''
 return (line, offset)

def line_at_cursor ( cell , cursor_pos = 0 ) : offset = 0 lines = cell . splitlines ( True ) for line in lines : next_offset = ( offset + len ( line ) ) if ( next_offset >= cursor_pos ) : break offset = next_offset else : line = '' return ( line , offset )
return the line in a cell at a given cursor position used for calling line-based apis that dont support multi-line input .