Jim Tcl
Check-in [ad3fb99587]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:linenoise: Add ^Z (SUSP) support

Signed-off-by: Steve Bennett <steveb@workware.net.au>

Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ad3fb995872ce8351e6a826a2be930eab4395a39
User & Date: steveb@workware.net.au 2018-01-01 03:42:52
Context
2018-01-18
01:01
expr: prevent stack overflow

Limit the depth of the expressions to a reasonable level to prevent stack overflow

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: b878884ca8 user: steveb@workware.net.au tags: trunk

2018-01-01
03:42
linenoise: Add ^Z (SUSP) support

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: ad3fb99587 user: steveb@workware.net.au tags: trunk

2017-12-31
01:47
utf8: Update UnicodeData.txt and EastAsianWidth.txt to 10.0.0

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 5386172c24 user: steveb@workware.net.au tags: trunk

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to linenoise.c.

123
124
125
126
127
128
129

130
131

132
133
134
135
136
137
138
...
285
286
287
288
289
290
291


292
293
294
295
296
297
298
....
1226
1227
1228
1229
1230
1231
1232










1233
1234
1235
1236
1237
1238
1239

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>

#include <errno.h>
#include <string.h>

#include <stdlib.h>
#include <sys/types.h>

#include "linenoise.h"
#include "utf8.h"

#define LINENOISE_DEFAULT_HISTORY_MAX_LEN 100
................................................................................
{
    va_list args;
    char buf[64];
    int n;

    va_start(args, format);
    n = vsnprintf(buf, sizeof(buf), format, args);


    va_end(args);
    IGNORE_RC(write(fd, buf, n));
}

void linenoiseClearScreen(void)
{
    fd_printf(STDOUT_FILENO, "\x1b[H\x1b[2J");
................................................................................
        case '\r':    /* enter */
            history_len--;
            free(history[history_len]);
            return current->len;
        case ctrl('C'):     /* ctrl-c */
            errno = EAGAIN;
            return -1;










        case 127:   /* backspace */
        case ctrl('H'):
            if (remove_char(current, current->pos - 1) == 1) {
                refreshLine(current->prompt, current);
            }
            break;
        case ctrl('D'):     /* ctrl-d */







>


>







 







>
>







 







>
>
>
>
>
>
>
>
>
>







123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
...
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
....
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/types.h>

#include "linenoise.h"
#include "utf8.h"

#define LINENOISE_DEFAULT_HISTORY_MAX_LEN 100
................................................................................
{
    va_list args;
    char buf[64];
    int n;

    va_start(args, format);
    n = vsnprintf(buf, sizeof(buf), format, args);
    /* This will never happen because we are sure to use fd_printf() for short sequences */
    assert(n < sizeof(buf));
    va_end(args);
    IGNORE_RC(write(fd, buf, n));
}

void linenoiseClearScreen(void)
{
    fd_printf(STDOUT_FILENO, "\x1b[H\x1b[2J");
................................................................................
        case '\r':    /* enter */
            history_len--;
            free(history[history_len]);
            return current->len;
        case ctrl('C'):     /* ctrl-c */
            errno = EAGAIN;
            return -1;
        case ctrl('Z'):     /* ctrl-z */
#ifdef SIGTSTP
            /* send ourselves SIGSUSP */
            disableRawMode(current);
            raise(SIGTSTP);
            /* and resume */
            enableRawMode(current);
            refreshLine(current->prompt, current);
#endif
            continue;
        case 127:   /* backspace */
        case ctrl('H'):
            if (remove_char(current, current->pos - 1) == 1) {
                refreshLine(current->prompt, current);
            }
            break;
        case ctrl('D'):     /* ctrl-d */