From a1b3148baf9f37831709b41c73270dc80db9b7b0 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Thu, 22 Dec 2022 11:26:49 +0300 Subject: [PATCH 1/1] Initial commit --- edit-line.patch | 72 +++++++++++++++++++++++++++++++++++++++++++++++ tmux-title0.patch | 35 +++++++++++++++++++++++ tmux-title1.patch | 25 ++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 edit-line.patch create mode 100644 tmux-title0.patch create mode 100644 tmux-title1.patch diff --git a/edit-line.patch b/edit-line.patch new file mode 100644 index 0000000..ce956e2 --- /dev/null +++ b/edit-line.patch @@ -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 ++#include ++#include ++#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 ++ ++// ------------------------ >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 index 0000000..25d3848 --- /dev/null +++ b/tmux-title0.patch @@ -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 index 0000000..4c9658a --- /dev/null +++ b/tmux-title1.patch @@ -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; -- 2.44.0