Terminal view alignment at bottom might be better

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Terminal view alignment at bottom might be better

Daniel Sebald
After using the GUI for a while I've noticed that the alignment of the
terminal window is at the top, meaning that there is always a complete
line and not a fraction of a line visible at the top.  The consequence
of this is that the bottom of the terminal is not aligned and there can
be a fraction of the line extending past the end of the view depending
upon how one manually sizes the window.  This isn't nice to work with
because all the activity when typing is at that bottom line.  If one
thinks about it, the typical terminal window in a desktop environment
doesn't have this concern because the overall size of the window jumps
in discrete character heights, not pixel sizes when adjusted.

The routine that computes position, from what I gather, is
TerminalView::scrollImage in TerminalView.cpp, and in fact the alignment
point does seem to be upper left:

// note:  it is important that the area of the display which is
// scrolled aligns properly with the character grid -
// which has a top left point at (_leftMargin,_topMargin) ,
// a cell width of _fontWidth and a cell height of _fontHeight).

The code in this file is derived from somewhere else, so I'm not sure
how we handle this situation.  Just make edits?

I suppose there are two ways to address this:

1) Allow alignment at the top left, but make sure there is no fractional
line at the bottom.  Instead, allow there to be a fractional line of
white space at the bottom.

2) Alignment at the bottom left, which means that the top of the
terminal window is where there will be a fractional line.

I kind of prefer the second behavior for the reasons that the top of the
window isn't where the user's eyes are drawn when typing and also a
fractional line at the top does give the impression that the text is
scrolling upward and there might be additional lines scrolled past the
top of the window.

Dan
Reply | Threaded
Open this post in threaded view
|

Re: Terminal view alignment at bottom might be better

bpabbott
Administrator
On Jun 23, 2013, at 3:21 AM, Daniel J Sebald wrote:

> After using the GUI for a while I've noticed that the alignment of the terminal window is at the top, meaning that there is always a complete line and not a fraction of a line visible at the top.  The consequence of this is that the bottom of the terminal is not aligned and there can be a fraction of the line extending past the end of the view depending upon how one manually sizes the window.  This isn't nice to work with because all the activity when typing is at that bottom line.  If one thinks about it, the typical terminal window in a desktop environment doesn't have this concern because the overall size of the window jumps in discrete character heights, not pixel sizes when adjusted.
>
> The routine that computes position, from what I gather, is TerminalView::scrollImage in TerminalView.cpp, and in fact the alignment point does seem to be upper left:
>
> // note:  it is important that the area of the display which is
> // scrolled aligns properly with the character grid -
> // which has a top left point at (_leftMargin,_topMargin) ,
> // a cell width of _fontWidth and a cell height of _fontHeight).
>
> The code in this file is derived from somewhere else, so I'm not sure how we handle this situation.  Just make edits?
>
> I suppose there are two ways to address this:
>
> 1) Allow alignment at the top left, but make sure there is no fractional line at the bottom.  Instead, allow there to be a fractional line of white space at the bottom.
>
> 2) Alignment at the bottom left, which means that the top of the terminal window is where there will be a fractional line.
>
> I kind of prefer the second behavior for the reasons that the top of the window isn't where the user's eyes are drawn when typing and also a fractional line at the top does give the impression that the text is scrolling upward and there might be additional lines scrolled past the top of the window.
>
> Dan

Maybe a 3rd?

3) Snap the command window height to an integer number of lines?

Don't most (all?) terminal windows work that way?

Ben
Reply | Threaded
Open this post in threaded view
|

Re: Terminal view alignment at bottom might be better

Daniel Sebald
On 06/22/2013 08:09 PM, Ben Abbott wrote:
> On Jun 23, 2013, at 3:21 AM, Daniel J Sebald wrote:
[snip]

>> I suppose there are two ways to address this:
>>
>> 1) Allow alignment at the top left, but make sure there is no fractional line at the bottom.  Instead, allow there to be a fractional line of white space at the bottom.
>>
>> 2) Alignment at the bottom left, which means that the top of the terminal window is where there will be a fractional line.
>>
>> I kind of prefer the second behavior for the reasons that the top of the window isn't where the user's eyes are drawn when typing and also a fractional line at the top does give the impression that the text is scrolling upward and there might be additional lines scrolled past the top of the window.
>>
>> Dan
>
> Maybe a 3rd?
>
> 3) Snap the command window height to an integer number of lines?
>
> Don't most (all?) terminal windows work that way?
>
> Ben

