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

Blinking of text cursor not suspended when moved on nightly Windows #26422

Closed
jaakkor2 opened this issue Mar 12, 2018 · 19 comments
Closed

Blinking of text cursor not suspended when moved on nightly Windows #26422

jaakkor2 opened this issue Mar 12, 2018 · 19 comments
Labels
REPL Julia's REPL (Read Eval Print Loop) system:windows Affects only Windows upstream The issue is with an upstream dependency, e.g. LLVM

Comments

@jaakkor2
Copy link
Contributor

Downloaded from https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe

Julia Version 0.7.0-DEV.4543
Commit 00ac33a3ef* (2018-03-12 04:07 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)

When the cursor is moved on the terminal window (REPL), the cursor disappears until left or right keys are not pressed. Editing a line becomes thus very difficult.

Behavior on 0.6.2 is fine.

Wikipedia describes the wanted behavior nicely https://en.wikipedia.org/wiki/Cursor_(user_interface)

The blinking of the text cursor is usually temporarily suspended when it is being moved; otherwise, the cursor may change position when it is not visible, making its location difficult to follow.

@JeffBezanson JeffBezanson added system:windows Affects only Windows REPL Julia's REPL (Read Eval Print Loop) labels Mar 12, 2018
@jaakkor2
Copy link
Contributor Author

On the same Windows 7 machine, the behavior depends on the shell

  • cmd.exe: bad
  • powershell: bad
  • bash (from git distribution): good

@abobroff
Copy link

abobroff commented Jul 2, 2018

In my case this is problem of Julia-0.7. On Julia-0.6.3 work fine, on cmd.exe, powershell - fine too. My systems: Windows 8.1, 10 - 64 bit.

@rfourquet
Copy link
Member

I don't really understand the problem and can't test it, could you describe a sequence of actions which lead to the problem?

@jaakkor2
Copy link
Contributor Author

jaakkor2 commented Jul 2, 2018

On 64bit Windows 7 for me

  1. Download and install https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-0.7.0-beta-win64.exe
  2. Open julia-0.7-beta
  3. Write something on the prompt, and try to edit it using the cursor keys. The cursor start blinking after about a second I stop editing.
julia> versioninfo()
Julia Version 0.7.0-beta.0
Commit f41b1ecaec (2018-06-24 01:32 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, broadwell)

@jaakkor2
Copy link
Contributor Author

Same problem on Julia v1.0.0

@jaakkor2
Copy link
Contributor Author

Here are two animated gifs showing the difference in behavior on Julia v0.6.4 and v1.0.0 on Windows 7. I tried on an another machine with Windows 10, and there cursor works fine on v1.0.0.

julia064
julia100

@orswan
Copy link

orswan commented Sep 23, 2018

Same problem here on Windows 7 (Julia 1.0.0), and using bash does not help. This is a major, major annoyance...

@oheil
Copy link
Contributor

oheil commented Oct 5, 2018

Problem confirmed on 1.0.* on Windows 7 + 10 with powershell and cmd.exe. Working fine in the cygwin terminal.
Problem: Moving the cursor makes the cursor unvisible until moving stops.
Desirable Behaviour: when moving cursor, make it visible and static (non-blinking) as in the GIFs above shown.

@StefanKarpinski
Copy link
Member

I'm afraid that someone with one of these systems is going to have to do some sleuthing to figure out what's going on here.

@oheil
Copy link
Contributor

oheil commented Oct 5, 2018

I am trying but find it very hard, because using the REPL while debugging the REPL is somehow difficult :-)
Perhaps @rfourquet can give me some hints how he is developing the REPL?

@rfourquet
Copy link
Member

Yes debugging REPL code is tricky! What I do is to have a file that I include in the REPL, which contains functions from REPL code that I want to overwrite (with relevant imports, to avoid adding module qualifications to internal functions).

