Austin Group Defect Tracker

Aardvark Mark IV


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0001185 [1003.1(2016/18)/Issue7+TC2] Shell and Utilities Editorial Enhancement Request 2018-02-02 04:13 2020-04-27 10:58
Reporter dannyniu View Status public  
Assigned To
Priority normal Resolution Accepted As Marked  
Status Applied  
Name DannyNiu/NJF
Organization
User Reference
Section more
Page Number http://pubs.opengroup.org/onlinepubs/9699919799/utilities/more.html [^]
Line Number EXTENDED DESCRIPTION
Interp Status ---
Final Accepted Text Note: 0004260
Summary 0001185: Additional 3rd option for getting line size.
Description Since we've had bug 1151 introducing new signals and IO control calls to get and set terminal sizes, we should have a 3rd option for more to get terminal size to display text on screen.
Desired Action In Extended Description, 2nd paragraph:

Change

The number of lines available per screen shall be determined by the -n option, if present, or by examining values in the environment (see the ENVIRONMENT VARIABLES section). If neither method yields a number, an unspecified number of lines shall be used.

to

The number of lines available per screen shall be determined by the -n option, if present, or by examining values in the environment (see the ENVIRONMENT VARIABLES section), or by calling tcgetwinsize. If no method yields a number, an unspecified number of lines shall be used.
Tags issue8
Attached Files

- Relationships
related to 0001151Applied 1003.1(2016/18)/Issue7+TC2 Introduce new signal SIGWINCH and functions tcsetsize(), tcgetsize() to get/set terminal window size 
related to 0001369Applied Issue 8 drafts COLUMNS and LINES rationale 

-  Notes
(0003916)
dannyniu (reporter)
2018-02-02 04:24

Additionally, add a "Signals" section, with:

SIGWINCH: When received, "more" may update the terminal with new output to refresh the screen.
(0003920)
kre (reporter)
2018-02-13 23:54

Which versions of more(1) have a -n option like that?

Or are you suggesting that we should invent something
which does not currently exist?

kre
(0003921)
nick (manager)
2018-02-14 02:29

Solaris's /usr/xpg4/bin/more supports the -n option as described, as does OpenBSD's. There may be others.
(0003922)
shware_systems (reporter)
2018-02-14 04:53
edited on: 2018-02-14 05:20

I think I'm with kre on this, that it looks more invention than valid. The description doesn't make any mention of changing a viewport or terminal window's size. It just relates to how many line's are accessed per screen refresh, to override other reported values, and if someone specifies a value larger than tcgetsize() some display scrolls off the top with each b or f command and a user would need to use a k command to see those extra lines, or a scroll-bar/up arrows on a viewport. That's how I think most would read that, at least, as something all terminals can support.

Relating it to how many lines of piped input get buffered for use with the k command, where b can't be supported, looks like an omission. Its usual usage would be more if you have a 43 line screen you may say -n 40 to keep the line count per screen as multiples of 10 until the last 'page', to ease lines per file counting, similar to the usage caveat for the LINES variable in XBD 8.3. If the mode suddenly went up or down to a 24 or 50 line screen, I think people would still expect it to access the 40 lines at a time.

This is not to say such autosizing couldn't be useful, but I'd expect a separate switch used in conjunction with -n to enable that behavior when the utility starts, as something applicable only to terminal types capable of supporting it such as a GUI viewport. Whether the display gets restored upon exit or not to the size it was when the utility started would also be something to be specified with a switch like this. I'd expect the utility to auto-adjust, maybe, if -n wasn't specified and the utility was using a value larger than the new size could support when a SIGWINCH was received, but not when -n is specified.

(0003923)
kre (reporter)
2018-02-14 10:44

Other versions of more use -n for a different purpose (a flag, with no
accompanying arg) so I doubt it would be a good idea to standardise that.

Further, I also am not sure I see a need, one can always just do

    LINES=36 more ...

if that is the objective for some reason, though personally I am not sure
I see any use for being able to specify more or less than the actual
terminal page size (what LINES, if it is set at all, should be, and
otherwise the tcget... call result)

kre
(0003924)
shware_systems (reporter)
2018-02-14 18:22

No, -n is standard already, with a required argument. Those using it as just a flag are non-conforming. See link above.

One can always buy 6 VGA monitors and stack them vertically if they want 300 lines of desktop, which tcgetwinsize() may report as available lines, yet many terminals say ok, I'll save 150 (-n) but only show you 30 lines (LINES) at a time so I don't have to span screens, even if this may be using 50 lines for some VGA modes (which would be indicated in TERM somehow).

Doing scrolls out of RAM is still quicker than having to read a disk multiple times, if it's only buffering 30 lines, and how some background applications might be using the other 20 lines and 5 monitors is the user's choice. Yes, when you only have 24 line screens there's little point to using fewer, but "screens" supporting over 600 lines are plausible now for under USD10K.
(0004260)
geoffclare (manager)
2019-02-20 12:04

Suggested changes ...

Changes to XBD ...

On page 177 line 5811 section 8.3, in COLUMNS change:
If this variable is unset or null, the implementation determines the number of columns, appropriate for the terminal or window, in an unspecified manner. When COLUMNS is set, any terminal-width information implied by TERM is overridden.
to:
If this variable is unset or null, the number of columns shall be set according to the terminal window size (see [xref to XSH tcgetwinsize()]); if the terminal window size cannot be obtained, the implementation determines the number of columns, appropriate for the terminal or window, in an unspecified manner. When COLUMNS is set, the number of columns in the terminal window size and any terminal-width information implied by TERM are overridden.

On page 177 line 5826 section 8.3, in LINES change:
If this variable is unset or null, the implementation determines the number of lines, appropriate for the terminal or window (size, terminal baud rate, and so on), in an unspecified manner. When LINES is set, any terminal-height information implied by TERM is overridden.
to:
If this variable is unset or null, the number of lines shall be set either to the number of rows in the terminal window size (see [xref to XSH tcgetwinsize()]) or to a smaller number if appropriate for the terminal or window (for example, if the terminal baud rate is low); if the terminal window size cannot be obtained, the implementation determines the number of lines, appropriate for the terminal or window, in an unspecified manner. When LINES is set, the number of rows in the terminal window size and any terminal-height information implied by TERM are overridden.

Changes to XCU ...

On page 2700 line 88152 section ex, in SIGCONT change:
The screen shall be refreshed if in open or visual mode.
to:
If ex is in open mode or visual mode, the actions described below for SIGWINCH shall be taken, except that the screen shall always be refreshed (regardless of whether the terminal window size changed).

On page 2700 line 88157 section ex, add:
SIGWINCH
If ex is in open mode or visual mode, the current terminal window size associated with the terminal on standard output shall be obtained, as if by a call to [xref to XSH tcgetwinsize()]. If the terminal window size is successfully obtained, it shall be used as follows:
  • If the COLUMNS environment variable is unset or does not contain a number, the horizontal screen size shall be set to the number of columns in the obtained terminal window size.
  • If ex is in visual mode, the -w option was not specified and the LINES environment variable is unset or does not contain a number, the vertical screen size shall be set to the number of rows in the obtained terminal window size.

If the above resulted in either the vertical screen size or the horizontal screen size (or both) changing to a different value, ex shall update the values it has for the number of lines and columns in the display and shall adjust the window edit option and the column number at which the wrapmargin edit option takes effect (if non-zero) accordingly (see [xref to Edit Options in ex]) and refresh the screen; otherwise, ex may refresh the screen.

On page 2926 line 96739 section ls, in COLUMNS change:
Determine the user's preferred column position width for writing multiple text-column output. If this variable contains a string representing a decimal integer, the ls utility shall calculate how many pathname text columns to write (see -C) based on the width provided. If COLUMNS is not set or invalid, an implementation-defined number of column positions shall be assumed, based on the implementation's knowledge of the output device.
to:
Override the system-selected horizontal display line size, used to determine the column position width for writing multiple text-column output. See [xref to XBD Chapter 8] for valid values and results when it is unset or null. The ls utility shall use this value to calculate how many pathname text columns to write (see -C).