I suppose that is possible.  I don't think we could snap the outer
limits of the terminal window because that is embedded in the dock
aligned with other windows.  The inner limits perhaps.

Dan
Reply | Threaded
Open this post in threaded view
|

Re: Terminal view alignment at bottom might be better

bpabbott
Administrator
On Jun 23, 2013, at 12:38 PM, Daniel J Sebald wrote:

> On 06/22/2013 08:09 PM, Ben Abbott wrote:
>> On Jun 23, 2013, at 3:21 AM, Daniel J Sebald wrote:
> [snip]
>>> I suppose there are two ways to address this:
>>>
>>> 1) Allow alignment at the top left, but make sure there is no fractional line at the bottom.  Instead, allow there to be a fractional line of white space at the bottom.
>>>
>>> 2) Alignment at the bottom left, which means that the top of the terminal window is where there will be a fractional line.
>>>
>>> I kind of prefer the second behavior for the reasons that the top of the window isn't where the user's eyes are drawn when typing and also a fractional line at the top does give the impression that the text is scrolling upward and there might be additional lines scrolled past the top of the window.
>>>
>>> Dan
>>
>> Maybe a 3rd?
>>
>> 3) Snap the command window height to an integer number of lines?
>>
>> Don't most (all?) terminal windows work that way?
>>
>> Ben
>
> I suppose that is possible.  I don't think we could snap the outer limits of the terminal window because that is embedded in the dock aligned with other windows.  The inner limits perhaps.
>
> Dan

Yeah.  I think it will be necessary to change the height of the entire window, and/or the window's border.

Ben
Reply | Threaded
Open this post in threaded view
|

Re: Terminal view alignment at bottom might be better

John W. Eaton
Administrator
In reply to this post by Daniel Sebald
On 06/22/2013 09:21 PM, Daniel J Sebald wrote:


> The code in this file is derived from somewhere else, so I'm not sure
> how we handle this situation. Just make edits?

Yes.

> I suppose there are two ways to address this:
>
> 1) Allow alignment at the top left, but make sure there is no fractional
> line at the bottom. Instead, allow there to be a fractional line of
> white space at the bottom.
>
> 2) Alignment at the bottom left, which means that the top of the
> terminal window is where there will be a fractional line.
>
> I kind of prefer the second behavior for the reasons that the top of the
> window isn't where the user's eyes are drawn when typing and also a
> fractional line at the top does give the impression that the text is
> scrolling upward and there might be additional lines scrolled past the
> top of the window.

I think I would also prefer the second option.

jwe


Reply | Threaded
Open this post in threaded view
|

Re: Terminal view alignment at bottom might be better

Torsten
On 23.06.2013 10:06, John W. Eaton wrote:

> On 06/22/2013 09:21 PM, Daniel J Sebald wrote:
>
>
>> The code in this file is derived from somewhere else, so I'm not sure
>> how we handle this situation. Just make edits?
>
> Yes.
>
>> I suppose there are two ways to address this:
>>
>> 1) Allow alignment at the top left, but make sure there is no fractional
>> line at the bottom. Instead, allow there to be a fractional line of
>> white space at the bottom.
>>
>> 2) Alignment at the bottom left, which means that the top of the
>> terminal window is where there will be a fractional line.
>>
>> I kind of prefer the second behavior for the reasons that the top of the
>> window isn't where the user's eyes are drawn when typing and also a
>> fractional line at the top does give the impression that the text is
>> scrolling upward and there might be additional lines scrolled past the
>> top of the window.
>
> I think I would also prefer the second option.
>
> jwe
>
>
Maybe the attached patch already would do the trick. The alignment is
still at the top but the number of displayed lines is reduced by 1
leaving a small space under the last line.

Torsten


