[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Bug reports
. . -> [Subject]  SetScroll hidden scrollbar flashes on input
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

SetScroll hidden scrollbar flashes on input

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Thu 19 May 2016 09:20 AM (UTC)

Amended on Thu 19 May 2016 09:22 AM (UTC) by Fiendish

Message
If you hide the scrollbar with SetScroll(-1, false) then the scrollbar still flashes on the screen when you press enter if there is something in the input bar (non-empty input). It happens inconsistently (4/5 for me?), so you may have to try a few times.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by VBMeireles   Brazil  (47 posts)  [Biography] bio
Date Reply #1 on Thu 19 May 2016 09:25 AM (UTC)

Amended on Thu 19 May 2016 10:32 AM (UTC) by VBMeireles

Message
Happens to me whenever I hit ENTER, regardless of whether I have anything in the input bar or not, and also sometimes when I receive text from the MUD.

I've just tried sending "asd" a couple of times:
Flashes when "asd" is sent 100% of the time.
Flashes when "Please stop mashing random keys on your keyboard." is received about 20% of the time.

Vinícius
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Fri 20 May 2016 05:51 AM (UTC)
Message
Can't reproduce using Windows XP.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #3 on Fri 20 May 2016 08:27 AM (UTC)

Amended on Fri 20 May 2016 09:03 AM (UTC) by Fiendish

Message
Definitely happens for me in an XP VM. Very reliably.

It's caused by doing certain kinds (amounts?) of work inside OnPluginWorldOutputResized (which the Aardwolf health bars plugin seems to do) while scroll is hidden.

You can test with this plugin, but be careful with it. Without any other plugins loaded it causes my MUSHclient to completely lock up in an infinite loop.

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
   name="Resize_Test"
   author="Fiendish"
   id="aaaaaaaaaaaaaaaaaaaaaaaa"
   language="Lua"
   requires="4.00"
   version="1.0"
   >
</plugin>

<script>
<![CDATA[
function OnPluginWorldOutputResized()
   print("huh")
   Repaint()
end
]]>
</script>
</muclient>

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Fri 20 May 2016 09:12 PM (UTC)
Message
Test how? Resizing the world? I would regard outputting something during a world resize as a bit dodgy.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #5 on Sat 21 May 2016 07:52 AM (UTC)

Amended on Sat 21 May 2016 08:30 AM (UTC) by Fiendish

Message
Nick Gammon said:

Test how? Resizing the world?

No. Just load the plugin in the middle of a new session, make sure that the scrollbar is _visible_ and print something to the screen.

Then close out, load a new session, hide the scrollbar, load the plugin, and print something again.

MUSHclient starts resizing _constantly_.
Printing to the screen should not cause a resize, but it does if the scrollbar is hidden, because it momentarily unhides and then rehides it for no reason.

Quote:
I would regard outputting something during a world resize as a bit dodgy.

What? No way! Output shouldn't cause a resize event.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Wed 25 May 2016 04:57 AM (UTC)
Message
Well, that was a little harder to fix than I expected.

It seems that setting the current scroll bar position caused the scroll bar to be shown, and then a moment later other code detected it should be removed. Drawing the scroll bar caused the client size to change, and removing it caused it to change again.

The position is used to detect if we are at the end of the output buffer (for auto-freezing of output, and also for displaying "MORE" in inverse), so simply removing the setting of the scroll bar wasn't enough.

https://github.com/nickgammon/mushclient/commit/1f5f0e7

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #7 on Wed 25 May 2016 01:49 PM (UTC)

Amended on Wed 25 May 2016 02:03 PM (UTC) by Fiendish

Message
Quote:
It seems that setting the current scroll bar position caused the scroll bar to be shown

I wouldn't have expected that given that the toggle for whether or not to display it seems to be an entirely separate system API call.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #8 on Wed 25 May 2016 09:25 PM (UTC)
Message
I didn't expect it either, however it seems I overloaded the system call, and it does more:


void CMUSHView::SetScrollSizes (SIZE sizeTotal, 
                     const SIZE& sizePage, 
                     const SIZE& sizeLine)
  {
CMUSHclientDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
SCROLLINFO ScrollInfo;

  m_scroll_limit = sizeTotal;

  GetScrollInfo (SB_VERT, &ScrollInfo, SIF_ALL);
  ScrollInfo.nMin = 0;
  ScrollInfo.nMax = sizeTotal.cy - 1;
  ScrollInfo.nPage = sizePage.cy;
  SetScrollInfo (SB_VERT, &ScrollInfo, pDoc->m_bScrollBarWanted);
  m_ScrollbarPosition = ScrollInfo.nPos;

  /*
  GetScrollInfo (SB_HORZ, &ScrollInfo, SIF_ALL);
  ScrollInfo.nMin = 0;
  ScrollInfo.nMax = sizeTotal.cx - 1;
  ScrollInfo.nPage = sizePage.cx;
  SetScrollInfo (SB_HORZ, &ScrollInfo, pDoc->m_bScrollBarWanted);
*/

  } // end of CMUSHView::SetScrollSizes


I presume the call to SetScrollInfo is the culprit, however I don't see why that would show the scrollbar if m_bScrollBarWanted was false.




By the way, this should make you laugh. When I was debugging, and resized the window, none of the "huh" messages appeared. This was driving me a bit crazy until I remembered the deferred outputting that you were complaining about. As soon as I hit <enter> they all popped up at once. :)

This was because I had a prompt as the last line on the screen, and it was a prompt not terminated by a newline. So, working as intended. :P

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #9 on Thu 26 May 2016 04:27 PM (UTC)
Message
Quote:
When I was debugging, and resized the window, none of the "huh" messages appeared. This was driving me a bit crazy

lol

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


3,354 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]