Skip to content

Commit

Permalink
Fix assertion violation when invoking help macro at end of help file.…
Browse files Browse the repository at this point in the history
… &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.
  • Loading branch information
rfivet committed Dec 20, 2023
1 parent 5b2884b commit 54145a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
14 changes: 7 additions & 7 deletions emacs.hlp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
-------------------------------------------------------------------------------
Expand Down Expand Up @@ -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 changes: 3 additions & 15 deletions eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) ;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 54145a4

Please sign in to comment.