Skip to content

Commit

Permalink
Add --no-poll option.
Browse files Browse the repository at this point in the history
Related to #557.
  • Loading branch information
gwsw committed Oct 4, 2024
1 parent 9f2bbc2 commit 4e516a1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

* Add --form-feed option (github #496).

* Add --no-poll option (github #557).

* Make TAB complete option name in -- command (github #531).

* Make -R able to pass through any OSC escape sequences,
Expand Down
10 changes: 10 additions & 0 deletions opttbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public int match_shift; /* Extra horizontal shift on search match */
public int no_paste; /* Don't accept pasted input */
public int no_edit_warn; /* Don't warn when editing a LESSOPENed file */
public int stop_on_form_feed; /* Stop scrolling on a line starting with form feed */
public int no_poll; /* Don't poll tty for ^X */
public long match_shift_fraction = NUM_FRAC_DENOM/2; /* 1/2 of screen width */
public char intr_char = CONTROL('X'); /* Char to interrupt reads */
#if HILITE_SEARCH
Expand Down Expand Up @@ -184,6 +185,7 @@ static struct optname proc_backspace_optname = { "proc-backspace", NULL };
static struct optname proc_tab_optname = { "proc-tab", NULL };
static struct optname proc_return_optname = { "proc-return", NULL };
static struct optname match_shift_optname = { "match-shift", NULL };
static struct optname no_poll_optname = { "no-poll", NULL };
#if LESSTEST
static struct optname ttyin_name_optname = { "tty", NULL };
#endif /*LESSTEST*/
Expand Down Expand Up @@ -756,6 +758,14 @@ static struct loption option[] =
NULL
}
},
{ OLETTER_NONE, &no_poll_optname,
O_BOOL, OPT_OFF, &no_poll, NULL,
{
"Poll for ^X when reading data",
"Don't poll for ^X when reading data",
NULL
}
},
#if LESSTEST
{ OLETTER_NONE, &ttyin_name_optname,
O_STRING|O_NO_TOGGLE, 0, NULL, opt_ttyin_name,
Expand Down
5 changes: 3 additions & 2 deletions os.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ extern int follow_mode;
extern int scanning_eof;
extern char intr_char;
extern int is_tty;
extern int no_poll;
#if !MSDOS_COMPILER
extern int tty;
#endif
Expand Down Expand Up @@ -152,7 +153,7 @@ public int supports_ctrl_x(void)
return (TRUE);
#else
#if USE_POLL
return (use_poll);
return (use_poll && !no_poll);
#else
return (FALSE);
#endif /* USE_POLL */
Expand Down Expand Up @@ -238,7 +239,7 @@ public ssize_t iread(int fd, unsigned char *buf, size_t len)
}
#endif
#if USE_POLL
if (is_tty && fd != tty && use_poll)
if (is_tty && fd != tty && use_poll && !no_poll)
{
int ret = check_poll(fd, tty);
if (ret != 0)
Expand Down
3 changes: 2 additions & 1 deletion version.c
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,8 @@ v667 9/26/24 Fix uninitialized variable in edit_ifile.
v659.1 Add --no-paste; add --no-edit-warn; add TAB for -- command;
add LESSANSIOSCALLOW and LESSANSIOSCCCHARS; fix bug searching
near invalid UTF-8 sequence; add LESS_SHELL_LINES; fix bug
with --no-number-headers; add mouse cmds to lesskey.
with --no-number-headers; add mouse cmds to lesskey;
add form-feed; add --no-poll.
*/

Expand Down

0 comments on commit 4e516a1

Please sign in to comment.