From 1777b78f88ddf2089e51ad110e4390a30d25b0fe Mon Sep 17 00:00:00 2001 From: Shinya Sato Date: Sun, 17 Oct 2021 18:15:58 +0900 Subject: v0.4.2 --- Changelog.md | 14 ++++++++++++++ Makefile | 12 ++++++++++-- src/inpla.l | 2 +- src/inpla.y | 10 +++++++--- src/linenoise/.gitignore | 3 --- src/linenoise/linenoise-multiline.patch | 12 ++++++++++++ 6 files changed, 44 insertions(+), 9 deletions(-) delete mode 100644 src/linenoise/.gitignore create mode 100644 src/linenoise/linenoise-multiline.patch diff --git a/Changelog.md b/Changelog.md index 93f0c07..5919b0c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,19 @@ # Changelog +## v0.4.2 (16 October 2021) + +### Improved + +- Line edit was improved to support multi-line paste, according to the following suggestion: + https://github.com/antirez/linenoise/issues/43 + +- History in Line edit becomes available. + + +### Bug Fix +- Long length lists are printed out as abbreviation of 14-length lists, +though these were printed out as 1-length lists after putting long lists. + ## v0.4.1 (24 September 2021) diff --git a/Makefile b/Makefile index 13d52af..93dee59 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,10 @@ all: $(OBJ_DIR) $(TARGET) $(TARGET): $(OBJS) $(LIBS) $(CC) $(CFLAGS) $(INCLUDE) $(MYOPTION) -o $@ $(OBJS) $(LDFLAGS) -$(OBJ_DIR)/%.o: $(SRC_DIR)/linenoise/%.c +$(OBJ_DIR)/linenoise.o: $(SRC_DIR)/linenoise/linenoise.c + @if [ ! -f $(SRC_DIR)/linenoise/linenoise.c.orig ]; then \ + patch --backup --version-control=simple --suffix=.orig $(SRC_DIR)/linenoise/linenoise.c $(SRC_DIR)/linenoise/linenoise-multiline.patch; \ + fi $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< @@ -38,7 +41,12 @@ $(OBJ_DIR): fi clean: - rm -f $(TARGET) $(OBJ_DIR)/* *stackdump* + rm -f $(TARGET)* $(OBJ_DIR)/* *stackdump* + @if [ -f $(SRC_DIR)/linenoise/linenoise.c.orig ]; then \ + echo "mv -f $(SRC_DIR)/linenoise/linenoise.c.orig $(SRC_DIR)/linenoise/linenoise.c"; \ + mv -f $(SRC_DIR)/linenoise/linenoise.c.orig $(SRC_DIR)/linenoise/linenoise.c; \ + fi + thread: $(OBJS) $(LIBS) $(CC) $(CFLAGS) $(INCLUDE) $(MYOPTION) -DTHREAD -o $(TARGET) $(OBJS) $(LDFLAGS) -lpthread diff --git a/src/inpla.l b/src/inpla.l index 5547d32..f5b386d 100644 --- a/src/inpla.l +++ b/src/inpla.l @@ -33,7 +33,7 @@ static int mygetinput(char *buf, int size) { fprintf(stderr,"input line too long\n"); return YY_NULL; } sprintf(buf,"%s\n",line); linenoiseHistoryAdd(line); - //linenoiseHistorySave(".inpla.history.txt"); + linenoiseHistorySave(".inpla.history.txt"); free(line); return strlen(buf); } diff --git a/src/inpla.y b/src/inpla.y index 0089333..ff65f39 100644 --- a/src/inpla.y +++ b/src/inpla.y @@ -7,6 +7,8 @@ #include #include +#include "linenoise/linenoise.h" + #include "ast.h" #include "id_table.h" #include "name_table.h" @@ -46,8 +48,8 @@ int ActiveThreadNum=0; //#define YYDEBUG 1 -#define VERSION "0.4.1" -#define BUILT_DATE "22 Sept. 2021" +#define VERSION "0.4.2" +#define BUILT_DATE "16 Oct. 2021" extern FILE *yyin; @@ -1117,6 +1119,7 @@ void puts_term(VALUE ptr) { Puts_list_element++; if (Puts_list_element > PUTS_ELEMENTS_NUM) { printf("...]"); + Puts_list_element=0; break; } @@ -1331,7 +1334,7 @@ void freeAgentRec(VALUE ptr) { } else { if (BASIC(ptr)->id == ID_CONS) { if (IS_FIXNUM(AGENT(ptr)->port[0])) { - VALUE port1 = AGENT(ptr)->port[0]; + VALUE port1 = AGENT(ptr)->port[1]; freeAgent(ptr); ptr = port1; goto loop; } @@ -7574,6 +7577,7 @@ int main(int argc, char *argv[]) } + linenoiseHistoryLoad(".inpla.history.txt"); // the main loop of parsing and execution while(1) { diff --git a/src/linenoise/.gitignore b/src/linenoise/.gitignore deleted file mode 100644 index 7ab7825..0000000 --- a/src/linenoise/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -linenoise_example -*.dSYM -history.txt diff --git a/src/linenoise/linenoise-multiline.patch b/src/linenoise/linenoise-multiline.patch new file mode 100644 index 0000000..c7613c3 --- /dev/null +++ b/src/linenoise/linenoise-multiline.patch @@ -0,0 +1,12 @@ +258c258,260 +< if (tcsetattr(fd,TCSAFLUSH,&raw) < 0) goto fatal; +--- +> //if (tcsetattr(fd,TCSAFLUSH,&raw) < 0) goto fatal; +> // https://github.com/antirez/linenoise/issues/43 +> if (tcsetattr(fd,TCSADRAIN,&raw) < 0) goto fatal; +269c271,273 +< if (rawmode && tcsetattr(fd,TCSAFLUSH,&orig_termios) != -1) +--- +> // if (rawmode && tcsetattr(fd,TCSAFLUSH,&orig_termios) != -1) +> // https://github.com/antirez/linenoise/issues/43 +> if (rawmode && tcsetattr(fd,TCSADRAIN,&orig_termios) != -1) -- cgit v1.2.3