From 67fba9affa14f2f3cd30371568c01d39f3e5f4d4 Mon Sep 17 00:00:00 2001 From: David Moberg Date: Thu, 31 Aug 2023 03:18:39 +0200 Subject: fix(runtime/tutor): don't try to close fold when there is none (#24953) Problem: When double clicking a line starting with a #, the code assumes there is a fold there and tries to close it, resulting in an error if there isn't a fold. Solution: Check foldlevel before performing "zc". --- runtime/autoload/tutor.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/autoload/tutor.vim b/runtime/autoload/tutor.vim index 4da4213826..80c09488d5 100644 --- a/runtime/autoload/tutor.vim +++ b/runtime/autoload/tutor.vim @@ -29,7 +29,7 @@ function! tutor#MouseDoubleClick() if foldclosed(line('.')) > -1 normal! zo else - if match(getline('.'), '^#\{1,} ') > -1 + if match(getline('.'), '^#\{1,} ') > -1 && foldlevel(line('.')) > 0 silent normal! zc else call tutor#FollowLink(0) -- cgit