wezterm icon indicating copy to clipboard operation
wezterm copied to clipboard

get_text_from_semantic_zone eats last line

Open yerlaser opened this issue 7 months ago • 1 comments

What Operating System(s) are you seeing this problem on?

Windows

Which Wayland compositor or X11 Window manager(s) are you using?

No response

WezTerm version

20240203-110809-5046fc22

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

I have enabed shell integration to send the appropriate OSC ANSI sequences and bound the following callback to a keyboard combination:

function(win, pane)
  local zones = pane:get_semantic_zones('Output')
  win:copy_to_clipboard(pane:get_text_from_semantic_zone(zones[#zones]), 'Clipboard')
end

This works in that it copies the output of the last command. However, the last line of the output gets lost. I know that the shell send correct OSC sequences because this mouse binding selects exactly the last command output:

action = wezterm.action.SelectTextAtMouseCursor 'SemanticZone',

This was taken from the documentation.

To Reproduce

Bind below function to a keyboard shortcut.

Configuration

function(win, pane)
  local zones = pane:get_semantic_zones('Output')
  win:copy_to_clipboard(pane:get_text_from_semantic_zone(zones[#zones]), 'Clipboard')
end

Expected Behavior

Should copy the full output of the last command.

Logs

No response

Anything else?

No response

yerlaser avatar Jul 13 '24 08:07 yerlaser