Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Character drifts in my REPL when using OhMyREPL and v1.9-rc1's IPython mode together #313

Closed
singularitti opened this issue Mar 22, 2023 · 10 comments · Fixed by #323
Closed

Comments

@singularitti
Copy link

If I use OhMyREPL (after switching to JuliaSyntax) and v1.9-rc1's IPython mode together, I have the following character drifting problem:

image

In this figure, there are no characters between the end and the cursor, but the cursor looks like there is a space. Also, the end has shifted one character left. No matter whether I press tab or 4 spaces.

image

In this figure, there also looks like a space exists between et and the cursor, where there is actually none.

image

This is especially a nightmare if you have a multiline function and have parenthesis in your code; also, when deleting things, it could get wrong.

I notice that this behavior only happens when you have a multiline expression to type (or paste). While in single-line expressions, it does not happen.

julia> versioninfo()
Julia Version 1.9.0-rc1
Commit 3b2e0d8fbc1 (2023-03-07 07:51 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin21.4.0)
  CPU: 16 × Intel(R) Xeon(R) W-2140B CPU @ 3.20GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, skylake-avx512)
  Threads: 1 on 16 virtual cores

I am reporting from an Intel mac here, but it happens both on my Intel and Apple Silicon macs, both in iTerm.app and default Terminal.app.

@KristofferC
Copy link
Owner

Interesting, I'll see if I can repro it.

@KristofferC KristofferC pinned this issue Mar 22, 2023
@KristofferC KristofferC unpinned this issue Mar 22, 2023
@singularitti
Copy link
Author

My settings are:

using OhMyREPL
colorscheme!("Monokai16")
enable_autocomplete_brackets(false)

using REPL
atreplinit() do repl
    if !isdefined(repl, :interface)
        repl.interface = REPL.setup_interface(repl)
    end
    REPL.ipython_mode!(repl)
end

@singularitti
Copy link
Author

Hi, is it reproducible?

@KristofferC
Copy link
Owner

Yes

@singularitti
Copy link
Author

May I ask what might cause this? Could it be fixed?

@KristofferC
Copy link
Owner

Well I don't know what causes it. And I don't know why the IPython mode specifically would cause it either.

@PhyX-Meow
Copy link

PhyX-Meow commented Apr 20, 2023

I notice that original prompt julia> has length 6, while in numbered mode, it is In [1]> with length 7. So I guess there is somewhere a hardcoded prompt length causing the shift. As you see in numbered mode, for 2 digit numbers, the shift will become 2 character long.
image

@PhyX-Meow
Copy link

function untokenize_with_ANSI(io::IO, crayons::Vector{Crayon}, tokens::Vector{Token}, str, indent = 7)

Here maybe?

@KristofferC
Copy link
Owner

Nice detective work. Can it be that easy? I'll check it out.

@singularitti
Copy link
Author

singularitti commented May 15, 2023

It seems to work for me. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants