1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-03 08:46:33 -05:00

Fix assertion violation when invoking help macro at end of help file. &mid function was not safe to call on empty line, same for &mid.

Minor reformatting of help file to avoid content to be mistaken as section reference by help macro.
This commit is contained in:
Renaud 2023-12-20 13:07:04 +08:00
parent 5b2884b93c
commit 54145a48f8
2 changed files with 10 additions and 22 deletions

View File

@ -111,8 +111,8 @@ Pipe command .......... ^X @ Execute buffer ........ not bound
Search forward ........ Meta S :: End string with Meta.
Incremental search .... ^X S :: Search next ^X, stop Meta, cancel ^G.
Search reverse ........ ^R
Reverse incremental search Hunt forward .......... Alt-S
....................... ^X R Hunt backward ......... Alt-R
Reverse incremental Hunt forward .......... Alt-S
search ^X R Hunt backward ......... Alt-R
Replace string ........ Meta R
Query replace string .. Meta ^R :: Yes/no Y/N, replace rest !, cancel ^G.
-------------------------------------------------------------------------------
@ -164,9 +164,9 @@ Page overlap .......... $overlap :: # lines, default 0, 0 = 1/3 page
=> FILE NAME COMPLETION
File name completion can be used with all file commands (find-file,
view-file, ...) but it works only under UNIX and MS-DOS. It is invoked
by a <Space> or <Tab>. If there exist more than one possible completions
they are displayed one by one. If the file name contains wild card
characters, the name is expanded instead of simple completion. Special
characters can be entered verbatim by prefixing them with ^V (or ^Q).
view-file, ...). It is invoked by a <Space> or <Tab>. If there exist more
than one possible completions they are displayed one by one. If the file
name contains wild card characters, the name is expanded instead of simple
completion. Special characters can be entered verbatim by prefixing them
with ^V (or ^Q).
-------------------------------------------------------------------------------

18
eval.c
View File

@ -395,13 +395,8 @@ static const char *gtfun( char *fname) {
case UFLEFT:
sz1 = strlen( argv[ 0]) ;
sz = 0 ;
for( int i = atoi( argv[ 1]) ; i > 0 ; i -= 1) {
unicode_t c ;
for( int i = atoi( argv[ 1]) ; sz < sz1 && i > 0 ; i -= 1)
sz += utf8_to_unicode( argv[ 0], sz, sz1, &c) ;
if( sz == sz1)
break ;
}
if( sz >= ressize) {
free( result) ;
@ -431,19 +426,12 @@ static const char *gtfun( char *fname) {
case UFMID:
sz1 = strlen( argv[ 0]) ;
int start = 0 ;
for( i = atoi( argv[ 1]) - 1 ; i > 0 ; i -= 1) {
for( i = atoi( argv[ 1]) - 1 ; start < sz1 && i > 0 ; i -= 1)
start += utf8_to_unicode( argv[ 0], start, sz1, &c) ;
if( start == sz1)
break ;
}
sz = start ;
if( sz < sz1)
for( i = atoi( argv[ 2]) ; i > 0 ; i -= 1) {
for( i = atoi( argv[ 2]) ; sz < sz1 && i > 0 ; i -= 1)
sz += utf8_to_unicode( argv[ 0], sz, sz1, &c) ;
if( sz == sz1)
break ;
}
sz -= start ;
if( sz >= ressize) {