# File lib/rbreadline.rb, line 4845
  def rl_insert_text(string)
    string.delete!(0.chr)
    l = string.length
    return 0 if (l == 0)

    if (@rl_end + l >= @rl_line_buffer.length)
      rl_extend_line_buffer(@rl_end + l)
    end
    @rl_line_buffer[@rl_point,0] = string

    # Remember how to undo this if we aren't undoing something.
    if (!@_rl_doing_an_undo)
      # If possible and desirable, concatenate the undos.
      if ((l == 1) &&
          @rl_undo_list &&
          (@rl_undo_list.what == UNDO_INSERT) &&
          (@rl_undo_list.end == @rl_point) &&
          (@rl_undo_list.end - @rl_undo_list.start < 20))
        @rl_undo_list.end+=1
      else
        rl_add_undo(UNDO_INSERT, @rl_point, @rl_point + l, nil)
      end
    end
    @rl_point += l
    @rl_end += l
    if @rl_line_buffer.length <= @rl_end
      @rl_line_buffer << 0.chr * (@rl_end - @rl_line_buffer.length + 1)
    else
      @rl_line_buffer[@rl_end] = "\0"
    end
    l
  end