home *** CD-ROM | disk | FTP | other *** search
- From: dupuy@hudson.cs.columbia.edu (Alexander Dupuy)
- Newsgroups: alt.sources
- Subject: Fourth unofficial patch for LESS
- Message-ID: <9004022019.AA01553@hudson.cs.columbia.edu>
- Date: 2 Apr 90 20:19:25 GMT
-
- Here are some more patches which I posted earlier for less version 97 which
- have been applied to less version 123. The original descriptions and the new
- patches follow.
-
- Patrick J. Wolfe (pwolfe@kai.com) posted a patch which reimplemented a feature
- of less I sent to Casey Leedom and which might have been found in one of his
- "unofficial" distributions of less.
-
- Specifically, it caused less to automatically exit at the end of the first and
- only file, if it was less than one page (the idea being that you can see the
- whole thing without a pager).
-
- It was pointed out that this causes some problems for people on workstations,
- or more generally anyone whose terminal goes into a special mode for programs
- using termcap.
-
- The right way to fix this problem is to automatically disable the feature when
- less is running on a terminal with a special termcap mode.
-
- Along with the patch that restores the old less behavior of quitting at the end
- of of the first and only file if it is on a single screen (ala more), this
- patch makes less even "more" convenient for empty files. If there is nothing
- to display (since the first and only file is empty) this patch causes less to
- quit before it displays anything, and to leave the cursor where it already is.
- This will also happen if there are errors reading all input files.
-
- *** /tmp/,RCSt1a00669 Mon Apr 2 15:44:48 1990
- --- main.c Mon Apr 2 15:40:18 1990
- ***************
- *** 15,20 ****
- --- 15,21 ----
- public HANDLE curr_handle;
- public POSITION initial_pos;
- public int any_display;
- + public int null_display;
- public int scroll;
- public int ac;
- public char ** av;
- ***************
- *** 139,144 ****
- --- 140,157 ----
- file = f;
- ch_init(cbufs, 0);
-
- + /*
- + * Ignore a single empty file if we quit at eof.
- + */
- + if (quit_at_eof && ac <= 1)
- + if (ch_forw_get() == EOI)
- + {
- + file = -1;
- + null_display = 1;
- + return;
- + }
- + else (void) ch_back_get();
- +
- if (every_first_cmd != NULL)
- first_cmd = every_first_cmd;
-
- ***************
- *** 497,506 ****
- #if LOGFILE
- end_logfile();
- #endif
- ! lower_left();
- ! clear_eol();
- ! deinit();
- ! flush();
- raw_mode(0);
- exit(0);
- }
- --- 510,525 ----
- #if LOGFILE
- end_logfile();
- #endif
- ! if (any_display)
- ! {
- ! lower_left();
- ! clear_eol();
- ! }
- ! if (any_display || null_display)
- ! {
- ! deinit();
- ! flush();
- ! }
- raw_mode(0);
- exit(0);
- }
-
- ===================================================================
-
- *** /tmp/,RCSt1a00669 Mon Apr 2 15:44:49 1990
- --- prim1.c Fri Mar 30 18:44:08 1990
- ***************
- *** 14,20 ****
- --- 14,22 ----
- extern int top_scroll;
- extern int quiet;
- extern int sc_width, sc_height;
- + extern int te_init;
- extern int quit_at_eof;
- + extern int ac;
- extern int plusoption;
- extern char *first_cmd;
- #if TAGS
- ***************
- *** 192,197 ****
- --- 194,202 ----
- eof_bell();
- else if (do_repaint)
- repaint();
- + if (first_time && hit_eof && quit_at_eof && ac <= 1 &&
- + (!te_init || quit_at_eof > 1))
- + quit();
- first_time = 0;
- (void) currline(BOTTOM);
- }
-
- ===================================================================
-
- *** /tmp/,RCSt1a00669 Mon Apr 2 15:44:51 1990
- --- screen.c Fri Mar 30 18:43:06 1990
- ***************
- *** 55,60 ****
- --- 55,61 ----
-
- public int auto_wrap; /* Terminal does \r\n when write past margin */
- public int ignaw; /* Terminal ignores \n immediately after wrap */
- + public int te_init; /* Terminal uses ti and/or te for screen mode */
- public int erase_char, kill_char; /* The user's erase and line-kill chars */
- public int sc_width, sc_height; /* Height & width of screen */
- public int bo_width, be_width; /* Printing width of boldface sequences */
- ***************
- *** 277,286 ****
- --- 278,291 ----
- sc_init = tgetstr("ti", &sp);
- if (sc_init == NULL)
- sc_init = "";
- + else
- + te_init = 1;
-
- sc_deinit= tgetstr("te", &sp);
- if (sc_deinit == NULL)
- sc_deinit = "";
- + else
- + te_init = 1;
-
- sc_eol_clear = tgetstr("ce", &sp);
- if (hard || sc_eol_clear == NULL || *sc_eol_clear == '\0')
-