Merge pull request #136 from sharelatex/ns-autocomplete-bugs

fixing popup and code folding issues
This commit is contained in:
Nate Stemen 2017-11-28 10:28:54 -05:00 committed by GitHub
commit 26df9bca05
2 changed files with 8 additions and 10 deletions

View file

@ -157,8 +157,6 @@ define [
if lastTwoChars.match(/^\\[^a-zA-Z]$/) if lastTwoChars.match(/^\\[^a-zA-Z]$/)
@editor?.completer?.detach?() @editor?.completer?.detach?()
return return
if commandName in ['begin', 'end']
return
# Check that this change was made by us, not a collaborator # Check that this change was made by us, not a collaborator
# (Cursor is still one place behind) # (Cursor is still one place behind)
# NOTE: this is also the case when a user backspaces over a highlighted region # NOTE: this is also the case when a user backspaces over a highlighted region

View file

@ -4,7 +4,7 @@ ace.define("ace/mode/latex_highlight_rules",["require","exports","module","ace/l
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var LatexHighlightRules = function() { var LatexHighlightRules = function() {
this.$rules = { this.$rules = {
"start" : [{ "start" : [{
@ -47,9 +47,9 @@ var LatexHighlightRules = function() {
token : "constant.character.escape", token : "constant.character.escape",
regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)" regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
}, { }, {
token : "error", token : "error",
regex : "^\\s*$", regex : "^\\s*$",
next : "start" next : "start"
}, { }, {
defaultToken : "string" defaultToken : "string"
}] }]
@ -76,16 +76,16 @@ oop.inherits(FoldMode, BaseFoldMode);
(function() { (function() {
this.foldingStartMarker = /^\s*\\(begin)|(section|subsection|paragraph)\b|{\s*$/; this.foldingStartMarker = /^\s*\\(begin|section|subsection|subsubsection|paragraph|part|chapter)\b|{\s*$/;
this.foldingStopMarker = /^\s*\\(end)\b|^\s*}/; this.foldingStopMarker = /^\s*\\(end)\b|^\s*}/;
this.getFoldWidgetRange = function(session, foldStyle, row) { this.getFoldWidgetRange = function(session, foldStyle, row) {
var line = session.doc.getLine(row); var line = session.doc.getLine(row);
var match = this.foldingStartMarker.exec(line); var match = this.foldingStartMarker.exec(line);
if (match) { if (match) {
if (match[1]) if (match[1] === "begin")
return this.latexBlock(session, row, match[0].length - 1); return this.latexBlock(session, row, match[0].length - 1);
if (match[2]) else if (match[1])
return this.latexSection(session, row, match[0].length - 1); return this.latexSection(session, row, match[0].length - 1);
return this.openingBracketBlock(session, "{", row, match.index); return this.openingBracketBlock(session, "{", row, match.index);
@ -153,7 +153,7 @@ oop.inherits(FoldMode, BaseFoldMode);
}; };
this.latexSection = function(session, row, column) { this.latexSection = function(session, row, column) {
var keywords = ["\\subsection", "\\section", "\\begin", "\\end", "\\paragraph"]; var keywords = ["\\subsection", "\\section", "\\begin", "\\end", "\\paragraph", "\\part", "\\chapter"];
var stream = new TokenIterator(session, row, column); var stream = new TokenIterator(session, row, column);
var token = stream.getCurrentToken(); var token = stream.getCurrentToken();