Trouble with window height in Lectrote 1.5.3

I’m experiencing an issue where the bottom row in a side grid window is getting cut off (depending on the precise sizing of the Lectrote window.)

Here is code that shows it for me.

"Height" by Arthur DiBianca

Include Basic Screen Effects by Emily Short.
Include Flexible Windows by Jon Ingold.

when play begins:
	open sidewin;

Use no status line.

Table of User Styles (continued)
window	style name	reversed
sidewin	all-styles	false

the sidewin is a text grid g-window spawned by the main window.
the position of sidewin is g-placeright.
the scale method of sidewin is g-fixed-size.
the measurement of sidewin is 10.
	
to setcursor row (R - a number) col (C - a number):
	[corrects a bug in Flexible Windows 15/210811]
	set sidewin cursor to row C column R;
	
rule for refreshing sidewin:
	repeat with R running from 1 to height of sidewin:
		setcursor row R col 1;
		say "[R]";

every turn:
	refresh sidewin;
	
Cave is a room. "The window height is [height of sidewin].".
player is in Cave.

This was in 6L38. (I also tried to compile it in 10.1.2, but I got confused about how to do the window extension stuff.)

I don’t see this.

I put this together using in 6M62, using the extensions in GitHub - i7/extensions at 9.3 . With those, I didn’t need the “setcursor” phrase – I guess that bug was fixed? I currently have this:

rule for refreshing sidewin:
	let H be height of sidewin;
	repeat with R running from 1 to H:
		[setcursor row R col 1;]
		set sidewin cursor to row R column 1;
		say "[R][if R is H]*[end if]";

The point of using H is just to draw a * on the last line, thus making it easier to see which line is the last line.

With that, everything seems to work correctly in Gargoyle and Lectrote.

My compiled game file is at https://eblong.com/zarf/tmp/output.ulx .

I haven’t tested in 6L38. Maybe it’s bugs in earlier versions of the extensions?

Oh, I also deleted the “every turn: refresh sidewin;” rule. That shouldn’t be necessary.

I still see the problem using “output.ulx”. Here are two screen snips:

I’m running Lectrote 1.5.3 in Windows 10.

For what it’s worth, I also observe the cutoff in version 1.4.5, but not in 1.3.4.

1 Like

Aha – For some reason my interpreter was set to Glulxe. This issue seems to occur when Lectrote is set to Glulxe or Git. It does NOT occur when set to Quixe.

Okay, that’s useful.

It’s reminiscent of the floating point number issues we had previously, but I thought those had been fixed.

1 Like

concur with dannii: looks like a rounding-related issue…

Best regards from Italy,
dott. Piergiorgio.

I’m afraid I still can’t reproduce this. I am testing Lectrote 1.5.3 on Windows 11, using Glulxe as the interpreter. The grid window row count is always rounded down, so that a whole number of rows appear (and the last one has an asterisk).

I have tried to match your display preferences by setting the margins to zero and the color theme to “sepia”.

The difference between Windows 10 and 11 really shouldn’t be relevant here, although I guess anything is possible with Windows.

I managed to reproduce it by setting the “zoom level” (in preferences) to “Zoom Out 1”. (That is, reduce the text size.)

In my test window (which will be a different size from anybody else’s test window, but I want to record the numbers) I have glkote’s measure_window() returning

{ height: 783, outspacingy: 16,
  gridcharheight: 17.60003662109375, gridmarginy: 11, ... }

(There’s other values but these are the relevant ones.)

In Quixe, the grid-row computation goes like this: the window height is 783-2*16 = 751. Then the number of grid rows is (751-11)/17.60003 = 42.045, rounded down to 42. (This happens in glkapi.js line 3226.)

In Glulxe/Git, the analogous computation returns 43. I don’t have a way to console-log the computation, but I know that measure_window() is returning exactly the same values.

My guess is that the gridcharheight value is getting cast to an integer 17, which then screws up the grid row computation. Dannii will have to say exactly where that happens.

If the “zoom level” is zero, then gridcharheight is an integer already so the bug does not occur.

2 Likes

I can’t see that anywhere in the code, and this line looks correct: remglk/rgwin_grid.c at a0759e92112bc82f4e9a567da8c3b0a8286d634d · curiousdannii/remglk · GitHub

I haven’t tried debugging it myself yet, but nothing obvious is jumping out at me.

Yes, RemGlk itself looks right. When I put those numbers in Glulxe+RemGlk (running as a native binary), I get the right answers.

{ "type": "init", "gen": 0, 
  "metrics": { "buffercharheight": 20.99456787109375, "buffercharwidth": 7.75, 
  "buffermarginx": 50, "buffermarginy": 36, 
  "graphicsmarginx": 0, "graphicsmarginy": 0, 
  "gridcharheight": 17.60003662109375, "gridcharwidth": 8.375, 
  "gridmarginx": 40, "gridmarginy": 11, 
  "inspacingx": 4, "inspacingy": 4, "outspacingx": 0, "outspacingy": 16, 
  "width": 784, "height": 783 }}

{"type":"update", "gen":1,
 "windows":[
 { "id":21, "type":"grid", "rock":1030,
   "gridwidth":10, "gridheight":42,
   "left":660, "top":16, "width":124, "height":751 },
 { "id":18, "type":"buffer", "rock":201,
   "left":0, "top":16, "width":656, "height":751 }
 ],
 "content":[ ... ]
}

Are the files in the downloads stale? Or did I send you the wrong version? I’ll check the latter…