If I need to print-debug, I simply write to stderr, redirect stderr to a file (e.g. $ julia 2>/tmp/juliaerr.txt) and have tail -f /tmp/juliaerr.txt in another terminal window. To see the debug info as soon as I type something in the REPL, I also need to call flush(stderr). So in the end I duplicated the @show macro to do that for me:

 macro showerr(exs...)
    blk = Expr(:block)
    for ex in exs
        push!(blk.args, :(println(stderr, $(sprint(Base.show_unquoted,ex)*" = "),
                                  repr(begin value=$(esc(ex)) end))))
    end
    push!(blk.args, :(flush(stderr)))
    return blk
end

Now @showerr a b c will do the same as @show a b c but in the error file.

@oheil
Copy link
Contributor

oheil commented Oct 7, 2018

@rfourquet Great advice, thank you!

@jaakkor2
Copy link
Contributor Author

I tried bisecting the issue, but I have trouble compiling versions earlier than March 2018 when I first discovered the issue. Recent versions (v1.0.0 and v1.0.1) compile fine on my system.

@musm
Copy link
Contributor

musm commented Oct 16, 2018

@jaakkor2 can you explain how you are compiling on windows? I can't circumvent the Cygwin linking errors.

@jaakkor2
Copy link
Contributor Author

I just followed https://github.com/JuliaLang/julia/blob/master/README.windows.md
section "Cygwin-to-MinGW cross-compiling".

If I remember correctly, last winter there was a period of time when nightlies were not available for Windows, so maybe building for Windows was then broken.

@oheil
Copy link
Contributor

oheil commented Oct 26, 2018

Finally I was able to find out which change introduced this bug:

Commit f60dd61 libuv: upgrade to v2 master fork

changed the behaviour of the cursor in the REPL.

It would be great if others could try to confirm my finding. For successful windows builds I followed the cygwin cross build path using the appveyor_build.sh script. Details and links are described here:

https://discourse.julialang.org/t/building-julia-1-0-for-windows/15897/4

This build path typically results in errors for sysimg.jl like:

LoadError("sysimg.jl", 517, LoadError("C:\\cygwin64\\home\\oheil\\julia\\usr\\share\\julia\\site\\v0.7\\SharedArrays\\src\\SharedArrays.jl", 20, ArgumentError("Module Printf not found in current path.\nRun `Pkg.add(\"Printf\")` to install the Printf package.")))
*** This error is usually fixed by running `make clean`. If the error persists, try `make cleanall`. ***

This error in SharedArrays.jl can be fixed by changing line
using Printf: @sprintf
to
using Base.Printf: @sprintf

Other similar error messages in other files typically complain about Pkg not in the path, e.g.:

LoadError("sysimg.jl", 520, LoadError("C:\\cygwin64\\home\\oheil\\julia\\usr\\share\\julia\\site\\v0.7\\Test\\src\\Test.jl", 32, LoadError("C:\\cygwin64\\home\\oheil\\julia\\usr\\share\\julia\\site\\v0.7\\InteractiveUtils\\src\\InteractiveUtils.jl", 18, ArgumentError("Module Pkg not found in current path.\nRun `Pkg.add(\"Pkg\")` to install the Pkg package."))))
*** This error is usually fixed by running `make clean`. If the error persists, try `make cleanall`. ***

All these can be fixed by changing line
import Pkg
to
import ..Pkg

To find out the "evil" commit I followed the commit path printed by
git log --pretty=medium --graph
The position I found looks like:

