codesnap.nvim icon indicating copy to clipboard operation
codesnap.nvim copied to clipboard

[Bug] Strange line wrapping and consequent improper needless new lines

Open justDeeevin opened this issue 5 months ago • 3 comments

Codesnap seems to be wrapping text and creating newlines that aren't there, resulting in not all the selected text being included in the screenshot

Here's some example rust code:

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
struct Cli {
    /// Number of threads to use
    #[arg(short, long, default_value_t = 8)]
    threads: usize,
}

Here's what codesnap.nvim is giving me:

Image

This isn't just limited to rust:

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

    home-manager = {
      url = "github:nix-community/home-manager/master";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
Image

My current config:

{
 watermark = "",
 has_breadcrumbs = true,
 has_line_number = true,
 bg_theme = "sea",
 bg_x_padding = 40,
 bg_y_padding = 25,
 code_font_family = "Monaspace Neon",
}

justDeeevin avatar Aug 04 '25 21:08 justDeeevin

@justDeeevin Codesnap.nvim v2.0.0-beta.17 has been released. Could you test whether everything works correctly on beta 17? This version introduces some breaking changes, so it's best to completely uninstall your previous Codesnap.nvim installation and follow the v2 README

mistricky avatar Nov 19 '25 04:11 mistricky

I configure neovim with nixvim, so I have to package this plugin for Nix.

A problem I've encountered is that the plugin tries to download the prebuilt generator library into its source directory at runtime, but fails because the nix store in which its source lives is read-only. My workaround was to download the binary at build time and place it in the correct spot; however, I seem to be putting it in the wrong place.

I tried to inspect the source code to figure out where to put it, but I'm not having an easy time understanding the Lua. Could you tell me the path of the file that the plugin looks for?

justDeeevin avatar Nov 19 '25 20:11 justDeeevin

Ah, nevermind, I seem to have worked it out. Both lua/libs/.version and lua/libs/{os}-{arch}_generator.so need to be present, and the contents of .version have to match the project.version field in project.toml

I should point out that the v2.0.0-beta.17 release's project.version field is incorrectly set to v2.0.0-beta.16.

Anyways, it now seems to be activating fine, but when I run the CodeSnap command, neovim hangs...

justDeeevin avatar Nov 19 '25 20:11 justDeeevin