On page 3007 line 99972 section more, change ASYNCHRONOUS EVENTS from:
None.
to:
The following actions shall be taken upon receipt of signals:

SIGCONT
The actions described below for SIGWINCH shall be taken, except that the screen shall always be refreshed (regardless of whether the terminal window size changed).
SIGWINCH
If standard output is a terminal, the current terminal window size associated with the terminal on standard output shall be obtained, as if by a call to [xref to XSH tcgetwinsize()]. If the terminal window size is successfully obtained, it shall be used as follows:
  • If the COLUMNS environment variable is unset or does not contain a number, the horizontal display line size shall be set to the number of columns in the obtained terminal window size.
  • If the -n option was not specified (neither on the command line nor via the MORE environment variable) and the LINES environment variable is unset or does not contain a number, the vertical screen size shall be set to the number of rows in the obtained terminal window size.

If the above resulted in either the vertical screen size or the horizontal display line size (or both) changing to a different value, the number of lines available per screen and the number of columns available per line shall be updated correspondingly (see [xref to XBD Chapter 8]) and the screen shall be refreshed; otherwise, the screen may be refreshed.
The action taken for all other signals shall be the default.

On page 3008 line 99993 section more, change:
The number of lines available per screen shall be determined by the -n option, if present, or by examining values in the environment (see the ENVIRONMENT VARIABLES section). If neither method yields a number, an unspecified number of lines shall be used.
to:
The number of lines available per screen shall be determined by the -n option, if present, or by obtaining the vertical screen size from the LINES environment variable (see the ENVIRONMENT VARIABLES section) or from the terminal window size associated with the terminal on standard output (see [xref to XSH tcgetwinsize()]), with a default value as described in [xref to XBD Chapter 8].

On page 3008 line 100001 section more, change:
The number of columns available per line shall be determined by examining values in the environment (see the ENVIRONMENT VARIABLES section), with a default value as described in [xref to XBD Chapter 8].
to:
The number of columns available per line shall be determined by obtaining the horizontal display line size from the COLUMNS environment variable (see the ENVIRONMENT VARIABLES section) or from the terminal window size associated with the terminal on standard output (see [xref to XSH tcgetwinsize()]), with a default value as described in [xref to XBD Chapter 8].

On page 3015 line 100264 section more, add a new paragraph to RATIONALE:
Historically some versions of more did not obtain the terminal window size on receipt of SIGCONT, resulting in incorrect screen contents when the screen was refreshed if the size had been changed while more was suspended. This is considered to be a bug in those implementations.

- Issue History
Date Modified Username Field Change
2018-02-02 04:13 dannyniu New Issue
2018-02-02 04:13 dannyniu Name => DannyNiu/NJF
2018-02-02 04:13 dannyniu Section => more
2018-02-02 04:13 dannyniu Page Number => http://pubs.opengroup.org/onlinepubs/9699919799/utilities/more.html [^]
2018-02-02 04:13 dannyniu Line Number => EXTENDED DESCRIPTION
2018-02-02 04:24 dannyniu Note Added: 0003916
2018-02-13 23:54 kre Note Added: 0003920
2018-02-14 02:29 nick Note Added: 0003921
2018-02-14 04:53 shware_systems Note Added: 0003922
2018-02-14 05:03 shware_systems Note Edited: 0003922
2018-02-14 05:20 shware_systems Note Edited: 0003922
2018-02-14 10:44 kre Note Added: 0003923
2018-02-14 18:22 shware_systems Note Added: 0003924
2019-02-20 12:04 geoffclare Note Added: 0004260
2019-02-25 16:46 nick Relationship added related to 0001151
2019-02-28 16:48 geoffclare Interp Status => ---
2019-02-28 16:48 geoffclare Final Accepted Text => Note: 0004260
2019-02-28 16:48 geoffclare Status New => Resolved
2019-02-28 16:48 geoffclare Resolution Open => Accepted As Marked
2019-02-28 16:48 geoffclare Tag Attached: issue8
2020-04-27 10:58 geoffclare Status Resolved => Applied
2020-07-09 11:12 geoffclare Relationship added related to 0001369


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker