s4

changeset 948:1310b29b6ab1

Prevent \end completion when not enclosed with \begin
author HIROSE Yuuji <yuuji@gentei.org>
date Fri, 29 Oct 2021 17:21:43 +0900
parents b7f9c4ce8cbd
children d8a258cc8a7d
files s4-main.js
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/s4-main.js	Wed Oct 27 23:45:01 2021 +0900
     1.2 +++ b/s4-main.js	Fri Oct 29 17:21:43 2021 +0900
     1.3 @@ -669,9 +669,9 @@
     1.4  	    // e.preventDefault();
     1.5  	}
     1.6  	let inbegend = isInBeginEnd(area, pos);
     1.7 +	if (!inbegend) return;
     1.8  	let nextendpos = text.substr(pos).indexOf("\\end{");
     1.9  	let nextcurend = text.substr(pos).indexOf("\\end{"+inbegend+"}");
    1.10 -	console.log("ib="+inbegend+", nepos="+nextendpos+", ncur="+nextcurend);
    1.11  	if (nextcurend<0  || nextendpos!=nextcurend) {
    1.12  	    area.setRangeText("}\n\n\\end{"+inbegend+"}", pos, pos);
    1.13  	    area.selectionStart = pos+2;