- Add DELETE key support
- Add Alt+Backspace support
- Add new ESC codes for HOME and END keys
- New variable naming has been applied. The backward compatibility of the
userdata
attribute of themicrorl_t
structure is broken, the rest of the attributes should be private for the developer. The API is not changed - Rework history navigation
- Code refactoring to improve readability
- Skip completion (TAB) if echo is OFF
- Fix skipping saving the same command as last record in history
- Previously, if the last record was restored from the history by pressing UP key and executed, then it was still saved
- Add config
MICRORL_CFG_USE_ECHO_OFF
for enable/disable "echo off" feature in library. By default the feature is disabled - Add config
MICRORL_CFG_ECHO_OFF_MASK
for set the echo off masking character. By default the input is masked by*
- Add single quotes
'
support in addition to double quotes"
- Fix restoring the echo in
ECHO_ONCE
mode. Now if command line is empty in ECHO_ONCE mode and the user is pressed Enter, the echo will not switch toECHO_ON
mode - Now the same command as the last record in history isn't saved
- Add missing including of
stddef.h
forsize_t
type to prevent compiling errors #1 - Fix wrong signed-unsigned types comparsions and other possible warnings while compiling #1
- Fix record erasing from history in case of all existing records erased
- Fix restoring of empty line in case of restoring the first previous record and pressing
DOWN
key to back to empty line
- Fix possible command line buffer overflow
- Fix echo off feature: previously this feature only worked with
MICRORL_ECHO_ONCE
, now it also works withMICRORL_ECHO_OFF
- Build of Unix and AVR demo have been fixed
- Added TAB separators in targets of Makefiles replaced with spaces before
microrl_user_config.h
from STM32 example replaced toexamples
folder. Now it is common for all examples, butpost_exec_hook()
demonstration is implemented only in STM32 example- Other fixes for successful build of Unix and AVR demos
- The
../src
folder has been reorganized to make it easier to use the library in various SDKs, to which library is added - The
../src/include/microrl/microrl_user_config.h
file has been renamed tomicrorl_user_config_template.h
for to avoid conflicts with usedmicrorl_user_config.h
file at project - Added optional hooks called before and after command execution callback
- Config
MICRORL_CFG_EXECUTE_STATUS_LOGGING
has been removed. Its functionality has been moved topost_exec_hook()
in the stm32 example for command hooks functionality demonstration. - Added config
MICRORL_CFG_USE_COMMAND_HOOKS
, which enables using ofMICRORL_PRE_COMMAND_HOOK(mrl, argc, argv)
andMICRORL_POST_COMMAND_HOOK(mrl, res, argc, argv)
hooks in microrl private code
- Config
- Added support of multiple compilers for inline keyword
- Fixed incorrect behavior when displaying autocomplete options
- Fixed incorrect determination of whether the command line buffer is full
- Added pre-configured STM32CubeIDE project with library demonstration example for STM32F415RG MCU
- Set execute callback function
microrlr_t microrl_set_execute_callback(microrl_t* mrl, microrl_exec_fn exec_fn)
from v1.5.1-dev is restored- This function may be useful to switch multiple execution callbacks: for example, one for entering a login and password, another for execution commands after log in
- Updated STM32 example with two execute callbacks
- Added optional command status logging
- Enable
MICRORL_CFG_EXECUTE_STATUS_LOGGING
to output command exiting status, if it is not equal 0
- Enable
Changes since v1.5.1-dev:
- Library APIs changes:
- Library initialization function
- Setting of execute callback is replaced to
microrlr_t microrl_init(microrl_t* mrl, microrl_output_fn out_fn, microrl_exec_fn exec_fn)
initialization function - Execute callback setting function
microrl_set_execute_callback()
is removed
- Setting of execute callback is replaced to
- Complete and Singint callbacks setting functions return new result type
microrlr_t
- String output callback function
void print(microrl_t* mrl, const char* str)
replaced withint out_fn(microrl_t* mrl, const char* str)
- Input processing function
void microrl_insert_char(microrl_t* mrl, int ch)
is replaced withmicrorlr_t microrl_processing_input(microrl_t* mrl, const void* in_data, size_t len)
- New function accepts an array of input data for processing and its length instead of a single character, which can be useful for processing, for example, DMA transfers with ring buffer
- Added
microrlr_t microrl_set_prompt(microrl_t* mrl, char* prompt)
function to set prompt string - Added
uint32_t microrl_get_version(void)
function to get version of MicroRL library
- Library initialization function
bool
type defines is removed to prevent compiler warnings- Added result enumeration type
microrlr_t
instead
- Added result enumeration type
- New library formatting style
- Descriptions of types, functions and defines are done in DOXYGEN style
- Active use of enumeration types to make code easier to understand
- Library APIs return result
microrlr_t
type- Added checks for passing NULL pointers to all APIs
- Added file headers with license to all library files
- The project follows the Tilen Majerle formatting style
- But function declarations are placed on one line
- Using platform-independent
int
types
- Library configurations file changes
config.h
file is renamed tomicrorl_config.h
. This file contains MicroRL library default configurationsmicrorl_user_config.h
file with user defined configs is created. Copy to this file the configurations that you want to configure from themicrorl_config.h
file and replace it to your project. This way you can easily update the library without affecting your customized configurations- Changed the naming system of configs for forced reconfiguration of the library in accordance with the new changes
- Some old configs have been removed, others have changed their meaning
- MicroRL instance changes
- Command line buffer size changed to
_COMMAND_LINE_LEN + 1
inmicrorl_t
. Config_COMMAND_LINE_LEN
now contains the size of the command line buffer without a terminating zero
- Command line buffer size changed to
- MicroRL adaptation for embedding in C++ programs (
Stephen Casner @slcasner
commits are integrated)- Added a
void* userdata
member tomicrorl_t
struct that can be used by applications to store a C++ object pointer or other context info - Passed the pointer to
microrl_t
in all callbacks so that the operations can be specific to a particular instance of microrl - Added
extern "C"
C++ guards to header files
- Added a
- Reduced and consolidated print operations (
Stephen Casner @slcasner
commit are integrated)
When used over a network connection, eachprint()
call in microrl may be transmitted as a separate packet, so the many small print operations make output slow. This commit optimizes some common cases to avoid unnecessary prints and combines others into a buffer to be printed together.- When adding characters to the end of a command, now just the single character is output. This avoids cursor jumping. Similarly, when backspacing at the end of the line, just the simple sequence back-one, space, back-one is sufficient.
- The biggest number of back-to-back print operations occurred in
terminal_print_line()
where each character was printed separately. Now the characters are packed into a temporary buffer first so they can be printed in one or a few operations, depending upon the command length and buffer size. Positioning sequences are also consolidated into the buffer. - Some calls to
terminal_reset_cursor()
that were changed to callterminal_move_cursor()
instead since the latter outputs fewer characters and avoids extra jumping of the cursor on slow lines. The code to reset the cursor position was then incorporated intoterminal_print_line()
where those positioning operations can be consolidated into a print buffer. Since the reset is not always necessary, an argument controls whether it is done. - A new define
_USE_CARRIAGE_RETURN
controls using a carriate return to reposition the cursor to the left margin rather than moving left by a large number. This takes fewer characters. This optimization can be turned off if the terminal simulates receiving a linefeed when it receives the carriage return. - In
terminal_print_line()
, the delete-to-end-of-line escape sequence is moved to be output after all of the command text. This avoids a flash of the text going away and then being repainted. - The code to create repositioning sequences was extracted into a separate function
generate_move_cursor()
so it can be shared betweenterminal_move_cursor()
andterminal_print_line()
. - After reorganizing the code to generate repositioning strings there was only one call to
u16bit_to_str()
, so it was merged inline. strcpy()
calls of just a few characters are replaced by depositing the characters individually. This removes a dependency and may use fewer instructions.- To allow
Ctrl+U
to backspace across all of the characters to the left of the curso in one motion,microrl_backspace()
now takes a parameter for the number of spaces to move rather than always moving one.
- Implemented Echo control feature (method by
Maksim Chichikalov @m-chichikalov
)- When echo is disabled,
'*'
is printed to terminal instead of real characters for command buffer - Use
MICRORL_ECHO_ONCE
to disable echo for password input, echo mode will enabled after user press'Enter'
. - Use
MICRORL_ECHO_ON
orMICRORL_ECHO_OFF
to turn on or off the echo manually.
- When echo is disabled,
- Added smart newline handling: triggers once on any of CR, LF, CRLF or LFCR (
Tom Collins @tomlogic
commit is integrated) - Added
Ctrl+D
feature (delete character forward) - Refactoring the command line buffer tokenization function
- Removed the mechanism for replacing whitespaces with zeros
- Added optional Quoting feature to allow command args with spaces
- History refactoring
- It is now possible to use the history ring buffer larger than 256 bytes
- Stored records in the buffer no longer contain the record length in first byte. Only null-terminated strings are stored in the buffer. This is done at the cost of a slight increase in the resource requirements of the target system.
- It is now possible to use the history ring buffer larger than 256 bytes
- Added an explanations into README.md with Markdown formatting
- Added new examples
- STM32 example with full library functionality
- ESP8266 platformio example by
Maksim Chichikalov @m-chichikalov
with echo off feature
- Found bugs were fixed, and, of course, new ones were added ;)