ref: b9092ff3e9184af107d89ca502ab7e13a5946169
parent: 37318361be56ff0c858aacadb7ab2a7587f9dd79
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Wed Jul 12 18:36:15 EDT 2023
vt: resize only when the window is not hidden (fixes window at top left corner with riow after terminal reset)
--- a/sys/src/cmd/vt/main.c
+++ b/sys/src/cmd/vt/main.c
@@ -893,7 +893,8 @@
void
setdim(int ht, int wid)
{
- int fd;
+ char tmp[128];
+ int n, fd;
if(wid > 0) xmax = wid-1;
if(ht > 0) ymax = ht-1;
@@ -927,11 +928,15 @@
exportsize();
- fd = open("/dev/wctl", OWRITE);
+ fd = open("/dev/wctl", ORDWR);
if(fd >= 0){
ht = (ymax+1) * ftsize.y + 2*INSET + 2*Borderwidth;
wid = (xmax+1) * ftsize.x + ftsize.x + 2*INSET + 2*Borderwidth;
- fprint(fd, "resize -dx %d -dy %d\n", wid, ht);
+ if((n = read(fd, tmp, sizeof(tmp)-1)) < 0)
+ n = 0;
+ tmp[n] = 0;
+ if(strstr(tmp, "hidden") == nil)
+ fprint(fd, "resize -dx %d -dy %d\n", wid, ht);
close(fd);
}
}