Mercurial > vim
comparison src/ex_getln.c @ 20717:abebcc20af26 v8.2.0911
patch 8.2.0911: crash when opening a buffer for the cmdline window fails
Commit: https://github.com/vim/vim/commit/9b7cce28d568f0622d77c6c9878c2d4770c3b164
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 6 15:14:08 2020 +0200
patch 8.2.0911: crash when opening a buffer for the cmdline window fails
Problem: Crash when opening a buffer for the cmdline window fails. (Chris
Barber)
Solution: Check do_ecmd() succeeds. Reset got_int if "q" was used at the
more prompt. (closes #6211)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 06 Jun 2020 15:15:03 +0200 |
parents | 06a1dd50463e |
children | e3078150144d |
comparison
equal
deleted
inserted
replaced
20716:3f0826b19029 | 20717:abebcc20af26 |
---|---|
680 | 680 |
681 // Parsing range may already set the last search pattern. | 681 // Parsing range may already set the last search pattern. |
682 // NOTE: must call restore_last_search_pattern() before returning! | 682 // NOTE: must call restore_last_search_pattern() before returning! |
683 save_last_search_pattern(); | 683 save_last_search_pattern(); |
684 | 684 |
685 if (!do_incsearch_highlighting(firstc, &search_delim, is_state, &skiplen, &patlen)) | 685 if (!do_incsearch_highlighting(firstc, &search_delim, is_state, |
686 &skiplen, &patlen)) | |
686 { | 687 { |
687 restore_last_search_pattern(); | 688 restore_last_search_pattern(); |
688 return FAIL; | 689 return FAIL; |
689 } | 690 } |
690 restore_last_search_pattern(); | 691 restore_last_search_pattern(); |
4203 { | 4204 { |
4204 beep_flush(); | 4205 beep_flush(); |
4205 ga_clear(&winsizes); | 4206 ga_clear(&winsizes); |
4206 return K_IGNORE; | 4207 return K_IGNORE; |
4207 } | 4208 } |
4209 // Don't let quitting the More prompt make this fail. | |
4210 got_int = FALSE; | |
4211 | |
4212 // Create the command-line buffer empty. | |
4213 if (do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL) == FAIL) | |
4214 { | |
4215 // Some autocommand messed it up? | |
4216 win_close(curwin, TRUE); | |
4217 ga_clear(&winsizes); | |
4218 return Ctrl_C; | |
4219 } | |
4208 cmdwin_type = get_cmdline_type(); | 4220 cmdwin_type = get_cmdline_type(); |
4209 | 4221 |
4210 // Create the command-line buffer empty. | |
4211 (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL); | |
4212 apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); | 4222 apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); |
4213 (void)setfname(curbuf, (char_u *)"[Command Line]", NULL, TRUE); | 4223 (void)setfname(curbuf, (char_u *)"[Command Line]", NULL, TRUE); |
4214 apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf); | 4224 apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf); |
4215 set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL); | 4225 set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL); |
4216 curbuf->b_p_ma = TRUE; | 4226 curbuf->b_p_ma = TRUE; |