less: optionally query terminal size via "ESC [ 6 n". Closes bug 2659.

+7 bytes is not selected, +100 if selected.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2011-07-25 15:18:20 +02:00
parent be391e7596
commit 4e552a70ec
4 changed files with 123 additions and 84 deletions

View File

@@ -214,7 +214,10 @@ int64_t FAST_FUNC read_key(int fd, char *buffer, int timeout)
}
n++;
/* Try to decipher "ESC [ NNN ; NNN R" sequence */
if ((ENABLE_FEATURE_EDITING_ASK_TERMINAL || ENABLE_FEATURE_VI_ASK_TERMINAL)
if ((ENABLE_FEATURE_EDITING_ASK_TERMINAL
|| ENABLE_FEATURE_VI_ASK_TERMINAL
|| ENABLE_FEATURE_LESS_ASK_TERMINAL
)
&& n >= 5
&& buffer[0] == '['
&& buffer[n-1] == 'R'