[MORE][CONUTILS] Implement missing features of the MORE command (#3658)

Implement missing features of the MORE command. Special thanks to @HBelusca. CORE-4019
This commit is contained in:
Katayama Hirofumi MZ 2021-06-09 23:30:30 +09:00 committed by GitHub
parent afc27ab1aa
commit b552901df5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 1423 additions and 267 deletions

View file

@ -2,8 +2,8 @@
* PROJECT: ReactOS Console Utilities Library
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: Console/terminal paging functionality.
* COPYRIGHT: Copyright 2017-2018 ReactOS Team
* Copyright 2017-2018 Hermes Belusca-Maito
* COPYRIGHT: Copyright 2017-2021 Hermes Belusca-Maito
* Copyright 2021 Katayama Hirofumi MZ
*/
/**
@ -26,27 +26,50 @@
extern "C" {
#endif
// #include <wincon.h>
struct _CON_PAGER;
typedef BOOL (__stdcall *CON_PAGER_LINE_FN)(
IN OUT struct _CON_PAGER *Pager,
IN PCTCH line,
IN DWORD cch);
/* Flags for CON_PAGER */
#define CON_PAGER_FLAG_DONT_OUTPUT (1 << 0)
#define CON_PAGER_FLAG_EXPAND_TABS (1 << 1)
#define CON_PAGER_FLAG_EXPAND_FF (1 << 2)
typedef struct _CON_PAGER
{
/* Console screen properties */
PCON_SCREEN Screen;
DWORD ScreenColumns;
DWORD ScreenRows;
// TODO: Add more properties. Maybe those extra parameters
// of PAGE_PROMPT could go there?
/* Paging parameters */
CON_PAGER_LINE_FN PagerLine; /* The line function */
LONG nTabWidth;
DWORD ScrollRows;
/* Used to count number of lines since last pause */
DWORD LineCount;
/* Data buffer */
PCTCH TextBuff; /* The text buffer */
DWORD cch; /* The total number of characters */
/* Paging state */
DWORD ich; /* The current index of character */
DWORD iColumn; /* The current index of column */
DWORD iLine; /* The physical output line count of screen */
DWORD lineno; /* The logical line number */
DWORD dwFlags; /* The CON_PAGER_FLAG_... flags */
DWORD nSpacePending;
} CON_PAGER, *PCON_PAGER;
#define INIT_CON_PAGER(pScreen) {(pScreen), 0}
#define InitializeConPager(pPager, pScreen) \
#define InitializeConPager(pPager, pScreen) \
do { \
(pPager)->Screen = (pScreen); \
(pPager)->LineCount = 0; \
ZeroMemory((pPager), sizeof(*(pPager))); \
(pPager)->Screen = (pScreen); \
} while (0)