Bug 1266267 - Upgrade to CodeMirror 5.14.2 r=bgrins

This commit is contained in:
Gabriel Luong 2016-04-26 11:44:18 -04:00
Родитель f0a32d7b64
Коммит 5e75c0a867
11 изменённых файлов: 111 добавлений и 98 удалений

Просмотреть файл

@ -5,7 +5,7 @@ code, and optionally help with indentation.
# Upgrade # Upgrade
Currently used version is 5.13.2. To upgrade, download a new version of Currently used version is 5.14.2. To upgrade, download a new version of
CodeMirror from the project's page [1] and replace all JavaScript and CodeMirror from the project's page [1] and replace all JavaScript and
CSS files inside the codemirror directory [2]. CSS files inside the codemirror directory [2].

Просмотреть файл

@ -44,9 +44,17 @@
} }
}); });
// Rough heuristic to try and detect lines that are part of multi-line string
function probablyInsideString(cm, pos, line) {
return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"`]/.test(line)
}
CodeMirror.defineExtension("lineComment", function(from, to, options) { CodeMirror.defineExtension("lineComment", function(from, to, options) {
if (!options) options = noOptions; if (!options) options = noOptions;
var self = this, mode = self.getModeAt(from); var self = this, mode = self.getModeAt(from);
var firstLine = self.getLine(from.line);
if (firstLine == null || probablyInsideString(self, from, firstLine)) return;
var commentString = options.lineComment || mode.lineComment; var commentString = options.lineComment || mode.lineComment;
if (!commentString) { if (!commentString) {
if (options.blockCommentStart || mode.blockCommentStart) { if (options.blockCommentStart || mode.blockCommentStart) {
@ -55,8 +63,7 @@
} }
return; return;
} }
var firstLine = self.getLine(from.line);
if (firstLine == null) return;
var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1); var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1);
var pad = options.padding == null ? " " : options.padding; var pad = options.padding == null ? " " : options.padding;
var blankLines = options.commentBlankLines || from.line == to.line; var blankLines = options.commentBlankLines || from.line == to.line;

Просмотреть файл

@ -108,15 +108,11 @@
}, },
update: function(first) { update: function(first) {
if (this.tick == null) return; if (this.tick == null) return
if (!this.options.hint.async) { var self = this, myTick = ++this.tick
this.finishUpdate(this.options.hint(this.cm, this.options), first); fetchHints(this.options.hint, this.cm, this.options, function(data) {
} else { if (self.tick == myTick) self.finishUpdate(data, first)
var myTick = ++this.tick, self = this; })
this.options.hint(this.cm, function(data) {
if (self.tick == myTick) self.finishUpdate(data, first);
}, this.options);
}
}, },
finishUpdate: function(data, first) { finishUpdate: function(data, first) {
@ -362,40 +358,31 @@
return result return result
} }
function fetchHints(hint, cm, options, callback) {
if (hint.async) {
hint(cm, callback, options)
} else {
var result = hint(cm, options)
if (result && result.then) result.then(callback)
else callback(result)
}
}
function resolveAutoHints(cm, pos) { function resolveAutoHints(cm, pos) {
var helpers = cm.getHelpers(pos, "hint"), words var helpers = cm.getHelpers(pos, "hint"), words
if (helpers.length) { if (helpers.length) {
var async = false, resolved var resolved = function(cm, callback, options) {
for (var i = 0; i < helpers.length; i++) if (helpers[i].async) async = true var app = applicableHelpers(cm, helpers);
if (async) { function run(i) {
resolved = function(cm, callback, options) { if (i == app.length) return callback(null)
var app = applicableHelpers(cm, helpers) fetchHints(app[i], cm, options, function(result) {
function run(i, result) { if (result && result.list.length > 0) callback(result)
if (i == app.length) return callback(null) else run(i + 1)
var helper = app[i] })
if (helper.async) {
helper(cm, function(result) {
if (result) callback(result)
else run(i + 1)
}, options)
} else {
var result = helper(cm, options)
if (result) callback(result)
else run(i + 1)
}
}
run(0)
}
resolved.async = true
} else {
resolved = function(cm, options) {
var app = applicableHelpers(cm, helpers)
for (var i = 0; i < app.length; i++) {
var cur = app[i](cm, options)
if (cur && cur.list.length) return cur
}
} }
run(0)
} }
resolved.async = true
resolved.supportsSelection = true resolved.supportsSelection = true
return resolved return resolved
} else if (words = cm.getHelper(cm.getCursor(), "hintWords")) { } else if (words = cm.getHelper(cm.getCursor(), "hintWords")) {

Просмотреть файл

@ -16,7 +16,7 @@
// highlighted only if the selected text is a word. showToken, when enabled, // highlighted only if the selected text is a word. showToken, when enabled,
// will cause the current token to be highlighted when nothing is selected. // will cause the current token to be highlighted when nothing is selected.
// delay is used to specify how much time to wait, in milliseconds, before // delay is used to specify how much time to wait, in milliseconds, before
// highlighting the matches. If annotateScrollbar is enabled, the occurances // highlighting the matches. If annotateScrollbar is enabled, the occurences
// will be highlighted on the scrollbar via the matchesonscrollbar addon. // will be highlighted on the scrollbar via the matchesonscrollbar addon.
(function(mod) { (function(mod) {
@ -29,24 +29,20 @@
})(function(CodeMirror) { })(function(CodeMirror) {
"use strict"; "use strict";
var DEFAULT_MIN_CHARS = 2; var defaults = {
var DEFAULT_TOKEN_STYLE = "matchhighlight"; style: "matchhighlight",
var DEFAULT_DELAY = 100; minChars: 2,
var DEFAULT_WORDS_ONLY = false; delay: 100,
wordsOnly: false,
annotateScrollbar: false,
showToken: false,
trim: true
}
function State(options) { function State(options) {
if (typeof options == "object") { this.options = {}
this.minChars = options.minChars; for (var name in defaults)
this.style = options.style; this.options[name] = (options && options.hasOwnProperty(name) ? options : defaults)[name]
this.showToken = options.showToken;
this.delay = options.delay;
this.wordsOnly = options.wordsOnly;
this.annotateScrollbar = options.annotateScrollbar;
}
if (this.style == null) this.style = DEFAULT_TOKEN_STYLE;
if (this.minChars == null) this.minChars = DEFAULT_MIN_CHARS;
if (this.delay == null) this.delay = DEFAULT_DELAY;
if (this.wordsOnly == null) this.wordsOnly = DEFAULT_WORDS_ONLY;
this.overlay = this.timeout = null; this.overlay = this.timeout = null;
this.matchesonscroll = null; this.matchesonscroll = null;
} }
@ -68,13 +64,13 @@
function cursorActivity(cm) { function cursorActivity(cm) {
var state = cm.state.matchHighlighter; var state = cm.state.matchHighlighter;
clearTimeout(state.timeout); clearTimeout(state.timeout);
state.timeout = setTimeout(function() {highlightMatches(cm);}, state.delay); state.timeout = setTimeout(function() {highlightMatches(cm);}, state.options.delay);
} }
function addOverlay(cm, query, hasBoundary, style) { function addOverlay(cm, query, hasBoundary, style) {
var state = cm.state.matchHighlighter; var state = cm.state.matchHighlighter;
cm.addOverlay(state.overlay = makeOverlay(query, hasBoundary, style)); cm.addOverlay(state.overlay = makeOverlay(query, hasBoundary, style));
if (state.annotateScrollbar) { if (state.options.annotateScrollbar && cm.showMatchesOnScrollbar) {
var searchFor = hasBoundary ? new RegExp("\\b" + query + "\\b") : query; var searchFor = hasBoundary ? new RegExp("\\b" + query + "\\b") : query;
state.matchesonscroll = cm.showMatchesOnScrollbar(searchFor, true, state.matchesonscroll = cm.showMatchesOnScrollbar(searchFor, true,
{className: "CodeMirror-selection-highlight-scrollbar"}); {className: "CodeMirror-selection-highlight-scrollbar"});
@ -86,7 +82,7 @@
if (state.overlay) { if (state.overlay) {
cm.removeOverlay(state.overlay); cm.removeOverlay(state.overlay);
state.overlay = null; state.overlay = null;
if (state.annotateScrollbar) { if (state.matchesonscroll) {
state.matchesonscroll.clear(); state.matchesonscroll.clear();
state.matchesonscroll = null; state.matchesonscroll = null;
} }
@ -97,21 +93,22 @@
cm.operation(function() { cm.operation(function() {
var state = cm.state.matchHighlighter; var state = cm.state.matchHighlighter;
removeOverlay(cm); removeOverlay(cm);
if (!cm.somethingSelected() && state.showToken) { if (!cm.somethingSelected() && state.options.showToken) {
var re = state.showToken === true ? /[\w$]/ : state.showToken; var re = state.options.showToken === true ? /[\w$]/ : state.options.showToken;
var cur = cm.getCursor(), line = cm.getLine(cur.line), start = cur.ch, end = start; var cur = cm.getCursor(), line = cm.getLine(cur.line), start = cur.ch, end = start;
while (start && re.test(line.charAt(start - 1))) --start; while (start && re.test(line.charAt(start - 1))) --start;
while (end < line.length && re.test(line.charAt(end))) ++end; while (end < line.length && re.test(line.charAt(end))) ++end;
if (start < end) if (start < end)
addOverlay(cm, line.slice(start, end), re, state.style); addOverlay(cm, line.slice(start, end), re, state.options.style);
return; return;
} }
var from = cm.getCursor("from"), to = cm.getCursor("to"); var from = cm.getCursor("from"), to = cm.getCursor("to");
if (from.line != to.line) return; if (from.line != to.line) return;
if (state.wordsOnly && !isWord(cm, from, to)) return; if (state.options.wordsOnly && !isWord(cm, from, to)) return;
var selection = cm.getRange(from, to).replace(/^\s+|\s+$/g, ""); var selection = cm.getRange(from, to)
if (selection.length >= state.minChars) if (state.options.trim) selection = selection.replace(/^\s+|\s+$/g, "")
addOverlay(cm, selection, false, state.style); if (selection.length >= state.options.minChars)
addOverlay(cm, selection, false, state.options.style);
}); });
} }

7
devtools/client/sourceeditor/codemirror/addon/search/search.js поставляемый Executable file → Normal file
Просмотреть файл

@ -136,7 +136,10 @@
persistentDialog(cm, queryDialog, q, function(query, event) { persistentDialog(cm, queryDialog, q, function(query, event) {
CodeMirror.e_stop(event); CodeMirror.e_stop(event);
if (!query) return; if (!query) return;
if (query != state.queryText) startSearch(cm, state, query); if (query != state.queryText) {
startSearch(cm, state, query);
state.posFrom = state.posTo = cm.getCursor();
}
if (hiding) hiding.style.opacity = 1 if (hiding) hiding.style.opacity = 1
findNext(cm, event.shiftKey, function(_, to) { findNext(cm, event.shiftKey, function(_, to) {
var dialog var dialog
@ -208,7 +211,7 @@
replaceAll(cm, query, text) replaceAll(cm, query, text)
} else { } else {
clearSearch(cm); clearSearch(cm);
var cursor = getSearchCursor(cm, query, cm.getCursor()); var cursor = getSearchCursor(cm, query, cm.getCursor("from"));
var advance = function() { var advance = function() {
var start = cursor.from(), match; var start = cursor.from(), match;
if (!(match = cursor.findNext())) { if (!(match = cursor.findNext())) {

Просмотреть файл

@ -179,7 +179,7 @@
var data = findDoc(ts, doc); var data = findDoc(ts, doc);
var argHints = ts.cachedArgHints; var argHints = ts.cachedArgHints;
if (argHints && argHints.doc == doc && cmpPos(argHints.start, change.to) <= 0) if (argHints && argHints.doc == doc && cmpPos(argHints.start, change.to) >= 0)
ts.cachedArgHints = null; ts.cachedArgHints = null;
var changed = data.changed; var changed = data.changed;
@ -306,7 +306,7 @@
ts.request(cm, {type: "type", preferFunction: true, end: start}, function(error, data) { ts.request(cm, {type: "type", preferFunction: true, end: start}, function(error, data) {
if (error || !data.type || !(/^fn\(/).test(data.type)) return; if (error || !data.type || !(/^fn\(/).test(data.type)) return;
ts.cachedArgHints = { ts.cachedArgHints = {
start: pos, start: start,
type: parseFnType(data.type), type: parseFnType(data.type),
name: data.exprName || data.name || "fn", name: data.exprName || data.name || "fn",
guess: data.guess, guess: data.guess,

Просмотреть файл

@ -55,6 +55,8 @@
cmds[map["Alt-Left"] = "goSubwordLeft"] = function(cm) { moveSubword(cm, -1); }; cmds[map["Alt-Left"] = "goSubwordLeft"] = function(cm) { moveSubword(cm, -1); };
cmds[map["Alt-Right"] = "goSubwordRight"] = function(cm) { moveSubword(cm, 1); }; cmds[map["Alt-Right"] = "goSubwordRight"] = function(cm) { moveSubword(cm, 1); };
if (mac) map["Cmd-Left"] = "goLineStartSmart";
var scrollLineCombo = mac ? "Ctrl-Alt-" : "Ctrl-"; var scrollLineCombo = mac ? "Ctrl-Alt-" : "Ctrl-";
cmds[map[scrollLineCombo + "Up"] = "scrollLineUp"] = function(cm) { cmds[map[scrollLineCombo + "Up"] = "scrollLineUp"] = function(cm) {

Просмотреть файл

@ -26,7 +26,7 @@
* 2. Variable declarations and short basic helpers * 2. Variable declarations and short basic helpers
* 3. Instance (External API) implementation * 3. Instance (External API) implementation
* 4. Internal state tracking objects (input state, counter) implementation * 4. Internal state tracking objects (input state, counter) implementation
* and instanstiation * and instantiation
* 5. Key handler (the main command dispatcher) implementation * 5. Key handler (the main command dispatcher) implementation
* 6. Motion, operator, and action implementations * 6. Motion, operator, and action implementations
* 7. Helper functions for the key handler, motions, operators, and actions * 7. Helper functions for the key handler, motions, operators, and actions
@ -226,6 +226,7 @@
{ name: 'sort', shortName: 'sor' }, { name: 'sort', shortName: 'sor' },
{ name: 'substitute', shortName: 's', possiblyAsync: true }, { name: 'substitute', shortName: 's', possiblyAsync: true },
{ name: 'nohlsearch', shortName: 'noh' }, { name: 'nohlsearch', shortName: 'noh' },
{ name: 'yank', shortName: 'y' },
{ name: 'delmarks', shortName: 'delm' }, { name: 'delmarks', shortName: 'delm' },
{ name: 'registers', shortName: 'reg', excludeFromCommandHistory: true }, { name: 'registers', shortName: 'reg', excludeFromCommandHistory: true },
{ name: 'global', shortName: 'g' } { name: 'global', shortName: 'g' }
@ -641,7 +642,7 @@
jumpList: createCircularJumpList(), jumpList: createCircularJumpList(),
macroModeState: new MacroModeState, macroModeState: new MacroModeState,
// Recording latest f, t, F or T motion command. // Recording latest f, t, F or T motion command.
lastChararacterSearch: {increment:0, forward:true, selectedCharacter:''}, lastCharacterSearch: {increment:0, forward:true, selectedCharacter:''},
registerController: new RegisterController({}), registerController: new RegisterController({}),
// search history buffer // search history buffer
searchHistoryController: new HistoryController({}), searchHistoryController: new HistoryController({}),
@ -1047,7 +1048,7 @@
}; };
function HistoryController() { function HistoryController() {
this.historyBuffer = []; this.historyBuffer = [];
this.iterator; this.iterator = 0;
this.initialPrefix = null; this.initialPrefix = null;
} }
HistoryController.prototype = { HistoryController.prototype = {
@ -1372,7 +1373,7 @@
} }
}, },
evalInput: function(cm, vim) { evalInput: function(cm, vim) {
// If the motion comand is set, execute both the operator and motion. // If the motion command is set, execute both the operator and motion.
// Otherwise return. // Otherwise return.
var inputState = vim.inputState; var inputState = vim.inputState;
var motion = inputState.motion; var motion = inputState.motion;
@ -1909,7 +1910,7 @@
}, },
repeatLastCharacterSearch: function(cm, head, motionArgs) { repeatLastCharacterSearch: function(cm, head, motionArgs) {
var lastSearch = vimGlobalState.lastChararacterSearch; var lastSearch = vimGlobalState.lastCharacterSearch;
var repeat = motionArgs.repeat; var repeat = motionArgs.repeat;
var forward = motionArgs.forward === lastSearch.forward; var forward = motionArgs.forward === lastSearch.forward;
var increment = (lastSearch.increment ? 1 : 0) * (forward ? -1 : 1); var increment = (lastSearch.increment ? 1 : 0) * (forward ? -1 : 1);
@ -3002,7 +3003,7 @@
// Only clip if the selection ends with trailing newline + whitespace // Only clip if the selection ends with trailing newline + whitespace
if (/\n\s*$/.test(selection)) { if (/\n\s*$/.test(selection)) {
var lines = selection.split('\n'); var lines = selection.split('\n');
// We know this is all whitepsace. // We know this is all whitespace.
lines.pop(); lines.pop();
// Cases: // Cases:
@ -3088,9 +3089,9 @@
} }
function recordLastCharacterSearch(increment, args) { function recordLastCharacterSearch(increment, args) {
vimGlobalState.lastChararacterSearch.increment = increment; vimGlobalState.lastCharacterSearch.increment = increment;
vimGlobalState.lastChararacterSearch.forward = args.forward; vimGlobalState.lastCharacterSearch.forward = args.forward;
vimGlobalState.lastChararacterSearch.selectedCharacter = args.selectedCharacter; vimGlobalState.lastCharacterSearch.selectedCharacter = args.selectedCharacter;
} }
var symbolToMode = { var symbolToMode = {
@ -3289,8 +3290,6 @@
line = cm.getLine(lineNum); line = cm.getLine(lineNum);
pos = (dir > 0) ? 0 : line.length; pos = (dir > 0) ? 0 : line.length;
} }
// Should never get here.
throw new Error('The impossible happened.');
} }
/** /**
@ -3452,7 +3451,7 @@
} }
// TODO: perhaps this finagling of start and end positions belonds // TODO: perhaps this finagling of start and end positions belonds
// in codmirror/replaceRange? // in codemirror/replaceRange?
function selectCompanionObject(cm, head, symb, inclusive) { function selectCompanionObject(cm, head, symb, inclusive) {
var cur = head, start, end; var cur = head, start, end;
@ -4514,14 +4513,21 @@
if (CodeMirror.commands.save) { if (CodeMirror.commands.save) {
// If a save command is defined, call it. // If a save command is defined, call it.
CodeMirror.commands.save(cm); CodeMirror.commands.save(cm);
} else { } else if (cm.save) {
// Saves to text area if no save command is defined. // Saves to text area if no save command is defined and cm.save() is available.
cm.save(); cm.save();
} }
}, },
nohlsearch: function(cm) { nohlsearch: function(cm) {
clearSearchHighlight(cm); clearSearchHighlight(cm);
}, },
yank: function (cm) {
var cur = copyCursor(cm.getCursor());
var line = cur.line;
var lineText = cm.getLine(line);
vimGlobalState.registerController.pushText(
'0', 'yank', lineText, true, true);
},
delmarks: function(cm, params) { delmarks: function(cm, params) {
if (!params.argString || !trim(params.argString)) { if (!params.argString || !trim(params.argString)) {
showConfirm(cm, 'Argument required'); showConfirm(cm, 'Argument required');

Просмотреть файл

@ -41,6 +41,7 @@
// This is woefully incomplete. Suggestions for alternative methods welcome. // This is woefully incomplete. Suggestions for alternative methods welcome.
var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent); var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
var mac = ios || /Mac/.test(platform); var mac = ios || /Mac/.test(platform);
var chromeOS = /\bCrOS\b/.test(userAgent);
var windows = /win/i.test(platform); var windows = /win/i.test(platform);
var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/); var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
@ -3680,7 +3681,7 @@
ourIndex = doc.sel.primIndex; ourIndex = doc.sel.primIndex;
} }
if (e.altKey) { if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {
type = "rect"; type = "rect";
if (!addNew) ourRange = new Range(start, start); if (!addNew) ourRange = new Range(start, start);
start = posFromMouse(cm, e, true, true); start = posFromMouse(cm, e, true, true);
@ -3905,6 +3906,7 @@
if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) return; if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) return;
e.dataTransfer.setData("Text", cm.getSelection()); e.dataTransfer.setData("Text", cm.getSelection());
e.dataTransfer.effectAllowed = "copyMove"
// Use dummy image instead of default browsers image. // Use dummy image instead of default browsers image.
// Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there. // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
@ -7625,9 +7627,9 @@
var spans = line.markedSpans; var spans = line.markedSpans;
if (spans) for (var i = 0; i < spans.length; i++) { if (spans) for (var i = 0; i < spans.length; i++) {
var span = spans[i]; var span = spans[i];
if (!(span.to != null && lineNo == from.line && from.ch > span.to || if (!(span.to != null && lineNo == from.line && from.ch >= span.to ||
span.from == null && lineNo != from.line || span.from == null && lineNo != from.line ||
span.from != null && lineNo == to.line && span.from > to.ch) && span.from != null && lineNo == to.line && span.from >= to.ch) &&
(!filter || filter(span.marker))) (!filter || filter(span.marker)))
found.push(span.marker.parent || span.marker); found.push(span.marker.parent || span.marker);
} }
@ -7646,9 +7648,9 @@
}, },
posFromIndex: function(off) { posFromIndex: function(off) {
var ch, lineNo = this.first; var ch, lineNo = this.first, sepSize = this.lineSeparator().length;
this.iter(function(line) { this.iter(function(line) {
var sz = line.text.length + 1; var sz = line.text.length + sepSize;
if (sz > off) { ch = off; return true; } if (sz > off) { ch = off; return true; }
off -= sz; off -= sz;
++lineNo; ++lineNo;
@ -7659,8 +7661,9 @@
coords = clipPos(this, coords); coords = clipPos(this, coords);
var index = coords.ch; var index = coords.ch;
if (coords.line < this.first || coords.ch < 0) return 0; if (coords.line < this.first || coords.ch < 0) return 0;
var sepSize = this.lineSeparator().length;
this.iter(this.first, coords.line, function (line) { this.iter(this.first, coords.line, function (line) {
index += line.text.length + 1; index += line.text.length + sepSize;
}); });
return index; return index;
}, },
@ -8889,7 +8892,7 @@
// THE END // THE END
CodeMirror.version = "5.13.2"; CodeMirror.version = "5.14.2";
return CodeMirror; return CodeMirror;
}); });

Просмотреть файл

@ -667,7 +667,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
def("text/x-objectivec", { def("text/x-objectivec", {
name: "clike", name: "clike",
keywords: words(cKeywords + "inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in " + keywords: words(cKeywords + "inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in " +
"inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"), "inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),
types: words(cTypes), types: words(cTypes),
atoms: words("YES NO NULL NILL ON OFF true false"), atoms: words("YES NO NULL NILL ON OFF true false"),

Просмотреть файл

@ -273,10 +273,10 @@ testJumplist('jumplist_repeat_<c-i>', ['*', '*', '*', '3', '<C-o>', '2', '<C-i>'
testJumplist('jumplist_repeated_motion', ['3', '*', '<C-o>'], [2,3], [2,3]); testJumplist('jumplist_repeated_motion', ['3', '*', '<C-o>'], [2,3], [2,3]);
testJumplist('jumplist_/', ['/', '<C-o>'], [2,3], [2,3], 'dialog'); testJumplist('jumplist_/', ['/', '<C-o>'], [2,3], [2,3], 'dialog');
testJumplist('jumplist_?', ['?', '<C-o>'], [2,3], [2,3], 'dialog'); testJumplist('jumplist_?', ['?', '<C-o>'], [2,3], [2,3], 'dialog');
testJumplist('jumplist_skip_delted_mark<c-o>', testJumplist('jumplist_skip_deleted_mark<c-o>',
['*', 'n', 'n', 'k', 'd', 'k', '<C-o>', '<C-o>', '<C-o>'], ['*', 'n', 'n', 'k', 'd', 'k', '<C-o>', '<C-o>', '<C-o>'],
[0,2], [0,2]); [0,2], [0,2]);
testJumplist('jumplist_skip_delted_mark<c-i>', testJumplist('jumplist_skip_deleted_mark<c-i>',
['*', 'n', 'n', 'k', 'd', 'k', '<C-o>', '<C-i>', '<C-i>'], ['*', 'n', 'n', 'k', 'd', 'k', '<C-o>', '<C-i>', '<C-i>'],
[1,0], [0,2]); [1,0], [0,2]);
@ -482,7 +482,7 @@ testVim('gj_gk', function(cm, vim, helpers) {
var topLeftCharCoords = cm.charCoords(makeCursor(0, 0)); var topLeftCharCoords = cm.charCoords(makeCursor(0, 0));
var endingCharCoords = cm.charCoords(endingPos); var endingCharCoords = cm.charCoords(endingPos);
is(topLeftCharCoords.left == endingCharCoords.left, 'gj should end up on column 0'); is(topLeftCharCoords.left == endingCharCoords.left, 'gj should end up on column 0');
},{ lineNumbers: false, lineWrapping:true, value: 'Thislineisintentiallylongtotestmovementofgjandgkoverwrappedlines.' }); },{ lineNumbers: false, lineWrapping:true, value: 'Thislineisintentionallylongtotestmovementofgjandgkoverwrappedlines.' });
testVim('}', function(cm, vim, helpers) { testVim('}', function(cm, vim, helpers) {
cm.setCursor(0, 0); cm.setCursor(0, 0);
helpers.doKeys('}'); helpers.doKeys('}');
@ -3682,7 +3682,7 @@ function testSubstituteConfirm(name, command, initialValue, expectedValue, keys,
} catch(e) { } catch(e) {
throw e throw e
} finally { } finally {
// Restore overriden functions. // Restore overridden functions.
CodeMirror.keyName = savedKeyName; CodeMirror.keyName = savedKeyName;
cm.openDialog = savedOpenDialog; cm.openDialog = savedOpenDialog;
} }
@ -3725,6 +3725,14 @@ testVim('ex_noh_clearSearchHighlight', function(cm, vim, helpers) {
helpers.doKeys('n'); helpers.doKeys('n');
helpers.assertCursorAt(0, 11,'can\'t resume search after clearing highlighting'); helpers.assertCursorAt(0, 11,'can\'t resume search after clearing highlighting');
}, { value: 'match nope match \n nope Match' }); }, { value: 'match nope match \n nope Match' });
testVim('ex_yank', function (cm, vim, helpers) {
var curStart = makeCursor(3, 0);
cm.setCursor(curStart);
helpers.doEx('y');
var register = helpers.getRegisterController().getRegister();
var line = cm.getLine(3);
eq(line + '\n', register.toString());
});
testVim('set_boolean', function(cm, vim, helpers) { testVim('set_boolean', function(cm, vim, helpers) {
CodeMirror.Vim.defineOption('testoption', true, 'boolean'); CodeMirror.Vim.defineOption('testoption', true, 'boolean');
// Test default value is set. // Test default value is set.