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

Linebreaks introduced in long lines when selecting text #874

Closed
dev-zero opened this issue Jun 14, 2021 · 5 comments
Closed

Linebreaks introduced in long lines when selecting text #874

dev-zero opened this issue Jun 14, 2021 · 5 comments
Labels
bug Something isn't working fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds.

Comments

@dev-zero
Copy link

Describe the bug

When copying very long lines I get artificial line breaks inserted at wrong places.

Environment (please complete the following information):

  • OS: Linux Wayland
  • Version: wezterm 20210502-154244-3f7122cb
  • The active keyboard layout name (eg: ENG, DEU and so on): US

To Reproduce

Steps to reproduce the behavior.

I select some very long content and then yank it with the middle-mouse, or I copy it with ctrl+shift+c and then paste it with ctrl+shift+v somewhere else then I get additional line breaks in the pasted output.

Example:

gcc -march=znver2 -shared -fPIC -D__CRAY_X86_ROME -D__CRAYXT_COMPUTE_LINUX_TARGET -D__TARGET_LINUX__ -march=znver2 -mtune=znver2 -I/opt/cray/pe/libsci/21.04.1.1/GNU/9.1/x86_64/include -L/opt/cray/pe/mpich/8.1.4/ofi/gnu/9.1/lib -L/opt/cray/pe/libsci/21.04.1.1/GNU/9.1/x86_64/lib -L/opt/cray/pe/dsmml/0.1.4/dsmml//lib -L/opt/cray/xpmem/2.2.40-7.0.1.0_1.9__g1d7a24d.shasta/lib64 -L/opt/gcc/10.2.0/snos/lib/gcc/x86_64-suse-linux/10.2.0 -L/opt/gcc/10.2.0/snos/lib/gcc/x86_64-suse-linux/10.2.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/opt/gcc/10.2.0/snos/lib/gcc/x86_64-suse-linux/10.2.0/../../.. -L/opt/cray/pe/libsci/21.04.1.1/GNU/9.1/x86_64/lib -Wl,--disable-new-dtags -Wl,-rpath,/project/d110/timuel/spack/opt/spack/cray-sles15-zen2/gcc-10.2.0/amdlibflame-3.0-gvcr5zajxoq6blmvecoirkvtz7acnvno/lib -Wl,-rpath,/project/d110/timuel/spack/opt/spack/cray-sles15-zen2/gcc-10.2.0/amdlibflame-3.0-gvcr5zajxoq6blmvecoirkvtz7acnvno/lib64 -Wl,-rpath,/opt/cray/pe/libsci/21.04.1.1/GNU/9.1/x86_64/lib -Wl,-rpath,/opt/gcc/10.2.0/snos/lib/gcc/x86_64-suse-linux/10.2.0 -Wl,-rpath,/opt/gcc/10.2.0/snos/lib64 -o lib/x86_64-unknown-linux-gnu/libflame.so -Wl,-soname,libflame.so.3 -Wl,--whole-archive libflame.a -Wl,--no-whole-archive -lsci_gnu_mpi_mp -lsci_gnu_mp -lsci_gnu_82_mpi -lsci_gnu_82 -ldl -lmpifort_gnu_91 -lmpi_gnu_91 -lxpmem -ldsmml -lgfortran -lquadmath -lpthread -lm -fopenmp -I/opt/cray/pe/mpich/8.1.4/ofi/gnu/9.1/include -I/opt/cray/pe/libsci/21.04.1.1/GNU/9.1/x86_64/include -I/opt/cray/pe/dsmml/0.1.4/dsmml//include -I/opt/cray/xpmem/2.2.40-7.0.1.0_1.9__g1d7a24d.shasta/include -L/opt/cray/pe/mpich/8.1.4/ofi/gnu/9.1/lib -L/opt/cray/pe/libsci/21.04.1.1/GNU/9.1/x86_64/lib -L/opt/cray/pe/dsmml/0.1.4/dsmml//lib -L/opt/cray/xpmem/2.2.40-7.0.1.0_1.9__g1d7a24d.shasta/lib64 -Wl,--as-needed,-lsci_gnu_82_mpi_mp,--no-as-needed -Wl,--as-needed,-lsci_gnu_82_mp,--no-as-needed -ldl -Wl,--as-needed,-lmpi_gnu_91,--no-as-needed -lxpmem -Wl,--as-needed,-ldsmml,--no-as-needed -Wl,--as-needed,-lgfortran,-lquadmath,--no-as-needed -Wl,--as-needed,-lmvec,--no-as-needed -Wl,--as-needed,-lm,--no-as-needed -Wl,--as-needed,-lpthread,--no-as-needed

becomes after the paste:

gcc -march=znver2 -shared -fPIC -D__CRAY_X86_ROME -D__CRAYXT_COMPUTE_LINUX_TARGET -D__TARGET_LINUX__ -march=znver2 -mtune=znver2 -I/opt/cray/pe/libsci/21.04.1.1/GNU/9.1/x86_64/include -L/opt/cray/pe/mpich/8.1.4/ofi/gnu/9.1/lib -L/opt/cray/pe/libsci/21.04.1.1/GNU/9.1/x86_64/lib -L/opt/cray/pe/dsmml/0.1.4/dsmml//lib -L/opt/cray/xpmem/2.2.40-7.0.1.0_1.9__g1d7a24d.shasta/lib64 -L/opt/gcc/10.2.0/snos/lib/gcc/x86_64-suse-linux/10.2.0 -L/opt/gcc/10.2.0/snos/lib/gcc/x86_64-suse-linux/10.2.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/opt/gcc/10.2.0/snos/lib/gcc/x86_64-suse-linux/10.2.0/../../.. -L/opt/cray/pe/libsci/21.04.1.1/GNU/9.1/x86_64/lib -Wl,--disable-new-dtags -Wl,-rpath,/project/d110/timuel/spack/opt/spack/cray-sles15-zen2/gcc-10.2.0/amdlibflame-3.0-gvcr5zajxoq6blmvecoirkvtz7acnvno/lib -Wl,-rpath,/project/d110/timuel/spack/opt/spack/cray-sles15-zen2/gcc-10.2.0/amdlibflame-3.0-gvcr5zajxoq6blmvecoirkvtz7acnvno/lib64 -Wl,-rpath,/opt/cray/pe/libsci/21.04.1.1/GNU/9.1/x86_64/lib -Wl,-rpath,/opt/gcc/10.2.0/snos/lib/gcc/x86_64-suse-linux/10.2.0 -Wl,-rpath,/opt/gcc/10.2.0/snos/lib64 -o lib/x86_64-unknown-linux-gnu/libflame.so -Wl,-soname,libflame.so.3
-Wl,--whole-archive
libflame.a -Wl,--no-whole-archive -lsci_gnu_mpi_mp -lsci_gnu_mp -lsci_gnu_82_mpi -lsci_gnu_82 -ldl -lmpifort_gnu_91 -lmpi_gnu_91 -lxpmem -ldsmml -lgfortran -lquadmath -lpthread -lm -fopenmp -I/opt/cray/pe/mpich/8.1.4/ofi/gnu/9.1/include -I/opt/cray/pe/libsci/21.04.1.1/GNU/9.1/x86_64/include -I/opt/cray/pe/dsmml/0.1.4/dsmml//include -I/opt/cray/xpmem/2.2.40-7.0.1.0_1.9__g1d7a24d.shasta/include -L/opt/cray/pe/mpich/8.1.4/ofi/gnu/9.1/lib -L/opt/cray/pe/libsci/21.04.1.1/GNU/9.1/x86_64/lib -L/opt/cray/pe/dsmml/0.1.4/dsmml//lib -L/opt/cray/xpmem/2.2.40-7.0.1.0_1.9__g1d7a24d.shasta/lib64 -Wl,--as-needed,-lsci_gnu_82_mpi_mp,--no-as-needed -Wl,--as-needed,-lsci_gnu_82_mp,--no-as-needed -ldl -Wl,--as-needed,-lmpi_gnu_91,--no-as-needed -lxpmem -Wl,--as-needed,-ldsmml,--no-as-needed -Wl,--as-needed,-lgfortran,-lquadmath,--no-as-needed -Wl,--as-needed,-lmvec,--no-as-needed -Wl,--as-needed,-lm,--no-as-needed -Wl,--as-needed,-lpthread,--no-as-needed

Resizing the window does a correct reflow and shows that there's no linebreak in the original output (depending on the window width the linebreak changes position)

Configuration

local wezterm = require 'wezterm';
return {
  font = wezterm.font("Hack Nerd Font"),
  font_size = 10,
  color_scheme = "OneHalfDark",
  keys = {
    {key="DownArrow", mods="SHIFT", action=wezterm.action{SpawnTab="CurrentPaneDomain"}},
    {key="LeftArrow", mods="SHIFT", action=wezterm.action{ActivateTabRelative=-1}},
    {key="RightArrow", mods="SHIFT", action=wezterm.action{ActivateTabRelative=1}},
    {key="LeftArrow", mods="SHIFT|CTRL", action=wezterm.action{MoveTabRelative=-1}},
    {key="RightArrow", mods="SHIFT|CTRL", action=wezterm.action{MoveTabRelative=1}},
  }
}

Expected behavior

No line breaks.

@dev-zero dev-zero added the bug Something isn't working label Jun 14, 2021
wez added a commit that referenced this issue Aug 8, 2021
Use the newer logical line method in pane rather than going
via the hyperlink function, so that we can better reason
about physical vs. logical line breaks, and get the results
very slightly faster too.

refs: #874
@wez wez added the fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds. label Aug 8, 2021
@wez
Copy link
Owner

wez commented Aug 8, 2021

I've pushed a commit that seems to make this better; it will show up in the nightly downloads in ~30 minutes from now.
Please give it a try and let me know how you get on!

@wez wez added the waiting-on-op Waiting for more information from the original poster label Aug 8, 2021
@wez wez closed this as completed in 5bfdb88 Aug 11, 2021
@dev-zero
Copy link
Author

@wez will do, thanks a lot!

@no-response no-response bot removed the waiting-on-op Waiting for more information from the original poster label Aug 11, 2021
@no-response no-response bot reopened this Aug 11, 2021
@dev-zero
Copy link
Author

ok, I've tested it with 40cb141 and it looks good now.
What still puzzles me but is probably a different bug, is the selection on triple click: double click on text usually selects a word (depends on the emulator what it considers a word), but a triple click usually selects the complete line while wezterm selects only a part of the line (probably until a given max of chars?). See:

selection

@wez
Copy link
Owner

wez commented Sep 3, 2021

Yeah, this is expected behavior: triple click considers logical lines, but in order to constrain the cost of things like hyperlink rules that operate on logical lines, there is a maximum limit for logical line length. I know this isn't ideal.

As a potential alternative, I wanted to share that I use the configuration snippet shown here:
https://wezfurlong.org/wezterm/config/lua/keyassignment/SelectTextAtMouseCursor.html

together with shell integration also linked in those docs, so that triple click gets me the entire section of text from the input/output semantic zone.

I'm going to close this as the original issue is resolved!

@wez wez closed this as completed Sep 3, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds.
Projects
None yet
Development

No branches or pull requests

2 participants