Input box resize limit gone.

Posted by Poromenos on Wed 25 Jul 2007 05:38 PM — 15 posts, 56,031 views.

Greece #0
The input box used to have a minimum (one-line) height you could set it to, but this is now gone, so when I resize it downwards it becomes as small as I want, taking up half a line or whatever. This also means that the textboxes between worlds are different heights, since setting it by hand isn't very accurate.

Why was this removed? Is this a bug?
USA #1
Yeah I noticed too, somewhat annoying.

If this isn't a bug, could we get a new feature where you double-click the drag-bar which makes it resize to one line sized?
USA #2
I personally like this feature. I completely remove the command box from the world that I dump channels into so that it's just a display. Having a way to set the height, especially with a selection of how many lines, and lock it in would be nice though, since I frequently manage to accidentally click on the bar and drag it around in my main world, and it's a pain getting it back to exactly two lines tall.
Greece #3
Maybe it could "snap" to 0, 1, 2, etc lines...
Australia Forum Administrator #4
If you want to specify it precisely, you can edit the Registry before you open the world up:


HKEY_CURRENT_USER\Software\Gammon Software Solutions\MUSHclient\WORLDNAME\Bottom Height


The default seems to be around 27, which is about 2 lines. I made it 13, and it seemed to just fit my 12-point FixedSys command line.

I'm not sure how easy the "snap to" idea would be, I can take a look at that later.
Australia Forum Administrator #5
This is not a bug. It was implemented in version 3.83, see point 10:

http://www.gammon.com.au/scripts/showrelnote.php?version=3.83&productid=0
Australia Forum Administrator #6
I know that fiddling with the Registry is not recommended, but if you take these lines and turn them into a (text) file:


Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Gammon Software Solutions\MUSHclient\WORLD-NAME]
"Bottom Height"=dword:00000013



Replace "WORLD-NAME" by the world's name, save as "fix_command_height.reg" and then double-click it, it should fix up the command height for your world.
Greece #7
Doing this once per world is tedious, though. Could we have a global option, or the snapping thing?
Australia Forum Administrator #8
Version 4.16, now released, has the snap-to thing.
USA #9
Quote:
If you hold down the Ctrl key whilst resizing the command window, it will now snap to the nearest whole number of lines.

What does it mean by "nearest"?

If I ctrl-click to size it at 1 line, move it down ever so slightly then ctrl-click again... it resizes to 0 lines instead of 1 (even though 1 was the closest/nearest size).
Australia Forum Administrator #10
Well, this the relevant code (MySplitterWnd.cpp), note the comment "hideous" near the start:

/////////////////////////////////////////////////////////////////////////////
// CMySplitterWnd message handlers

void CMySplitterWnd::OnLButtonUp(UINT nFlags, CPoint point) 
{
  CSplitterWnd::OnLButtonUp(nFlags, point);

  // this hideous code is so that we know when the user has resized the
  // input pane, so we don't snap the size back to what it was
  if (m_pDoc)
    {
    int cyCur,
        cyMin;
    GetRowInfo (COMMAND_PANE, cyCur, cyMin);

    // snap to boundary stuff (version 4.16)
    if (((GetKeyState (VK_LCONTROL) & 0x8000) != 0 ||
        (GetKeyState (VK_RCONTROL) & 0x8000) != 0) && m_pDoc->m_input_font)
      {
      CDC dc;

      dc.CreateCompatibleDC (NULL);
      dc.SelectObject (m_pDoc->m_input_font);

      TEXTMETRIC tm;
      dc.GetTextMetrics(&tm);

      // need to know height of entire font (eg. 12 point FixedSys is 15)
      int m_iLineHeight = tm.tmHeight; 

      const int iFudge = 4;   // trial and error stuff, if anyone has a better idea let me know

      double fLines = (cyCur - iFudge) / m_iLineHeight;
      int iLines = floor (fLines + 0.5);   // round to nearest number of lines
      if (iLines)   
        cyCur =  m_iLineHeight * iLines + iFudge;  // calculate desired height for those lines
      else
        cyCur = 0;  // zero lines is still zero
      } // end of ctrl key held down

    if (!(m_pDoc->m_mush_name.IsEmpty ()))
      App.WriteProfileInt(m_pDoc->m_mush_name, "Bottom Height", cyCur);
//    TRACE1 ("Bottom height (saved) = %i\n", cyCur);

    if (m_pDoc->m_pActiveCommandView)
      m_pDoc->m_pActiveCommandView->m_owner_frame->FixUpSplitterBar ();
    else if (m_pDoc->m_pActiveOutputView)
      m_pDoc->m_pActiveOutputView->m_owner_frame->FixUpSplitterBar ();

	  }

}



This line should be doing it:


int iLines = floor (fLines + 0.5); // round to nearest number of lines


That adds half a line and then goes to the lower integer, that should technically be "nearest".

However if you can see a bug please let me know.
Amended on Sun 02 Mar 2008 06:58 AM by Nick Gammon
Australia Forum Administrator #11
I confirm it seems to snap "down" rather than to nearest, however that code is shonky anyway. Maybe iFudge needs to be something other than 4?

It isn't a huge deal, just move the line to above where you want it and let go.
USA #12
Quote:
It isn't a huge deal, just move the line to above where you want it and let go.

Except I can never tell what one line looks like, and I end up getting it too small (where it resizes it to 0 lines and I have to eyeball it once again without knowing what my last attempt was).

I was getting the source to debug this, but I haven't installed bzr yet.
Australia Forum Administrator #13
The source for version 4.19 is here:

http://www.gammon.com.au/files/mushclient/src/mushclient_4.19_src.zip

That part hasn't changed since then.
Australia Forum Administrator #14
Quote:

Except I can never tell what one line looks like, and I end up getting it too small ...


Type two lines of test text (using Ctrl+Enter to start the new line), resize without holding Ctrl, to get an approximation. Once the second line disappears you know you are somewhere over one line height but less than two lines height.

Then just Ctrl+Click the bar (without attempting to move it), and it will snap down to eliminate the useless white space.