Added some more compatibility modes
This commit is contained in:
@@ -34,19 +34,23 @@
|
||||
#ifndef SIGWINCH
|
||||
#define SIGWINCH 28
|
||||
#endif
|
||||
#ifndef IUTF8
|
||||
#define IUTF8 0x4000
|
||||
#endif
|
||||
|
||||
/* terminal control macros (constants) */
|
||||
#define ERESET "\x1b[0m" /* reset the styling */
|
||||
#define CLS "\x1b[2J" /* clear the entire screen */
|
||||
#define LINECLR "\x1b[2K" /* clear the current line */
|
||||
#define CURRESET "\x1b[0;0H" /* reset the visual cursor */
|
||||
#ifdef NNE_NO_ALTBUF /* can be defined for legacy terminals */
|
||||
#define CURSHOW ""
|
||||
#define CURHIDE ""
|
||||
#define ALTBUFON ""
|
||||
#define ALTBUFOFF ""
|
||||
#else
|
||||
#define CURSHOW "\x1b[?25h" /* show the cursor */
|
||||
#define CURHIDE "\x1b[?25l" /* hide the cursor */
|
||||
#define ALTBUFON "\x1b[?47h" /* turn on alternate screen */
|
||||
#define ALTBUFON "\x1b[?47h\x1b%G" /* turn on alternate screen + UTF-8 */
|
||||
#define ALTBUFOFF "\x1b[?47l" /* turn off alternate screen */
|
||||
#endif
|
||||
|
||||
/* terminal control macros (sprintf templates) */
|
||||
#define CURSET "\x1b[%03u;%03uH" /* set the cursor position (line;col) */
|
||||
@@ -847,7 +851,7 @@ int nne_action(int key) {
|
||||
|
||||
int main(int argc, char* argv[]) { /* editor entry point */
|
||||
/* use the alternative screen buffer and enable UTF-8 */
|
||||
nnputs(ALTBUFON CLS "\x1b%G\x1b[?7h");
|
||||
nnputs(ALTBUFON CLS "\x1b[?7h");
|
||||
/* prepare screen */
|
||||
tcgetattr(0, &tty_opts_backup);
|
||||
atexit(&cleanup);
|
||||
@@ -860,7 +864,7 @@ int main(int argc, char* argv[]) { /* editor entry point */
|
||||
tty_opts_raw.c_cflag |= CS8;
|
||||
tty_opts_raw.c_cc[VMIN] = 0;
|
||||
tty_opts_raw.c_cc[VTIME] = 1;
|
||||
tty_opts_raw.c_iflag |= IUTF8;
|
||||
tty_opts_raw.c_iflag |= 0x4000; /* IUTF8 */
|
||||
tcsetattr(0, TCSANOW, &tty_opts_raw);
|
||||
nne_scrbuf = malloc(0); /* allocate the minimum for screen */
|
||||
resizehandler(SIGWINCH); /* populate the dimensions now */
|
||||
|
||||
Reference in New Issue
Block a user