To: vim-dev@vim.org Subject: Patch 6.1.103 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.103 Problem: A function returning from a while loop, with 'verbose' set to 12 or higher, doesn't mention the return value. A function with the 'abort' attribute may return -1 while the verbose message says something else. Solution: Move the verbose message about returning from a function to call_func(). (Servatius Brandt) Files: src/eval.c *** ../vim61.102/src/eval.c Tue Jun 18 21:33:22 2002 --- src/eval.c Tue Jun 18 19:32:53 2002 *************** *** 8241,8246 **** --- 8247,8277 ---- DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT); --RedrawingDisabled; + + /* when the function was aborted because of an error, return -1 */ + if ((did_emsg && (fp->flags & FC_ABORT)) || retvar->var_type == VAR_UNKNOWN) + { + clear_var(retvar); + retvar->var_type = VAR_NUMBER; + retvar->var_val.var_number = -1; + } + + /* when being verbose, mention the return value */ + if (p_verbose >= 12) + { + ++no_wait_return; + msg_scroll = TRUE; /* always scroll up, don't overwrite */ + if (fc.retvar->var_type == VAR_NUMBER) + smsg((char_u *)_("%s returning #%ld"), sourcing_name, + (long)fc.retvar->var_val.var_number); + else if (fc.retvar->var_type == VAR_STRING) + smsg((char_u *)_("%s returning \"%s\""), sourcing_name, + get_var_string(fc.retvar)); + msg_puts((char_u *)"\n"); /* don't overwrite this either */ + cmdline_row = msg_row; + --no_wait_return; + } + vim_free(sourcing_name); sourcing_name = save_sourcing_name; sourcing_lnum = save_sourcing_lnum; *************** *** 8256,8268 **** --no_wait_return; } - /* when the function was aborted because of an error, return -1 */ - if ((did_emsg && (fp->flags & FC_ABORT)) || retvar->var_type == VAR_UNKNOWN) - { - clear_var(retvar); - retvar->var_type = VAR_NUMBER; - retvar->var_val.var_number = -1; - } did_emsg |= save_did_emsg; current_funccal = save_fcp; --- 8287,8292 ---- *************** *** 8375,8395 **** { retval = vim_strsave(((char_u **)(gap->ga_data))[fcp->linenr++]); sourcing_lnum = fcp->linenr; - } - - if (p_verbose >= 12 && retval == NULL) - { - ++no_wait_return; - msg_scroll = TRUE; /* always scroll up, don't overwrite */ - if (fcp->retvar->var_type == VAR_NUMBER) - smsg((char_u *)_("%s returning #%ld"), sourcing_name, - (long)fcp->retvar->var_val.var_number); - else if (fcp->retvar->var_type == VAR_STRING) - smsg((char_u *)_("%s returning \"%s\""), sourcing_name, - get_var_string(fcp->retvar)); - msg_puts((char_u *)"\n"); /* don't overwrite this either */ - cmdline_row = msg_row; - --no_wait_return; } /* Did we encounter a breakpoint? */ --- 8399,8404 ---- *** ../vim61.102/src/version.c Sun Jun 23 13:05:10 2002 --- src/version.c Sun Jun 23 13:07:11 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 103, /**/ -- When danger reared its ugly head, He bravely turned his tail and fled Yes, Brave Sir Robin turned about And gallantly he chickened out Bravely taking to his feet He beat a very brave retreat Bravest of the brave Sir Robin Petrified of being dead Soiled his pants then brave Sir Robin Turned away and fled. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///