modify getColumns and getCursorPosition

This commit is contained in:
Данила Горнушко 2023-11-22 17:50:57 +03:00
parent e3fe13d3ea
commit 7c636e2c13
2 changed files with 676 additions and 550 deletions

File diff suppressed because it is too large Load diff

View file

@ -7,7 +7,7 @@
* *
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* *
* Copyright (c) 2010-2014, Salvatore Sanfilippo <antirez at gmail dot com> * Copyright (c) 2010-2023, Salvatore Sanfilippo <antirez at gmail dot com>
* Copyright (c) 2010-2013, Pieter Noordhuis <pcnoordhuis at gmail dot com> * Copyright (c) 2010-2013, Pieter Noordhuis <pcnoordhuis at gmail dot com>
* *
* All rights reserved. * All rights reserved.
@ -44,7 +44,7 @@ extern "C" {
#endif #endif
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h> /* For size_t. */
extern char *linenoiseEditMore; extern char *linenoiseEditMore;
@ -55,8 +55,6 @@ struct linenoiseState {
int in_completion; /* The user pressed TAB and we are now in completion int in_completion; /* The user pressed TAB and we are now in completion
* mode, so input is handled by completeLine(). */ * mode, so input is handled by completeLine(). */
size_t completion_idx; /* Index of next completion to propose. */ size_t completion_idx; /* Index of next completion to propose. */
int ifd; /* Terminal stdin file descriptor. */
int ofd; /* Terminal stdout file descriptor. */
char *buf; /* Edited line buffer. */ char *buf; /* Edited line buffer. */
size_t buflen; /* Edited line buffer size. */ size_t buflen; /* Edited line buffer size. */
const char *prompt; /* Prompt to display. */ const char *prompt; /* Prompt to display. */
@ -99,20 +97,22 @@ int linenoiseHistoryAdd(const char *line);
int linenoiseHistorySetMaxLen(int len); int linenoiseHistorySetMaxLen(int len);
int linenoiseHistorySave(const char *filename); int linenoiseHistorySave(const char *filename);
int linenoiseHistoryLoad(const char *filename); int linenoiseHistoryLoad(const char *filename);
// ESP-specific
void linenoiseHistoryFree(void); void linenoiseHistoryFree(void);
/* Other utilities. */ /* Other utilities. */
void linenoiseClearScreen(void); void linenoiseClearScreen(void);
void linenoiseSetMultiLine(int ml); void linenoiseSetMultiLine(int ml);
void linenoisePrintKeyCodes(void); void linenoisePrintKeyCodes(void);
// Allow empty input from console (Enter key) void linenoiseMaskModeEnable(void);
void linenoiseAllowEmpty(bool); void linenoiseMaskModeDisable(void);
int linenoiseSetMaxLineLen(size_t len); // ESP-specific
// Testing console for escape codes support
int linenoiseProbe(void); int linenoiseProbe(void);
// Dump mode for consoles withoud escape codes support
void linenoiseSetDumbMode(int set); void linenoiseSetDumbMode(int set);
bool linenoiseIsDumbMode(void); bool linenoiseIsDumbMode(void);
void linenoiseAllowEmpty(bool);
int linenoiseSetMaxLineLen(size_t len);
#ifdef __cplusplus #ifdef __cplusplus
} }