Jump to content




[1.74] Major Window API Bug


  • This topic is locked This topic is locked
6 replies to this topic

#1 Vilsol

  • Members
  • 194 posts
  • LocationStudy: United Kingdom Native: Latvia

Posted 21 August 2015 - 07:37 PM

Hello. I looked all around the forums and I couldn't find anyone creating a topic about this, so here it goes.

Here is a GIF of it in action. This is the program that is available on the wiki: http://www.computerc...ndow.reposition

Posted Image

As you can see, there is a really weird bug where the window size is drawn sometimes larger and sometimes smaller than it actually is.

I ran another test, and really, it draws it larger than it actually is. Here is a GIF of where I iterate from 1 to 20 and set it as the width of the window, then loop over the width of the window and color each column in a different color. As you can see, it draws the box exactly twice minus one as wide as I set it.

Posted Image

Looking at the Window API source, I figured it is because each time the window is re-positioned, the contents of it are multiplied, not just added a blank space.

Here are the lines 402 to 404 in the source:
text = tOldLine.text .. string_sub( sEmptyText, 1, nWidth + 1, nNewWidth ),
textColor = tOldLine.textColor .. string_sub( sEmptyTextColor, 1, nWidth + 1, nNewWidth ),
backgroundColor = tOldLine.backgroundColor .. string_sub( sEmptyBackgroundColor, 1, nWidth + 1, nNewWidth ),

Here is what they should be
text = tOldLine.text .. string_sub( sEmptyText, 1, nNewWidth - (nWidth + 1)),
textColor = tOldLine.textColor .. string_sub( sEmptyTextColor, 1, nNewWidth - (nWidth + 1)),
backgroundColor = tOldLine.backgroundColor .. string_sub( sEmptyBackgroundColor, 1, nNewWidth - (nWidth + 1)),

If they are changed, this is the result:

Posted Image

The same DOES NOT apply to the height, as that is calculated differently from the width.

I really hope this is fixed in the future versions.

Edited by Vilsol, 21 August 2015 - 09:45 PM.


#2 Wojbie

  • Members
  • 631 posts
  • LocationKinda lost

Posted 11 December 2015 - 01:01 AM

Still valid. Reposted to github for latest beta. https://github.com/d...Craft/issues/31

#3 dan200

  • Administrators
  • 542 posts
  • LocationCambridge, England

Posted 11 December 2015 - 11:26 AM

Could you post a pastebin to the test program used in your gifs?

#4 Vilsol

  • Members
  • 194 posts
  • LocationStudy: United Kingdom Native: Latvia

Posted 11 December 2015 - 11:30 AM

I'm at insomnia right now, but I will try to find it for Monday or Tuesday.

You can also test all that with the wiki test program.

Edited by Vilsol, 11 December 2015 - 11:31 AM.


#5 dan200

  • Administrators
  • 542 posts
  • LocationCambridge, England

Posted 11 December 2015 - 03:11 PM

Oh, enjoy Insomnia! Haven't been to one of those in a while. I've managed to obtain a similar program and fix the bug,

#6 Vilsol

  • Members
  • 194 posts
  • LocationStudy: United Kingdom Native: Latvia

Posted 11 December 2015 - 03:15 PM

Thanks and awesome, now I can continue working on the OS ^^

#7 dan200

  • Administrators
  • 542 posts
  • LocationCambridge, England

Posted 11 December 2015 - 03:24 PM

fixed in 1.76pr3





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users