vim-patch:8.2.3825: various comments could be improved

Problem:    Various comments could be improved.
Solution:   Improve the comments.
52797bae17
This commit is contained in:
zeertzjq 2021-12-16 23:05:52 +08:00
parent 56fa08b458
commit f59f81c32e
4 changed files with 24 additions and 23 deletions

View File

@ -1894,7 +1894,7 @@ static int handle_mapping(int *keylenp, bool *timedout, int *mapdepth)
// buffer right here. Otherwise, use the mapping (loop around). // buffer right here. Otherwise, use the mapping (loop around).
if (mp == NULL) { if (mp == NULL) {
*keylenp = keylen; *keylenp = keylen;
return map_result_get; // got character, break for loop return map_result_get; // get character from typeahead
} else { } else {
keylen = mp_match_len; keylen = mp_match_len;
} }
@ -2166,7 +2166,7 @@ static int vgetorpeek(bool advance)
KeyNoremap = typebuf.tb_noremap[typebuf.tb_off]; KeyNoremap = typebuf.tb_noremap[typebuf.tb_off];
del_typebuf(1, 0); del_typebuf(1, 0);
} }
break; break; // got character, break the for loop
} }
// not enough characters, get more // not enough characters, get more

View File

@ -1609,7 +1609,8 @@ void show_utf8(void)
msg((char *)IObuff); msg((char *)IObuff);
} }
/// Return offset from "p" to the first byte of the character it points into. /// Return offset from "p" to the start of a character, including composing characters.
/// "base" must be the start of the string, which must be NUL terminated.
/// If "p" points to the NUL at the end of the string return 0. /// If "p" points to the NUL at the end of the string return 0.
/// Returns 0 when already at the first byte of a character. /// Returns 0 when already at the first byte of a character.
int utf_head_off(const char_u *base, const char_u *p) int utf_head_off(const char_u *base, const char_u *p)
@ -1850,10 +1851,9 @@ int mb_off_next(char_u *base, char_u *p)
return i; return i;
} }
/* /// Return the offset from "p" to the last byte of the character it points
* Return the offset from "p" to the last byte of the character it points /// into. Can start anywhere in a stream of bytes.
* into. Can start anywhere in a stream of bytes. /// Composing characters are not included.
*/
int mb_tail_off(char_u *base, char_u *p) int mb_tail_off(char_u *base, char_u *p)
{ {
int i; int i;

View File

@ -18,22 +18,20 @@
#include "nvim/garray.h" #include "nvim/garray.h"
#include "nvim/os/input.h" #include "nvim/os/input.h"
/* // Logging of NFA engine.
* Logging of NFA engine. //
* // The NFA engine can write four log files:
* The NFA engine can write four log files: // - Error log: Contains NFA engine's fatal errors.
* - Error log: Contains NFA engine's fatal errors. // - Dump log: Contains compiled NFA state machine's information.
* - Dump log: Contains compiled NFA state machine's information. // - Run log: Contains information of matching procedure.
* - Run log: Contains information of matching procedure. // - Debug log: Contains detailed information of matching procedure. Can be
* - Debug log: Contains detailed information of matching procedure. Can be // disabled by undefining NFA_REGEXP_DEBUG_LOG.
* disabled by undefining NFA_REGEXP_DEBUG_LOG. // The first one can also be used without debug mode.
* The first one can also be used without debug mode. // The last three are enabled when compiled as debug mode and individually
* The last three are enabled when compiled as debug mode and individually // disabled by commenting them out.
* disabled by commenting them out. // The log files can get quite big!
* The log files can get quite big! // To disable all of this when compiling Vim for debugging, undefine REGEXP_DEBUG in
* Do disable all of this when compiling Vim for debugging, undefine REGEXP_DEBUG in // regexp.c
* regexp.c
*/
#ifdef REGEXP_DEBUG #ifdef REGEXP_DEBUG
# define NFA_REGEXP_ERROR_LOG "nfa_regexp_error.log" # define NFA_REGEXP_ERROR_LOG "nfa_regexp_error.log"
# define NFA_REGEXP_DUMP_LOG "nfa_regexp_dump.log" # define NFA_REGEXP_DUMP_LOG "nfa_regexp_dump.log"

View File

@ -1294,6 +1294,7 @@ func Test_edit_forbidden()
call assert_fails(':Sandbox', 'E48:') call assert_fails(':Sandbox', 'E48:')
delcom Sandbox delcom Sandbox
call assert_equal(['a'], getline(1,'$')) call assert_equal(['a'], getline(1,'$'))
" 2) edit with textlock set " 2) edit with textlock set
fu! DoIt() fu! DoIt()
call feedkeys("i\<del>\<esc>", 'tnix') call feedkeys("i\<del>\<esc>", 'tnix')
@ -1313,6 +1314,7 @@ func Test_edit_forbidden()
catch /^Vim\%((\a\+)\)\=:E117/ " catch E117: unknown function catch /^Vim\%((\a\+)\)\=:E117/ " catch E117: unknown function
endtry endtry
au! InsertCharPre au! InsertCharPre
" 3) edit when completion is shown " 3) edit when completion is shown
fun! Complete(findstart, base) fun! Complete(findstart, base)
if a:findstart if a:findstart
@ -1330,6 +1332,7 @@ func Test_edit_forbidden()
endtry endtry
delfu Complete delfu Complete
set completefunc= set completefunc=
if has("rightleft") && exists("+fkmap") if has("rightleft") && exists("+fkmap")
" 4) 'R' when 'fkmap' and 'revins' is set. " 4) 'R' when 'fkmap' and 'revins' is set.
set revins fkmap set revins fkmap