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

linenum-based hint forwards incorrect filename to program, with extra characters and newlines #5170

Closed
1 task done
aisamu opened this issue Jun 4, 2022 · 0 comments
Closed
1 task done
Labels

Comments

@aisamu
Copy link

aisamu commented Jun 4, 2022

Describe the bug
linenum-based hint forwards incorrect filename to program, with extra characters and newlines

To Reproduce

Given an arbitrary Node stacktrace output:

Trace: Called something
    at Object.<anonymous> (/Users/unimportant/unimportant/unimportant/node/unimportant/node_modules/@unimportant/unimportant/dist/browserClient.js:26714:9)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/unimportant/unimportant/unimportant/node/unimportant/node_modules/@unimportant/unimportant2/dist/index.js:58:21)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.@unimportant/dls (/Users/unimportant/unimportant/unimportant/node/unimportant/.next/server/pages/members.js:263:18)
    at __webpack_require__ (/Users/unimportant/unimportant/unimportant/node/unimportant/.next/server/webpack-runtime.js:33:42)
    at eval (webpack-internal:///./src/components/layout.tsx:7:68)
    at Object../src/components/layout.tsx (/Users/unimportant/unimportant/unimportant/node/unimportant/.next/server/pages/members.js:165:1)
    at __webpack_require__ (/Users/unimportant/unimportant/unimportant/node/unimportant/.next/server/webpack-runtime.js:33:42)
    at eval (webpack-internal:///./src/pages/members.tsx:10:76)

When I use the "insert-file-path" hint (kitty_mod+p>f), I get as a result (for the first detected match):

/Users/unimportant/unimportant/unimportant/node/unimportant/node_modules/@unimportant/unimportant/dist/browserClient.js:26714:9

That's perfect, working even when the terminal is narrow and the path spans multiple lines!

If I instead use a linenum-based hint, such as the one shown on the manual:

map ctrl+g kitten hints --type=linenum --linenum-action=tab vim +{line} {path}

Kitty includes two "incorrect" things when invoking vim:

  • ( as part of the path
  • Terminal newlines (^M) as part of the path when the match spans multiple lines

The complete invocation looks like (e.g.):

vim +26714 '(/Users/unimportant/unimportant/unimpor^Mtant/node/unimportant/node_modules/@unimportant/unimportant/dist/^MbrowserClient.js'

Environment details

kitty 0.25.1 created by Kovid Goyal
Darwin aisambp-stedi 20.6.0 Darwin Kernel Version 20.6.0: Tue Feb 22 21:10:41 PST 2022; root:xnu-7195.141.26~1/RELEASE_X86_64 x86_64
ProductName:    macOS ProductVersion:   11.6.5 BuildVersion:    20G527
Frozen: False
Paths:
  kitty: /nix/store/r8d55qdacv9mqk78sixkvql2xbfzwi7x-kitty-0.25.1/Applications/kitty.app/Contents/MacOS/kitty
  base dir: /nix/store/r8d55qdacv9mqk78sixkvql2xbfzwi7x-kitty-0.25.1/Applications/kitty.app/Contents/Resources/kitty
  extensions dir: /nix/store/r8d55qdacv9mqk78sixkvql2xbfzwi7x-kitty-0.25.1/Applications/kitty.app/Contents/Resources/kitty/kitty
  system shell: /bin/zsh
Loaded config files:
  /Users/aisamu/.config/kitty/kitty.conf

Config options different from defaults:
bold_font            Iosevka Bold
bold_italic_font     Iosevka Bold Italic
copy_on_select       clipboard
font_family          Iosevka Medium
font_size            14.0
italic_font          Iosevka Medium Italic
Added shortcuts:
        cmd+o → kitten hints --type=linenum --linenum-action=tab vim +{line} {path}
[colors...]

Important environment variables seen by the kitty process:
        PATH                                /nix/store/r8d55qdacv9mqk78sixkvql2xbfzwi7x-kitty-0.25.1/Applications/kitty.app/Contents/MacOS:/usr/bin:/bin:/usr/sbin:/sbin
        LANG                                en_US.UTF-8
        SHELL                               /bin/zsh
        USER                                aisamu
        LC_CTYPE                            UTF-8

Additional context

  • Try to reproduce the problem with kitty --config NONE
    • kitty --config NONE -o 'map super+o kitten hints --type=linenum --linenum-action=tab vim +{line} {path}'

Thanks for writing Kitty.
It's tremendous!

@aisamu aisamu added the bug label Jun 4, 2022
kovidgoyal added a commit that referenced this issue Jun 5, 2022
…eturns not being removed when using line number processing

Fixes #5170
kovidgoyal added a commit that referenced this issue Jun 5, 2022
…eturns not being removed when using line number processing

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

No branches or pull requests

1 participant