Files
2022-09-16 11:48:59 +08:00

225 lines
6.6 KiB
Diff

diff -crN '--exclude=.git' '--exclude=.gitee' '--exclude=.vscode' libedit/configure libedit_edit/configure
*** libedit/configure 2022-08-26 10:41:25.040000000 +0800
--- libedit_edit/configure 2022-08-26 10:41:02.532000000 +0800
***************
*** 3967,3973 ****
fi
! am__api_version='1.16'
# Find a good install program. We prefer a C program (faster),
--- 3967,3973 ----
fi
! am__api_version=$(automake --version |awk 'NR==1'| awk '{print $NF}'| awk -F'.' '{print $1"."$2}')
# Find a good install program. We prefer a C program (faster),
diff -crN '--exclude=.git' '--exclude=.gitee' '--exclude=.vscode' libedit/src/el.c libedit_edit/src/el.c
*** libedit/src/el.c 2022-08-26 10:41:25.044000000 +0800
--- libedit_edit/src/el.c 2022-08-26 10:41:02.536000000 +0800
***************
*** 620,626 ****
/* el_resize():
* Called from program when terminal is resized
*/
! void
el_resize(EditLine *el)
{
int lins, cols;
--- 620,626 ----
/* el_resize():
* Called from program when terminal is resized
*/
! int
el_resize(EditLine *el)
{
int lins, cols;
***************
*** 631,640 ****
(void) sigprocmask(SIG_BLOCK, &nset, &oset);
/* get the correct window size */
! if (terminal_get_size(el, &lins, &cols))
! terminal_change_size(el, lins, cols);
!
(void) sigprocmask(SIG_SETMASK, &oset, NULL);
}
--- 631,645 ----
(void) sigprocmask(SIG_BLOCK, &nset, &oset);
/* get the correct window size */
! if (terminal_get_size(el, &lins, &cols)) {
! if (terminal_change_size(el, lins, cols) == -1) {
! (void)fprintf(stdout, "WARNING: libedit had some internal error in terminal_change_size.\n");
! (void) sigprocmask(SIG_SETMASK, &oset, NULL);
! return -1;
! }
! }
(void) sigprocmask(SIG_SETMASK, &oset, NULL);
+ return 0;
}
diff -crN '--exclude=.git' '--exclude=.gitee' '--exclude=.vscode' libedit/src/histedit.h libedit_edit/src/histedit.h
*** libedit/src/histedit.h 2022-08-26 10:41:25.048000000 +0800
--- libedit_edit/src/histedit.h 2022-08-26 10:41:02.536000000 +0800
***************
*** 171,177 ****
* is set this is done automatically otherwise it is the responsibility
* of the application
*/
! void el_resize(EditLine *);
/*
* User-defined function interface.
--- 171,177 ----
* is set this is done automatically otherwise it is the responsibility
* of the application
*/
! int el_resize(EditLine *);
/*
* User-defined function interface.
diff -crN '--exclude=.git' '--exclude=.gitee' '--exclude=.vscode' libedit/src/read.c libedit_edit/src/read.c
*** libedit/src/read.c 2022-08-26 10:41:25.048000000 +0800
--- libedit_edit/src/read.c 2022-08-26 10:41:02.540000000 +0800
***************
*** 416,440 ****
return num_read;
}
! libedit_private void
read_prepare(EditLine *el)
{
if (el->el_flags & HANDLE_SIGNALS)
sig_set(el);
if (el->el_flags & NO_TTY)
! return;
if ((el->el_flags & (UNBUFFERED|EDIT_DISABLED)) == UNBUFFERED)
tty_rawmode(el);
/* This is relatively cheap, and things go terribly wrong if
we have the wrong size. */
! el_resize(el);
re_clear_display(el); /* reset the display stuff */
ch_reset(el);
re_refresh(el); /* print the prompt */
if (el->el_flags & UNBUFFERED)
terminal__flush(el);
}
libedit_private void
--- 416,445 ----
return num_read;
}
! libedit_private int
read_prepare(EditLine *el)
{
+ int rc;
if (el->el_flags & HANDLE_SIGNALS)
sig_set(el);
if (el->el_flags & NO_TTY)
! return 0;
if ((el->el_flags & (UNBUFFERED|EDIT_DISABLED)) == UNBUFFERED)
tty_rawmode(el);
/* This is relatively cheap, and things go terribly wrong if
we have the wrong size. */
! rc = el_resize(el);
! if (rc < 0) {
! return rc;
! }
re_clear_display(el); /* reset the display stuff */
ch_reset(el);
re_refresh(el); /* print the prompt */
if (el->el_flags & UNBUFFERED)
terminal__flush(el);
+ return 0;
}
libedit_private void
***************
*** 504,511 ****
}
#endif /* FIONREAD */
! if ((el->el_flags & UNBUFFERED) == 0)
! read_prepare(el);
if (el->el_flags & EDIT_DISABLED) {
if ((el->el_flags & UNBUFFERED) == 0)
--- 509,519 ----
}
#endif /* FIONREAD */
! if ((el->el_flags & UNBUFFERED) == 0) {
! if (read_prepare(el) < 0) {
! return NULL;
! }
! }
if (el->el_flags & EDIT_DISABLED) {
if ((el->el_flags & UNBUFFERED) == 0)
diff -crN '--exclude=.git' '--exclude=.gitee' '--exclude=.vscode' libedit/src/read.h libedit_edit/src/read.h
*** libedit/src/read.h 2022-08-26 10:41:25.048000000 +0800
--- libedit_edit/src/read.h 2022-08-26 10:41:02.540000000 +0800
***************
*** 37,43 ****
libedit_private int read_init(EditLine *);
libedit_private void read_end(struct el_read_t *);
! libedit_private void read_prepare(EditLine *);
libedit_private void read_finish(EditLine *);
libedit_private int el_read_setfn(struct el_read_t *, el_rfunc_t);
libedit_private el_rfunc_t el_read_getfn(struct el_read_t *);
--- 37,43 ----
libedit_private int read_init(EditLine *);
libedit_private void read_end(struct el_read_t *);
! libedit_private int read_prepare(EditLine *);
libedit_private void read_finish(EditLine *);
libedit_private int el_read_setfn(struct el_read_t *, el_rfunc_t);
libedit_private el_rfunc_t el_read_getfn(struct el_read_t *);
diff -crN '--exclude=.git' '--exclude=.gitee' '--exclude=.vscode' libedit/src/terminal.c libedit_edit/src/terminal.c
*** libedit/src/terminal.c 2022-08-26 10:41:25.048000000 +0800
--- libedit_edit/src/terminal.c 2022-08-26 10:41:02.540000000 +0800
***************
*** 588,593 ****
--- 588,594 ----
* NOTE THAT terminal_overwrite() WILL CHANGE
* el->el_cursor.h!!!
*/
+ if (el->el_display[el->el_cursor.v] && (el->el_display[el->el_cursor.v][el->el_cursor.h] != '\0'))
terminal_overwrite(el,
(wchar_t *)&el->el_display[
el->el_cursor.v][el->el_cursor.h],
***************
*** 654,661 ****
/* force the wrap to avoid the "magic"
* situation */
wchar_t c;
! if ((c = el->el_display[el->el_cursor.v]
! [el->el_cursor.h]) != '\0') {
terminal_overwrite(el, &c, (size_t)1);
while (el->el_display[el->el_cursor.v]
[el->el_cursor.h] == MB_FILL_CHAR)
--- 655,663 ----
/* force the wrap to avoid the "magic"
* situation */
wchar_t c;
! if (el->el_display[el->el_cursor.v] &&
! ((c = el->el_display[el->el_cursor.v]
! [el->el_cursor.h]) != '\0')) {
terminal_overwrite(el, &c, (size_t)1);
while (el->el_display[el->el_cursor.v]
[el->el_cursor.h] == MB_FILL_CHAR)