• David Lawrence Ramsey's avatar
    files: revamp the insertion of a file, to be more like pasting text · 86f7bc18
    David Lawrence Ramsey authored
    Move buffer handling and '\r' stripping from read_line() to read_file(),
    so that the file gets its format determined and gets stored in its own
    buffer entirely in one function.  Then use ingraft_buffer() to insert
    this new buffer into the current one.
    
    In addition to pasting the file at current[current_x], ingraft_buffer()
    also deals with renumbering, the updating of totsize, and the handling
    of a magicline, so read_file() doesn't need to do those anymore.
    
    Note that all this makes read_file() depend on the position of
    current[current_x] to know where to insert the file.  Accordingly,
    set current_x to zero in initialize_buffer_text() instead of in
    make_new_buffer(), so that replace_buffer() keeps working properly.
    86f7bc18
proto.h 23.6 KB