kufii / CodeSnap

📸 Take beautiful screenshots of your code in VS Code!
https://marketplace.visualstudio.com/items?itemName=adpyke.codesnap
508 stars 67 forks source link

Event error when click shutter buttom #103

Open shihbas opened 2 years ago

shihbas commented 2 years ago

Hi guys,

Now, I want share the beautiful code image to other peer. but the plugin not work in my vscode.

Can you help me to fix the issue?

截屏2022-04-23 23 42 19

My vscode:

version: 1.66.2 commit : dfd34e8260c270da74b5c2d86d61aee4b6d56977 date: 2022-04-11T07:49:20.994Z Electron: 17.2.0 Chromium: 98.0.4758.109 Node.js: 16.13.0 V8: 9.8.177.11-electron.0 OS: Darwin x64 21.3.0


CodeSnap version : 1.3.4


Looking forward to your reply.

thank you

shihbas commented 2 years ago

I 'm not sure, whether the issue relating my code format. My code is fail json format.

TG-Techie commented 2 years ago

I am also experiencing this error. I've tried it on several pieces of code and think I found a cause: the content of the window.

It is specifically (at least) %XX that seems to break it, where XX is two hex digits, %f does work.

Recreation

screenshotting the below with c/cpp tools in the c language

void set_ratio_text(double ratio) {
    char message[]      = "Compression ratio: %0f";
    float rounded_ratio = ((int)(ratio * 100)) / 100;
    snprintf(char_overlay_dest, strlen(message), message, rounded_ratio);
}

causes the flash to fail and code snap to copy the selected code to the buffer, but changing it to below changes it.

void set_ratio_text(double ratio) {
    char message[]      = "Compression ratio: %0d";
    float rounded_ratio = ((int)(ratio * 100)) / 100;
    snprintf(char_overlay_dest, strlen(message), message, rounded_ratio);
}

%0d adds a newline to the rendered dom but successfully completes.

symptoms

When the screenshot fails the flash action fails and leaves the container background dark.

system info

codesnap: v1.3.4

Version: 1.66.2 Commit: dfd34e8260c270da74b5c2d86d61aee4b6d56977 Date: 2022-04-11T07:49:20.994Z (2 wks ago) Electron: 17.2.0 Chromium: 98.0.4758.109 Node.js: 16.13.0 V8: 9.8.177.11-electron.0 OS: Darwin x64 21.4.0

Succesful Screenshot

image

capture of failed screenshot

Screen Shot 2022-05-01 at 01 02 48

https://user-images.githubusercontent.com/39284876/166132944-127248db-e6da-4b75-b47b-010e665861a8.mp4

Image of Error

Screen Shot 2022-05-01 at 00 49 08