# REPL, copy/paste and auto indent in julia 0.7

**URL:** <https://discourse.julialang.org/t/repl-copy-paste-and-auto-indent-in-julia-0-7/10230>\
**Category:** General Usage\
**Tags:** repl\
**Created:** [April 8, 2018, 1:42pm UTC](https://discourse.julialang.org/t/repl-copy-paste-and-auto-indent-in-julia-0-7/10230 "2018-04-08T13:42:03Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![rfourquet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rfourquet/32/3610_2.png) [@rfourquet](https://discourse.julialang.org/u/rfourquet)\
**Post date:** [October 5, 2018, 10:05am UTC](https://discourse.julialang.org/t/repl-copy-paste-and-auto-indent-in-julia-0-7/10230/11 "2018-10-05T10:05:20Z")

</div>

OK, I found a patch which makes it much more reliable for me: compared to the PR code, in the `edit_insert_newline` function, exchange the order of the last two lines, i.e. change it to:

```julia
     refresh_line(s)
     align > 0 && (s.last_newline = time())￼

```

You don’t need to recompile the whole Julia to change that, you can overwrite the function with:

```julia
import REPL
import REPL.LineEdit: edit_insert, options, buffer, position, char_move_left, char_move_right, edit_splice!, push_undo, edit_insert, prompt_string, beginofline, terminal, refresh_line, PromptState, width, edit_insert_newline, _notspace, _newline

function edit_insert_newline(s::PromptState, align::Int = 0 - options(s).auto_indent)
    push_undo(s)
    buf = buffer(s)
    if align < 0
        beg = beginofline(buf)
        align = min(something(findnext(_notspace, buf.data[beg+1:buf.size], 1), 0) - 1,
                    position(buf) - beg) # indentation must not increase
        align < 0 && (align = buf.size-beg)
    end
    edit_insert(buf, '\n' * ' '^align)
    refresh_line(s)
    align > 0 && (s.last_newline = time())
end

```

---

_[View the full topic](https://discourse.julialang.org/t/repl-copy-paste-and-auto-indent-in-julia-0-7/10230)._
