reactos/sdk/lib/conutils
Hermès Bélusca-Maïto 31322f5df9
[CONUTILS:PAGER][MORE] Implement text line caching + fix some bugs.
- Implement caching of individual (newline-separated) text lines; this
  behaviour can be enabled with a flag (enabled by MORE):
  CON_PAGER_CACHE_INCOMPLETE_LINE.
  This feature is necessary when reading a text file, whose text lines
  may span across two or more successive temporary read buffers, and is
  required for correctly determining whether the lines being read are
  blank and may be squeezed.

- When squeezing blank lines, the blank-line check must be done for each
  line segment corresponding to the screen line (and following) that
  need to be displayed. This matches the behaviour of MS MORE.COM.

- Fix the IsBlankLine() check to not consider FORM-FEEDs as being blank
  characters: This is necessary for correctly handling FORM-FEED
  expansion. Also note that MS MORE.COM only checks for spaces and TABs,
  so we are slightly overdoing these checks (considering other types of
  whitespace).

- Get rid of ConCallPagerLine() and the intermediate CON_PAGER_DONT_OUTPUT
  state flag that were used repeatedly for each and every small line
  chunks. Instead, call directly the user-specified 'PagerLine' callback
  when we are about to start treating the next line segment to be
  displayed (see comment above).

- Fix the exit return condition of ConPagerWorker(): it should return
  TRUE whenever we displayed all the required lines, and FALSE otherwise.
  Otherwise, the previous (buggy) condition on the data being read from
  the text file, may lead to the prompt not showing when a screenful of
  text has been displayed, if it happened that the current text buffer
  becomes empty at the same time (even if, overall, the text file hasn't
  been fully displayed).

- In MorePagerLine(), when we encounter for the first time a blank line
  that will be squeezed with other successive ones, display a single
  blank line. But for that, just display one space and a newline: this
  single space is especially needed in order to force line wrapping when
  the ENABLE_VIRTUAL_TERMINAL_PROCESSING or DISABLE_NEWLINE_AUTO_RETURN
  console modes are enabled. Otherwise the cursor remains at the
  previous line (without wrapping), and just outputting one newline will
  not make it move past 2 lines as one would naively expect.
2021-06-28 21:26:32 +02:00
..
CMakeLists.txt [CONUTILS] Split stream.c into input and output stream modules. 2018-01-31 02:10:41 +01:00
conutils.h [CONUTILS] Diverse improvements: start doxygenating and add some resource messsage helper functions. 2018-02-02 00:41:54 +01:00
instream.c [CONUTILS] Diverse improvements: start doxygenating and add some resource messsage helper functions. 2018-02-02 00:41:54 +01:00
instream.h [CONUTILS] Diverse improvements: start doxygenating and add some resource messsage helper functions. 2018-02-02 00:41:54 +01:00
outstream.c [CONUTILS] Update some documentation. 2021-05-26 01:42:09 +02:00
outstream.h [CONUTILS] Use const string pointers for strings that are not modified by the functions. 2020-08-23 19:11:40 +02:00
pager.c [CONUTILS:PAGER][MORE] Implement text line caching + fix some bugs. 2021-06-28 21:26:32 +02:00
pager.h [CONUTILS:PAGER][MORE] Implement text line caching + fix some bugs. 2021-06-28 21:26:32 +02:00
README.txt [CONUTILS] Split stream.c into input and output stream modules. 2018-01-31 02:10:41 +01:00
screen.c [CONUTILS] Diverse improvements: start doxygenating and add some resource messsage helper functions. 2018-02-02 00:41:54 +01:00
screen.h [CONUTILS] Diverse improvements: start doxygenating and add some resource messsage helper functions. 2018-02-02 00:41:54 +01:00
stream_private.h [CONUTILS] Use the currently active console codepage to output text to files. If you want to output UTF-8 run "chcp 65001" before. 2018-05-05 01:37:30 +02:00
stream.c [FORMATTING][NTOS][HAL][DRIVERS][SDK] Fix trailing spaces 2021-06-11 15:33:08 +03:00
stream.h [CONUTILS][CMD] Add and use a helper ConStdStreamsSetCacheCodePage() macro instead of repeatedly calling ConStreamSetCacheCodePage() on the standard streams. 2021-05-26 01:42:09 +02:00
utils.c [CONUTILS] Implement ConSetThreadUILanguage() as a wrapper for kernel32!SetThreadUILanguage(). 2021-05-26 01:42:10 +02:00
utils.h [CONUTILS] Implement ConSetThreadUILanguage() as a wrapper for kernel32!SetThreadUILanguage(). 2021-05-26 01:42:10 +02:00

The ReactOS Console Utilities Library v0.2
==========================================

LICENSE:    GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
COPYRIGHT:  Copyright 2017-2018 ReactOS Team
            Copyright 2017-2018 Hermes Belusca-Maito
CREDITS:    Thanks to the many people who originally wrote the code that finally
            ended up inside this library, with more or less refactoring, or
            whose code served as a basis for some functions of the library.


INTRODUCTION
~-~-~-~-~-~-

This library contains common functions used in many places inside the ReactOS
console utilities and the ReactOS Command-Line Interpreter. Most of these
functions are related with internationalisation and the problem of correctly
displaying Unicode text on the console. Besides those, helpful functions for
retrieving strings and messages from application resources are provided,
together with printf-like functionality.


CONTENTS
~-~-~-~-

-- Main ConUtils Library --

0. "BASE" (utils.c and utils.h): Base set of functions for loading
   string resources and message strings, and handle type identification.

1. "STREAM" (stream.c and stream.h, instream.c and instream.h, outstream.c
   and outstream.h): Console Stream API (CON_STREAM):
   Stream initialization, basic ConStreamRead/Write. Stream utility functions:
   ConPuts/Printf, ConResPuts/Printf, ConMsgPuts/Printf. Depends on "BASE".

2. "SCREEN" (screen.c and screen.h): Console Screen API (CON_SCREEN):
   Introduces the notion of console/terminal screen around the streams. Manages
   console/terminal screen metrics for Win32 consoles and TTYs (serial...).
   Additional Screen utility functions.
   Depends on "STREAM", and indirectly on "BASE".

3. "PAGER" (pager.c and pager.h): Console Pager API (CON_PAGER):
   Implements core console/terminal paging functionality around console screens.
   Depends on "SCREEN", and indirectly on "STREAM" and "BASE".