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

Added get pixel size process. #45

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

mikoto2000
Copy link
Contributor

I try add get pixel size process.(See: #44)

  • Change recv length to 16 (short x 4(row, col, xpixel, ypixel))
  • Delete the parts that have been overwritten with zeros

Please check it.

image
(rows, cols, xpixel, ypixel)

termsize.py: https://github.com/mikoto2000/sixelPreviewer/blob/master/termsize.py

@Biswa96 Biswa96 merged commit e3ee07a into Biswa96:master Nov 15, 2024
3 checks passed
@mintty
Copy link
Contributor

mintty commented Nov 28, 2024

struct winsize is 8 bytes long, it is wrong to read 16 bytes from the socket. That's why the backend blocks until you feed in 8 more bytes by hitting keys.
After fixing this, the pixel size is properly conveyed and properly reported in various distributions. However, a number of distributions do not support the pixel values anyway.

Please fix the patch and re-release as 0.14. The current release can be deleted.

diff --git a/src/wslbridge2-backend.cpp b/src/wslbridge2-backend.cpp
old mode 100755
new mode 100644
index e3b3ad2..cd81e4a
--- a/src/wslbridge2-backend.cpp
+++ b/src/wslbridge2-backend.cpp
@@ -256,9 +256,9 @@ int main(int argc, char *argv[])
                             s++;
                             len--;
                             // ensure 8 more bytes are loaded for winsize
-                            while (readRet > 0 && len < 16)
+                            while (readRet > 0 && len < 8)
                             {
-                                readRet = recv(ioSockets.inputSock, s + len, 16 - len, 0);
+                                readRet = recv(ioSockets.inputSock, s + len, 8 - len, 0);
                                 if (readRet > 0)
                                 {
                                     len += readRet;

@mikoto2000
Copy link
Contributor Author

@mintty
Thank you for pointing that out, you were right.
The problem of having to press Enter several times has been fixed in my environment.

I will fix this patch and create a Pull Request.

@Biswa96
Copy link
Owner

Biswa96 commented Nov 29, 2024

I have added the fix in v0.13 release.

@mintty
Copy link
Contributor

mintty commented Dec 2, 2024

Thank you, my test packages work fine. Can we have it as a release please?

@Biswa96
Copy link
Owner

Biswa96 commented Dec 2, 2024

v0.13 has the fix, I have re-tagged it (not professional, I know).

@mintty
Copy link
Contributor

mintty commented Dec 2, 2024

Ah, thanks, that's OK.

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

Successfully merging this pull request may close these issues.

3 participants