Skip to content

Commit bc391b1

Browse files
committed
readline's handling of multiline input improved
1 parent 92dfc83 commit bc391b1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

arc.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2378,11 +2378,8 @@ A symbol can be coerced to a string.
23782378

23792379
while ((temp = readline("> ")) != NULL) {
23802380
input = temp;
2381+
free(temp);
23812382
read_start:
2382-
#ifdef READLINE
2383-
if (temp && *temp)
2384-
add_history(temp);
2385-
#endif
23862383

23872384
const char *p = input.c_str();
23882385
error err;
@@ -2394,8 +2391,12 @@ A symbol can be coerced to a string.
23942391
char *line = readline(" ");
23952392
if (!line) break;
23962393
input += std::string("\n") + line;
2394+
free(line);
23972395
goto read_start;
23982396
}
2397+
#ifdef READLINE
2398+
add_history(input.c_str());
2399+
#endif
23992400

24002401
if (!err) {
24012402
while (1) {
@@ -2421,7 +2422,6 @@ A symbol can be coerced to a string.
24212422
else {
24222423
print_error(err);
24232424
}
2424-
free(temp);
24252425
}
24262426
}
24272427
}

arc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#endif
3535

3636
namespace arc {
37-
constexpr auto VERSION = "0.25";
37+
constexpr auto VERSION = "0.26";
3838

3939
enum type {
4040
T_NIL,

0 commit comments

Comments
 (0)