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

No syntax highlighting in preview on global search #4956

Closed
xJonathanLEI opened this issue Dec 1, 2022 · 6 comments · Fixed by #9647
Closed

No syntax highlighting in preview on global search #4956

xJonathanLEI opened this issue Dec 1, 2022 · 6 comments · Fixed by #9647
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug

Comments

@xJonathanLEI
Copy link
Contributor

Summary

The global search picker fails to show syntax highlighting when it's first shown. It works fine after navigating through the items.

Reproduction Steps

I tried this:

  1. Set up the file and open Helix:
    $ mkdir preview-bug && cd preview-bug
    $ printf "const a = 1;\nconst b = 2;\n" > test.ts
    $ hx -c /dev/null .
    
  2. Quit the initial file picker: <ESC>
  3. Do a global search: <SPACE>/const<ENTER>

I expected this to happen:

The file content on the preview is properly highlighted (after the idle timeout).

Instead, this happened:

The preview is not highlighted.

Helix log

~/.cache/helix/helix.log
2022-12-01T16:00:47.682 helix_loader [DEBUG] Located configuration folders: []
2022-12-01T16:00:47.690 helix_view::clipboard [DEBUG] Using tmux to interact with the system clipboard
2022-12-01T16:00:47.691 globset [DEBUG] glob converted to regex: Glob { glob: "*.{zip,gz,bz2,zst,lzo,sz,tgz,tbz2,lz,lz4,lzma,lzo,z,Z,xz,7z,rar,cab}", re: "(?-u)^[^/]*\\.(cab|rar|7z|xz|Z|z|lzo|lzma|lz4|lz|tbz2|tgz|sz|lzo|zst|bz2|gz|zip)$", opts: GlobOptions { case_insensitive: false, literal_separator: true, backslash_escape: true }, tokens: Tokens([ZeroOrMore, Literal('.'), Alternates([Tokens([Literal('c'), Literal('a'), Literal('b')]), Tokens([Literal('r'), Literal('a'), Literal('r')]), Tokens([Literal('7'), Literal('z')]), Tokens([Literal('x'), Literal('z')]), Tokens([Literal('Z')]), Tokens([Literal('z')]), Tokens([Literal('l'), Literal('z'), Literal('o')]), Tokens([Literal('l'), Literal('z'), Literal('m'), Literal('a')]), Tokens([Literal('l'), Literal('z'), Literal('4')]), Tokens([Literal('l'), Literal('z')]), Tokens([Literal('t'), Literal('b'), Literal('z'), Literal('2')]), Tokens([Literal('t'), Literal('g'), Literal('z')]), Tokens([Literal('s'), Literal('z')]), Tokens([Literal('l'), Literal('z'), Literal('o')]), Tokens([Literal('z'), Literal('s'), Literal('t')]), Tokens([Literal('b'), Literal('z'), Literal('2')]), Tokens([Literal('g'), Literal('z')]), Tokens([Literal('z'), Literal('i'), Literal('p')])])]) }
2022-12-01T16:00:47.691 globset [DEBUG] built glob set; 0 literals, 0 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 1 regexes
2022-12-01T16:00:47.691 helix_term::ui [DEBUG] file_picker init 633.02µs
2022-12-01T16:00:47.691 mio::poll [TRACE] registering event source with poller: token=Token(0), interests=READABLE | WRITABLE
2022-12-01T16:00:47.691 mio::poll [TRACE] registering event source with poller: token=Token(1), interests=READABLE | WRITABLE
2022-12-01T16:00:47.691 mio::poll [TRACE] registering event source with poller: token=Token(0), interests=READABLE
2022-12-01T16:00:47.691 mio::poll [TRACE] registering event source with poller: token=Token(1), interests=READABLE
2022-12-01T16:00:47.691 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-01T16:00:48.091 helix_term::application [DEBUG] received editor event: IdleTimer
2022-12-01T16:00:48.144 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-01T16:00:48.833 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-01T16:00:49.234 helix_term::application [DEBUG] received editor event: IdleTimer
2022-12-01T16:00:49.656 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-01T16:00:50.057 helix_term::application [DEBUG] received editor event: IdleTimer
2022-12-01T16:00:50.216 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-01T16:00:50.618 helix_term::application [DEBUG] received editor event: IdleTimer
2022-12-01T16:00:50.736 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-01T16:00:50.824 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-01T16:00:50.886 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-01T16:00:50.999 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-01T16:00:51.075 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-01T16:00:51.644 grep_regex::matcher [TRACE] final regex: "[Cc][Oo][Nn][Ssſ][Tt]"
2022-12-01T16:00:51.644 grep_searcher::searcher [TRACE] Some("/home/dev/repos/preview-bug/test.ts"): searching using generic reader
2022-12-01T16:00:51.644 grep_searcher::searcher [TRACE] generic reader: searching via roll buffer strategy
2022-12-01T16:00:51.644 grep_searcher::searcher::core [TRACE] searcher core: will use fast line searcher
2022-12-01T16:00:51.645 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-01T16:00:51.645 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-01T16:00:54.951 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-01T16:00:55.352 helix_term::application [DEBUG] received editor event: IdleTimer
2022-12-01T16:00:55.687 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-01T16:00:55.956 helix_term::commands::typed [DEBUG] quitting...
2022-12-01T16:00:55.956 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-01T16:00:56.088 helix_term::application [DEBUG] received editor event: IdleTimer
2022-12-01T16:00:56.111 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-01T16:00:56.198 helix_term::job [DEBUG] waiting on jobs...
2022-12-01T16:00:56.198 helix_view::document [DEBUG] id 1 modified - last saved: 0, current: 0
2022-12-01T16:00:56.198 helix_term::job [DEBUG] waiting on jobs...
2022-12-01T16:00:56.199 mio::poll [TRACE] deregistering event source from poller
2022-12-01T16:00:56.199 mio::poll [TRACE] deregistering event source from poller

Platform

Linux

Terminal Emulator

tmux 3.3a

Helix Version

22.08.1-526-g67415e09

@xJonathanLEI xJonathanLEI added the C-bug Category: This is a bug label Dec 1, 2022
@xJonathanLEI
Copy link
Contributor Author

xJonathanLEI commented Dec 1, 2022

asciinema recording:

asciicast

Note how the highlighting only starts after navigating through the items.

@the-mikedavis
Copy link
Member

I think I've seen this happen with the file picker as well: the idle-timeout event races with the opening of the picker so it doesn't trigger the highlighting of the current selection when the idle-timeout comes first. Hitting up/down (or others) to change the selection highlights the file because the idle-timeout event is emitted again

@the-mikedavis the-mikedavis added the A-helix-term Area: Helix term improvements label Dec 1, 2022
@xJonathanLEI
Copy link
Contributor Author

I've experienced the file picker issue as well. Looked into the source before and found that highlighting only triggers once if it finishes before idle timeout. But I feel like these are two different issues, despite the similar behavior. Will look a bit into this :)

@archseer
Copy link
Member

archseer commented Dec 2, 2022

What's your idle-timeout setting?

@xJonathanLEI
Copy link
Contributor Author

The recording uses -c /dev/null so it's the default settings. I've also tried other higher values and it's the same.

@archseer
Copy link
Member

archseer commented Dec 2, 2022

I think the solution would be to reset the idle-timer any time a new layer is pushed onto the compositor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug
Projects
None yet
3 participants