[haiku-bugs] Re: [Haiku] #4361: more command don't work as expected

  • From: "siarzhuk" <trac@xxxxxxxxxxxx>
  • Date: Mon, 02 Sep 2013 14:54:02 -0000

#4361: more command don't work as expected
   Reporter:  phoudoin                         |      Owner:  axeld
       Type:  bug                              |     Status:  new
   Priority:  normal                           |  Milestone:  R1
  Component:  Applications/Command Line Tools  |    Version:  R1/pre-alpha1
 Resolution:                                   |   Keywords:
 Blocked By:                                   |   Blocking:
Has a Patch:  0                                |   Platform:  x86

Comment (by siarzhuk):

 Replying to [comment:7 korli]:
 > It seems also reproducible with "less -F".
 > When commenting the following lines in init() and deinit() in screen.c,
 the problem disappears.
 > tputs(sc_init, sc_height, putchr);
 > tputs(sc_deinit, sc_height, putchr);

 Those are

 enter_ca_mode      smcup     ti       string to start programs using cup
 exit_ca_mode       rmcup     te       strings to end programs using cup

 and defined in XTERM to set/unset DEC private mode 1049

 CSI ? 1049h  → Save cursor as in DECSC and use Alternate Screen Buffer,
 clearing it first.
 CSI ? 1049l  →  Use Normal Screen Buffer and restore cursor as in DECRC.

 This explains observed behaviour of the 'more' program - all output just
 goes to alternate screen buffer and is not visible on normal buffer after
 the program finishes. The 'less' has the chance to show its output to user
 because it waits until the key pressed at the EOF. In both cases the
 output is not visible in the Terminal history after the programs finish.

 Replying to [comment:11 jessicah]:
 > From what I've seen on Linux, `more` doesn't clear what it's printed,
 whereas `less` does. However, I did notice that `less -E` results in no
 output despite a file containing less than a screenful of text. So it
 seems the `less_is_more` mode on Haiku might need to also change the
 terminal emulation behaviour as well.

 Could you compare the less source code on your Linux with Haiku's one,
 check current values of ti/te (in case termcap used) or smcup/rmcup (in
 case terminfo) and LESS/MORE environment variables? Are there any ways to
 preset the less options?

Ticket URL: <http://dev.haiku-os.org/ticket/4361#comment:13>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: