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

FocusLost, ERROR: ArgumentError: invalid JSON #20

Closed
oheil opened this issue Mar 25, 2024 · 2 comments
Closed

FocusLost, ERROR: ArgumentError: invalid JSON #20

oheil opened this issue Mar 25, 2024 · 2 comments

Comments

@oheil
Copy link

oheil commented Mar 25, 2024

TerminalUserInterfaces v0.8.0
Julia Version 1.10.2 REPL
Windows-Terminal Version: 1.19.10573.0
Windows 11

Just Copy&Paste of example code
https://github.com/kdheepak/TerminalUserInterfaces.jl/blob/main/examples/list.jl
into REPL opens up the list menu fine.
Now changing the window focus to some other window, the TUI menu crashes with:

julia> main()
ERROR: ArgumentError: invalid JSON at byte position 1 while parsing type JSON3.Object: ExpectedOpeningObjectChar
"FocusLost"

Stacktrace:
  [1] invalid(error::JSON3.Error, buf::Base.CodeUnits{UInt8, String}, pos::Int64, T::Type)
    @ JSON3 C:\Users\oheil\.julia\packages\JSON3\jSAdy\src\JSON3.jl:30
  [2] #read#43
    @ C:\Users\oheil\.julia\packages\JSON3\jSAdy\src\structs.jl:429 [inlined]
  [3] read
    @ C:\Users\oheil\.julia\packages\JSON3\jSAdy\src\structs.jl:353 [inlined]
  [4] read
    @ C:\Users\oheil\.julia\packages\JSON3\jSAdy\src\structs.jl:350 [inlined]
  [5] read(str::String, ::Type{Dict}; jsonlines::Bool, kw::@Kwargs{})
    @ JSON3 C:\Users\oheil\.julia\packages\JSON3\jSAdy\src\structs.jl:41
  [6] read
    @ C:\Users\oheil\.julia\packages\JSON3\jSAdy\src\structs.jl:33 [inlined]
  [7] read()
    @ Crossterm C:\Users\oheil\.julia\packages\Crossterm\IcBlh\src\Crossterm.jl:384
  [8] #try_get_event#19
    @ C:\Users\oheil\.julia\packages\TerminalUserInterfaces\eHCFe\src\terminal.jl:48 [inlined]
  [9] try_get_event
    @ C:\Users\oheil\.julia\packages\TerminalUserInterfaces\eHCFe\src\terminal.jl:46 [inlined]
 [10] (::TerminalUserInterfaces.var"#54#55"{Float64, Model})()
    @ TerminalUserInterfaces C:\Users\oheil\.julia\packages\TerminalUserInterfaces\eHCFe\src\app.jl:37
 [11] tui(f::TerminalUserInterfaces.var"#54#55"{Float64, Model}; flags::@Kwargs{})
    @ TerminalUserInterfaces C:\Users\oheil\.julia\packages\TerminalUserInterfaces\eHCFe\src\terminal.jl:262
 [12] tui
    @ C:\Users\oheil\.julia\packages\TerminalUserInterfaces\eHCFe\src\terminal.jl:258 [inlined]
 [13] #app#53
    @ C:\Users\oheil\.julia\packages\TerminalUserInterfaces\eHCFe\src\app.jl:31 [inlined]
 [14] app
    @ C:\Users\oheil\.julia\packages\TerminalUserInterfaces\eHCFe\src\app.jl:30 [inlined]
 [15] main()
    @ Main .\REPL[9]:3
 [16] top-level scope
    @ REPL[10]:1
julia>

@kdheepak
Copy link
Owner

Thanks for reporting.

The problem seems to be happening on this line: https://github.com/kdheepak/Crossterm.jl/blob/a11dca250f5c945f8f2803d74ee504e59ececb70/src/Crossterm.jl#L384

I'm not able to replicate with iTerm2 on MacOS.

@kdheepak
Copy link
Owner

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

No branches or pull requests

2 participants