temrinal_lines.diff (584 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Terminal view alignment at bottom might be better

Daniel Sebald
On 06/23/2013 03:18 AM, Torsten wrote:

> On 23.06.2013 10:06, John W. Eaton wrote:
>> On 06/22/2013 09:21 PM, Daniel J Sebald wrote:
>>
>>
>>> The code in this file is derived from somewhere else, so I'm not sure
>>> how we handle this situation. Just make edits?
>>
>> Yes.
>>
>>> I suppose there are two ways to address this:
>>>
>>> 1) Allow alignment at the top left, but make sure there is no fractional
>>> line at the bottom. Instead, allow there to be a fractional line of
>>> white space at the bottom.
>>>
>>> 2) Alignment at the bottom left, which means that the top of the
>>> terminal window is where there will be a fractional line.
>>>
>>> I kind of prefer the second behavior for the reasons that the top of the
>>> window isn't where the user's eyes are drawn when typing and also a
>>> fractional line at the top does give the impression that the text is
>>> scrolling upward and there might be additional lines scrolled past the
>>> top of the window.
>>
>> I think I would also prefer the second option.
>>
>> jwe
>>
>>
>
> Maybe the attached patch already would do the trick. The alignment is
> still at the top but the number of displayed lines is reduced by 1
> leaving a small space under the last line.
>
> Torsten
That change would be similar to the first case.  It leaves the
possibility for quite a bit of white space (see attached PNG), although
it is an improvement because one can see the whole line.

I will look at this qRound routine:

-      _lines = qMax(1, qRound(_contentHeight / _fontHeight));
+      _lines = qMax(1, qRound(_contentHeight / _fontHeight)-1);

Maybe if a floor-like function were used instead there wouldn't be the
fraction of a line at the bottom.  Instead it might be similar to what
you've done but with a more limited amount of possible white space.

I'll also look at what it takes to align with the bottom of the terminal
window.

Dan

Screenshot-Octave-whitespace_at_bottom.png (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Terminal view alignment at bottom might be better

Daniel Sebald
On 06/23/2013 11:07 AM, Daniel J Sebald wrote:

> On 06/23/2013 03:18 AM, Torsten wrote:
>> On 23.06.2013 10:06, John W. Eaton wrote:
>>> On 06/22/2013 09:21 PM, Daniel J Sebald wrote:
>>>
>>>
>>>> The code in this file is derived from somewhere else, so I'm not sure
>>>> how we handle this situation. Just make edits?
>>>
>>> Yes.
>>>
>>>> I suppose there are two ways to address this:
>>>>
>>>> 1) Allow alignment at the top left, but make sure there is no
>>>> fractional
>>>> line at the bottom. Instead, allow there to be a fractional line of
>>>> white space at the bottom.
>>>>
>>>> 2) Alignment at the bottom left, which means that the top of the
>>>> terminal window is where there will be a fractional line.
>>>>
>>>> I kind of prefer the second behavior for the reasons that the top of
>>>> the
>>>> window isn't where the user's eyes are drawn when typing and also a
>>>> fractional line at the top does give the impression that the text is
>>>> scrolling upward and there might be additional lines scrolled past the
>>>> top of the window.
>>>
>>> I think I would also prefer the second option.
>>>
>>> jwe
>>>
>>>
>>
>> Maybe the attached patch already would do the trick. The alignment is
>> still at the top but the number of displayed lines is reduced by 1
>> leaving a small space under the last line.
>>
>> Torsten
>
> That change would be similar to the first case. It leaves the
> possibility for quite a bit of white space (see attached PNG), although
> it is an improvement because one can see the whole line.
>
> I will look at this qRound routine:
>
> - _lines = qMax(1, qRound(_contentHeight / _fontHeight));
> + _lines = qMax(1, qRound(_contentHeight / _fontHeight)-1);
>
> Maybe if a floor-like function were used instead there wouldn't be the
> fraction of a line at the bottom. Instead it might be similar to what
> you've done but with a more limited amount of possible white space.
That didn't improve things any.  The worst-case white space at the
bottom was still the same.


> I'll also look at what it takes to align with the bottom of the terminal
> window.

I put a changeset on Savannah:

http://savannah.gnu.org/patch/?8091

that replaces any use of top,left directly by indirectly computing the
top anchored from the bottom (left...left doesn't change, of course).
It works pretty well.  The very first line with the version number can
get chopped at the start (see PNG below).  If we want that fixed, I
suggest another patch that will use a conditional to compute the top
value depending upon whether the overall number of lines extends past
the content height.  I don't want to change too much at once because
these computations work their way through everything and it is easy to
get a mess without too much effort.

Dan

PS: This terminal view may have been done easier with the QTextEdit
widget.  Would still have to somehow compute the text placement over the
default, but that might be easier than the complete implementation of
the scrolling, drawing, etc...  Some other day.

Screenshot-Octave-terminal_alignment_topcut.png (67K) Download Attachment