| | | | | |       remove SuiteSparse dependency on Printf
| | | | | |
* | | | | | commit 11c08ad3363561b18938d7cd96755d3afa4f1bc8
| | | | | | Author: Patrick Kofod Mogensen <[email protected]>
| | | | | | Date:   Sun Feb 11 21:25:42 2018 +0100
| | | | | |
| | | | | |     Use JuliaLibm log functions in Main.Math. (#24750)
| | | | | |
* | | | | | commit e59dabe6f66052b2a727fc0f73038766c32a36d3
| | | | | | Author: Steven G. Johnson <[email protected]>
| | | | | | Date:   Sun Feb 11 13:31:57 2018 -0500
| | | | | |
| | | | | |     fix typo in markdown rendering of SVG images (#25987)
| | | | | |
* | | | | |   commit 80a817542210f72aea4b0de207cfa9af51138f7f
|\ \ \ \ \ \  Merge: 53af06c39a f60dd6103c
| | | | | | | Author: Jeff Bezanson <[email protected]>
| | | | | | | Date:   Sat Feb 10 14:43:25 2018 -0500
| | | | | | |
| | | | | | |     Merge pull request #25062 from JuliaLang/jn/libuv-v2
| | | | | | |
| | | | | | |     upgrade API to target libuv 2
| | | | | | |
| * | | | | | commit f60dd6103c1699d08ed1ae30b1a479afe6d731fb
| | | | | | | Author: Jameson Nash <[email protected]>
| | | | | | | Date:   Tue Nov 21 23:21:50 2017 -0500
| | | | | | |
| | | | | | |     libuv: upgrade to v2 master fork
| | | | | | |
| | | | | | |     also make RawFD and WindowsRawSocket valid as ccall types
| | | | | | |     and fix which fd is being passed to `fdio` in `init_stdio`
| | | | | | |
| * | | | | | commit 1971740eea62a18c77a7333d26987b25b353ca49
| | | | | | | Author: Jameson Nash <[email protected]>
| | | | | | | Date:   Fri Nov 24 21:53:28 2017 -0500
| | | | | | |
| | | | | | |     stat: remove global variable
| | | | | | |
* | | | | | |   commit 53af06c39a68c5cb510bb0ee93af0d60d0aff22f
|\ \ \ \ \ \ \  Merge: 231676a934 c8357de64f
| | | | | | | | Author: Katharine Hyatt <[email protected]>
| | | | | | | | Date:   Sat Feb 10 09:00:56 2018 -0800
| | | | | | | |
| | | | | | | |     Merge pull request #25985 from JuliaLang/ksh/tss
| | | | | | | |
| | | | | | | |     testsetify a little more
| | | | | | | |

Commits with working REPL are:

1971740eea62a18c77a7333d26987b25b353ca49 stat: remove global variable
53af06c39a68c5cb510bb0ee93af0d60d0aff22f Merge pull request #25985 from JuliaLang/ksh/tss

Not working REPL starts with commit
f60dd6103c1699d08ed1ae30b1a479afe6d731fb libuv: upgrade to v2 master fork
and is merged further up into
11c08ad3363561b18938d7cd96755d3afa4f1bc8 Use JuliaLibm log functions in Main.Math. (#24750)
From now on the REPL shows the undesired behaviour in this branch and propagates into branches with every merging.

Next steps would be to analyse the changes in libuv.
I would like to ping @vtjnash for comments as I am afraid that my skills are limited to do this right on.

@StefanKarpinski
Copy link
Member

Thanks for investigating this far—that's very helpful!

@jaakkor2
Copy link
Contributor Author

jaakkor2 commented Jan 2, 2019

FWIW, https://julialang-s3.julialang.org/bin/winnt/x64/1.1/julia-1.1.0-rc1-win64.exe still shows problematic behavior on Windows 7.

Compared to v1.0.3, libuv was updated in #30046 , but that did not help here.

@vtjnash vtjnash added the upstream The issue is with an upstream dependency, e.g. LLVM label Jan 2, 2019
@vtjnash
Copy link
Member

vtjnash commented Jan 2, 2019

I've done some testing and noticed that cmd.exe exhibits the same bug. It seems to be happening to other people too (https://answers.microsoft.com/en-us/insider/forum/all/windows-command-prompt-no-more-cursor-blink/182bd563-fd89-422c-b401-63ba106ab3df) including nodejs (nodejs/node#20348)

I believe this should be fixed by microsoft/terminal#269

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REPL Julia's REPL (Read Eval Print Loop) system:windows Affects only Windows upstream The issue is with an upstream dependency, e.g. LLVM
Projects
None yet
Development

No branches or pull requests

9 participants