]> Sergey Matveev's repositories - lynx-patches.git/commitdiff
Initial commit master
authorSergey Matveev <stargrave@stargrave.org>
Thu, 22 Dec 2022 08:26:49 +0000 (11:26 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 22 Dec 2022 08:26:49 +0000 (11:26 +0300)
edit-line.patch [new file with mode: 0644]
tmux-title0.patch [new file with mode: 0644]
tmux-title1.patch [new file with mode: 0644]

diff --git a/edit-line.patch b/edit-line.patch
new file mode 100644 (file)
index 0000000..ce956e2
--- /dev/null
@@ -0,0 +1,72 @@
+diff --git src/LYStrings.c src/LYStrings.c
+index 67c0b2b..c34cf30 100644
+--- src/LYStrings.c
++++ src/LYStrings.c
+@@ -270,6 +270,40 @@ int fancy_mouse(WINDOW * win, int row,
+     return cmd;
+ }
++// ------------------------ >8 ------------------------
++
++#include <assert.h>
++#include <ctype.h>
++#include <sys/stat.h>
++#define       typecalloc(cast)                (cast *)calloc((size_t)1, sizeof(cast))
++
++static char *readEditedFile(char *ed_temp)
++{
++    struct stat stat_info;
++    size_t size;
++    if ((stat(ed_temp, &stat_info) < 0) ||
++        !S_ISREG(stat_info.st_mode) ||
++        ((size = (size_t) stat_info.st_size) == 0)) {
++        return NULL;
++    }
++    char *ebuf = malloc(size + 1);
++    assert(ebuf != NULL);
++    FILE *fp = NULL;
++    if ((fp = fopen(ed_temp, "r")) != 0) {
++        size = fread(ebuf, (size_t) 1, size, fp);
++        LYCloseInput(fp);
++        ebuf[size] = '\0';
++    } else {
++        free(ebuf);
++        return NULL;
++    }
++    return ebuf;
++}
++
++#include <LYEdit.h>
++
++// ------------------------ >8 ------------------------
++
+ /*
+  * Manage the collection of edit-histories
+  */
+@@ -3380,8 +3414,24 @@ int LYDoEdit(FieldEditor * edit, int ch,
+           EditAt++;
+       break;
+-    case LYE_ERASE:           /* erase the line */
+-      Buffer[0] = '\0';
++    case LYE_ERASE: {
++        char *tmpPath = malloc(LY_MAXPATH);
++        FILE *fp = LYOpenTemp(tmpPath, "", "w");
++        assert(fp != 0);
++        fputs(Buffer, fp);
++        LYCloseTempFP(fp);
++        edit_temporary_file(tmpPath, "", NULL);
++        char *ebuf = readEditedFile(tmpPath);
++        free(tmpPath);
++        if (ebuf != NULL) {
++            FREE(Buffer);
++            Buffer = ebuf;
++            edit->efBufInUse = strlen(ebuf);
++            edit->efBufAlloc = edit->efBufInUse;
++            edit->efBufLimit = 0;
++        }
++    }
++
+ #ifdef ENHANCED_LINEEDIT
+       EditMark = -1;          /* Do not show the mark */
+ #endif
diff --git a/tmux-title0.patch b/tmux-title0.patch
new file mode 100644 (file)
index 0000000..25d3848
--- /dev/null
@@ -0,0 +1,35 @@
+--- src/GridText.c.orig        2017-07-04 20:27:07.000000000 +0300
++++ src/GridText.c     2019-11-19 18:51:34.136176000 +0300
+@@ -1658,6 +1658,17 @@
+     if (!text)
+       return;
++    /*
++     * Load the title field.  -FM
++     */
++    StrAllocCopy(title,
++               (HTAnchor_title(text->node_anchor) ?
++                HTAnchor_title(text->node_anchor) : " "));    /* "" -> " " */
++    LYReduceBlanks(title);
++    printf("\033]2;%s\a\n", title);
++    lynx_force_repaint();
++    LYrefresh();
++
+     lynx_start_title_color();
+ #ifdef USE_COLOR_STYLE
+ /* turn the TITLE style on */
+@@ -1667,14 +1678,6 @@
+       LynxChangeStyle(s_title, ABS_ON);
+     }
+ #endif /* USE_COLOR_STYLE */
+-
+-    /*
+-     * Load the title field.  -FM
+-     */
+-    StrAllocCopy(title,
+-               (HTAnchor_title(text->node_anchor) ?
+-                HTAnchor_title(text->node_anchor) : " "));    /* "" -> " " */
+-    LYReduceBlanks(title);
+     /*
+      * Generate the page indicator (percent) string.
diff --git a/tmux-title1.patch b/tmux-title1.patch
new file mode 100644 (file)
index 0000000..4c9658a
--- /dev/null
@@ -0,0 +1,25 @@
+--- src/LYMainLoop.c.orig      2019-12-17 14:28:07.862894000 +0300
++++ src/LYMainLoop.c   2019-12-17 14:28:14.917631000 +0300
+@@ -7179,12 +7179,14 @@
+       case LYK_QUIT:          /* quit */
+           if (handle_LYK_QUIT()) {
+               CleanupMainLoop();
++        printf("\033]2;\033\\");
+               return (EXIT_SUCCESS);
+           }
+           break;
+       case LYK_ABORT: /* don't ask the user about quitting */
+           CleanupMainLoop();
++        printf("\033]2;\033\\");
+           return (EXIT_SUCCESS);
+       case LYK_NEXT_PAGE:     /* next page */
+@@ -7427,6 +7429,7 @@
+           switch (handle_PREV_DOC(&cmd, &old_c, real_c)) {
+           case 1:
+               CleanupMainLoop();
++        printf("\033]2;\033\\");
+               return (EXIT_SUCCESS);
+           case 2:
+               goto new_cmd;