@@ -15,182 +15,93 @@ <h1>CodeMirror: Verilog mode</h1>
<form><textarea id="code" name="code">
/* Verilog demo code */

//////////////////////////////////////////////////////////////////////
//// ////
//// wb_master_model.v ////
//// ////
//// This file is part of the SPI IP core project ////
//// http://www.opencores.org/projects/spi/ ////
//// ////
//// Author(s): ////
//// - Simon Srot (simons@opencores.org) ////
//// ////
//// Based on: ////
//// - i2c/bench/verilog/wb_master_model.v ////
//// Copyright (C) 2001 Richard Herveille ////
//// ////
//// All additional information is avaliable in the Readme.txt ////
//// file. ////
//// ////
//////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2002 Authors ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer. ////
//// ////
//// This source file is free software; you can redistribute it ////
//// and/or modify it under the terms of the GNU Lesser General ////
//// Public License as published by the Free Software Foundation; ////
//// either version 2.1 of the License, or (at your option) any ////
//// later version. ////
//// ////
//// This source is distributed in the hope that it will be ////
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
//// PURPOSE. See the GNU Lesser General Public License for more ////
//// details. ////
//// ////
//// You should have received a copy of the GNU Lesser General ////
//// Public License along with this source; if not, download it ////
//// from http://www.opencores.org/lgpl.shtml ////
//// ////
//////////////////////////////////////////////////////////////////////
module butterfly
#(
parameter WIDTH = 32,
parameter MWIDTH = 1
)
(
input wire clk,
input wire rst_n,
// m_in contains data that passes through this block with no change.
input wire [MWIDTH-1:0] m_in,
// The twiddle factor.
input wire signed [WIDTH-1:0] w,
// XA
input wire signed [WIDTH-1:0] xa,
// XB
input wire signed [WIDTH-1:0] xb,
// Set to 1 when new data is present on inputs.
input wire x_nd,
// delayed version of m_in.
output reg [MWIDTH-1:0] m_out,
// YA = XA + W*XB
// YB = XA - W*XB
output wire signed [WIDTH-1:0] ya,
output wire signed [WIDTH-1:0] yb,
output reg y_nd,
output reg error
);

`include "timescale.v"
// Set wire to the real and imag parts for convenience.
wire signed [WIDTH/2-1:0] xa_re;
wire signed [WIDTH/2-1:0] xa_im;
assign xa_re = xa[WIDTH-1:WIDTH/2];
assign xa_im = xa[WIDTH/2-1:0];
wire signed [WIDTH/2-1: 0] ya_re;
wire signed [WIDTH/2-1: 0] ya_im;
assign ya = {ya_re, ya_im};
wire signed [WIDTH/2-1: 0] yb_re;
wire signed [WIDTH/2-1: 0] yb_im;
assign yb = {yb_re, yb_im};

module wb_master_model(clk, rst, adr, din, dout, cyc, stb, we, sel, ack, err, rty);
// Delayed stuff.
reg signed [WIDTH/2-1:0] xa_re_z;
reg signed [WIDTH/2-1:0] xa_im_z;
// Output of multiplier
wire signed [WIDTH-1:0] xbw;
wire signed [WIDTH/2-1:0] xbw_re;
wire signed [WIDTH/2-1:0] xbw_im;
assign xbw_re = xbw[WIDTH-1:WIDTH/2];
assign xbw_im = xbw[WIDTH/2-1:0];
// Do summing
// I don't think we should get overflow here because of the
// size of the twiddle factors.
// If we do testing should catch it.
assign ya_re = xa_re_z + xbw_re;
assign ya_im = xa_im_z + xbw_im;
assign yb_re = xa_re_z - xbw_re;
assign yb_im = xa_im_z - xbw_im;

// Create the multiply module.
multiply_complex #(WIDTH) multiply_complex_0
(.clk(clk),
.rst_n(rst_n),
.x(xb),
.y(w),
.z(xbw)
);

parameter dwidth = 32;
parameter awidth = 32;

input clk, rst;
output [awidth -1:0] adr;
input [dwidth -1:0] din;
output [dwidth -1:0] dout;
output cyc, stb;
output we;
output [dwidth/8 -1:0] sel;
input ack, err, rty;

// Internal signals
reg [awidth -1:0] adr;
reg [dwidth -1:0] dout;
reg cyc, stb;
reg we;
reg [dwidth/8 -1:0] sel;

reg [dwidth -1:0] q;

// Memory Logic
initial
always @ (posedge clk)
begin
adr = {awidth{1'bx}};
dout = {dwidth{1'bx}};
cyc = 1'b0;
stb = 1'bx;
we = 1'hx;
sel = {dwidth/8{1'bx}};
#1;
if (!rst_n)
begin
y_nd <= 1'b0;
error <= 1'b0;
end
else
begin
// Set delay for x_nd_old and m.
y_nd <= x_nd;
m_out <= m_in;
if (x_nd)
begin
xa_re_z <= xa_re/2;
xa_im_z <= xa_im/2;
end
end
end

// Wishbone write cycle
task wb_write;
input delay;
integer delay;

input [awidth -1:0] a;
input [dwidth -1:0] d;

begin

// wait initial delay
repeat(delay) @(posedge clk);

// assert wishbone signal
#1;
adr = a;
dout = d;
cyc = 1'b1;
stb = 1'b1;
we = 1'b1;
sel = {dwidth/8{1'b1}};
@(posedge clk);

// wait for acknowledge from slave
while(~ack) @(posedge clk);

// negate wishbone signals
#1;
cyc = 1'b0;
stb = 1'bx;
adr = {awidth{1'bx}};
dout = {dwidth{1'bx}};
we = 1'hx;
sel = {dwidth/8{1'bx}};

end
endtask

// Wishbone read cycle
task wb_read;
input delay;
integer delay;

input [awidth -1:0] a;
output [dwidth -1:0] d;

begin

// wait initial delay
repeat(delay) @(posedge clk);

// assert wishbone signals
#1;
adr = a;
dout = {dwidth{1'bx}};
cyc = 1'b1;
stb = 1'b1;
we = 1'b0;
sel = {dwidth/8{1'b1}};
@(posedge clk);

// wait for acknowledge from slave
while(~ack) @(posedge clk);

// negate wishbone signals
#1;
cyc = 1'b0;
stb = 1'bx;
adr = {awidth{1'bx}};
dout = {dwidth{1'bx}};
we = 1'hx;
sel = {dwidth/8{1'bx}};
d = din;

end
endtask

// Wishbone compare cycle (read data from location and compare with expected data)
task wb_cmp;
input delay;
integer delay;

input [awidth -1:0] a;
input [dwidth -1:0] d_exp;

begin
wb_read (delay, a, q);

if (d_exp !== q) begin
$display("\n--- ERROR: At address 0x%0x, got 0x%0x, expected 0x%0x at time %t", a, q, d_exp, $time);
$stop;
end
end
endtask


endmodule
</textarea></form>

@@ -1,5 +1,7 @@
CodeMirror.defineMode("xml", function(config, parserConfig) {
var indentUnit = config.indentUnit;
var multilineTagIndentFactor = parserConfig.multilineTagIndentFactor || 1;

var Kludges = parserConfig.htmlMode ? {
autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
@@ -165,7 +167,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
};
}

var curState, setStyle;
var curState, curStream, setStyle;
function pass() {
for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]);
}
@@ -191,6 +193,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
function element(type) {
if (type == "openTag") {
curState.tagName = tagName;
curState.tagStart = curStream.column();
return cont(attributes, endtag(curState.startOfLine));
} else if (type == "closeTag") {
var err = false;
@@ -212,7 +215,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
function endtag(startOfLine) {
return function(type) {
var tagName = curState.tagName;
curState.tagName = null;
curState.tagName = curState.tagStart = null;
if (type == "selfcloseTag" ||
(type == "endTag" && Kludges.autoSelfClosers.hasOwnProperty(tagName.toLowerCase()))) {
maybePopContext(tagName.toLowerCase());
@@ -274,11 +277,11 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {

return {
startState: function() {
return {tokenize: inText, cc: [], indented: 0, startOfLine: true, tagName: null, context: null};
return {tokenize: inText, cc: [], indented: 0, startOfLine: true, tagName: null, tagStart: null, context: null};
},

token: function(stream, state) {
if (stream.sol()) {
if (!state.tagName && stream.sol()) {
state.startOfLine = true;
state.indented = stream.indentation();
}
@@ -288,7 +291,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
var style = state.tokenize(stream, state);
state.type = type;
if ((style || type) && style != "comment") {
curState = state;
curState = state; curStream = stream;
while (true) {
var comb = state.cc.pop() || element;
if (comb(type || style)) break;
@@ -303,6 +306,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
if ((state.tokenize != inTag && state.tokenize != inText) ||
context && context.noIndent)
return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
if (state.tagName) return state.tagStart + indentUnit * multilineTagIndentFactor;
if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
if (context && /^<\//.test(textAfter))
context = context.prev;
@@ -1,7 +1,7 @@
{
"name": "codemirror",
"version":"3.10.00",
"main": "codemirror.js",
"version":"3.11.00",
"main": "lib/codemirror.js",
"description": "In-browser code editing made bearable",
"licenses": [{"type": "MIT",
"url": "http://codemirror.net/LICENSE"}],
@@ -56,6 +56,7 @@ <h1>CodeMirror: Test Suite</h1>
<script src="mode_test.js"></script>
<script src="../mode/css/css.js"></script>
<script src="../mode/css/test.js"></script>
<script src="../mode/css/scss_test.js"></script>
<script src="../mode/markdown/markdown.js"></script>
<script src="../mode/markdown/test.js"></script>
<script src="../mode/gfm/gfm.js"></script>
@@ -59,9 +59,9 @@
return {tokens: tokens, plain: plain};
}

test.mode = function(name, mode, tokens) {
test.mode = function(name, mode, tokens, modeName) {
var data = parseTokens(tokens);
return test(mode.name + "_" + name, function() {
return test((modeName || mode.name) + "_" + name, function() {
return compare(data.plain, data.tokens, mode);
});
};
@@ -512,6 +512,7 @@ testCM("scrollSnap", function(cm) {
});

testCM("selectionPos", function(cm) {
if (phantom) return;
cm.setSize(100, 100);
addDoc(cm, 200, 100);
cm.setSelection(Pos(1, 100), Pos(98, 100));
@@ -909,15 +910,43 @@ testCM("wordMovementCommands", function(cm) {
cm.execCommand("goWordLeft");
eqPos(cm.getCursor(), Pos(0, 9));
cm.execCommand("goWordRight"); cm.execCommand("goWordRight"); cm.execCommand("goWordRight");
eqPos(cm.getCursor(), Pos(1, 1));
cm.execCommand("goWordRight");
eqPos(cm.getCursor(), Pos(0, 24));
cm.execCommand("goWordRight"); cm.execCommand("goWordRight");
eqPos(cm.getCursor(), Pos(1, 9));
cm.execCommand("goWordRight");
eqPos(cm.getCursor(), Pos(1, 13));
cm.execCommand("goWordRight"); cm.execCommand("goWordRight");
eqPos(cm.getCursor(), Pos(2, 0));
}, {value: "this is (the) firstline.\na foo12\u00e9\u00f8\u00d7bar\n"});

testCM("groupMovementCommands", function(cm) {
cm.execCommand("goGroupLeft");
eqPos(cm.getCursor(), Pos(0, 0));
cm.execCommand("goGroupRight");
eqPos(cm.getCursor(), Pos(0, 4));
cm.execCommand("goGroupRight");
eqPos(cm.getCursor(), Pos(0, 7));
cm.execCommand("goGroupRight");
eqPos(cm.getCursor(), Pos(0, 10));
cm.execCommand("goGroupLeft");
eqPos(cm.getCursor(), Pos(0, 7));
cm.execCommand("goGroupRight"); cm.execCommand("goGroupRight"); cm.execCommand("goGroupRight");
eqPos(cm.getCursor(), Pos(0, 15));
cm.setCursor(Pos(0, 17));
cm.execCommand("goGroupLeft");
eqPos(cm.getCursor(), Pos(0, 16));
cm.execCommand("goGroupLeft");
eqPos(cm.getCursor(), Pos(0, 14));
cm.execCommand("goGroupRight"); cm.execCommand("goGroupRight");
eqPos(cm.getCursor(), Pos(0, 20));
cm.execCommand("goGroupRight");
eqPos(cm.getCursor(), Pos(1, 5));
cm.execCommand("goGroupLeft"); cm.execCommand("goGroupLeft");
eqPos(cm.getCursor(), Pos(1, 0));
cm.execCommand("goGroupLeft");
eqPos(cm.getCursor(), Pos(0, 16));
}, {value: "booo ba---quux. ffff\n abc d"});

testCM("charMovementCommands", function(cm) {
cm.execCommand("goCharLeft"); cm.execCommand("goColumnLeft");
eqPos(cm.getCursor(), Pos(0, 0));
@@ -1049,6 +1078,7 @@ testCM("lineChangeEvents", function(cm) {
});

testCM("scrollEntirelyToRight", function(cm) {
if (phantom) return;
addDoc(cm, 500, 2);
cm.setCursor(Pos(0, 500));
var wrap = cm.getWrapperElement(), cur = byClassName(wrap, "CodeMirror-cursor")[0];
@@ -1268,7 +1298,7 @@ testCM("addKeyMap", function(cm) {
sendKey(39);
eqPos(cm.getCursor(), Pos(0, 1));
eq(test, 1);
cm.addKeyMap(map2);
cm.addKeyMap(map2, true);
sendKey(39);
eq(test, 2);
cm.removeKeyMap(map1);
@@ -1342,4 +1372,29 @@ testCM("beforeSelectionChange", function(cm) {
cm.execCommand("selectAll");
eqPos(cm.getCursor("start"), Pos(0, 0));
eqPos(cm.getCursor("end"), Pos(9, 9));
});
});

testCM("change_removedText", function(cm) {
cm.setValue("abc\ndef");

var removedText;
cm.on("change", function(cm, change) {
removedText = [change.removed, change.next && change.next.removed];
});

cm.operation(function() {
cm.replaceRange("xyz", Pos(0, 0), Pos(1,1));
cm.replaceRange("123", Pos(0,0));
});

eq(removedText[0].join("\n"), "abc\nd");
eq(removedText[1].join("\n"), "");

cm.undo();
eq(removedText[0].join("\n"), "123");
eq(removedText[1].join("\n"), "xyz");

cm.redo();
eq(removedText[0].join("\n"), "abc\nd");
eq(removedText[1].join("\n"), "");
});
@@ -54,7 +54,8 @@ var bigWord3 = {
var bigWord4 = {
start: { line: bigWordLine.line, ch: bigWord1.end.ch + 3 },
end: { line: bigWordLine.line, ch: bigWord1.end.ch + 7 }
}
};

var oChars = [ { line: charLine.line, ch: 1 },
{ line: charLine.line, ch: 3 },
{ line: charLine.line, ch: 7 } ];
@@ -225,6 +226,9 @@ testMotion('G_repeat', ['3', 'G'], makeCursor(lines[2].line,
// TODO: Make the test code long enough to test Ctrl-F and Ctrl-B.
testMotion('0', '0', makeCursor(0, 0), makeCursor(0, 8));
testMotion('^', '^', makeCursor(0, lines[0].textStart), makeCursor(0, 8));
testMotion('+', '+', makeCursor(1, lines[1].textStart), makeCursor(0, 8));
testMotion('-', '-', makeCursor(0, lines[0].textStart), makeCursor(1, 4));
testMotion('_', ['6','_'], makeCursor(5, lines[5].textStart), makeCursor(0, 8));
testMotion('$', '$', makeCursor(0, lines[0].length - 1), makeCursor(0, 1));
testMotion('$_repeat', ['2', '$'], makeCursor(1, lines[1].length - 1),
makeCursor(0, 3));
@@ -793,9 +797,12 @@ testVim('P_line', function(cm, vim, helpers) {
testVim('r', function(cm, vim, helpers) {
cm.setCursor(0, 1);
helpers.doKeys('3', 'r', 'u');
eq('wuuuet', cm.getValue());
eq('wuuuet\nanother', cm.getValue(),'3r failed');
helpers.assertCursorAt(0, 3);
}, { value: 'wordet' });
cm.setCursor(0, 4);
helpers.doKeys('v', 'j', 'h', 'r', 'Space');
eq('wuuu \n her', cm.getValue(),'Replacing selection by space-characters failed');
}, { value: 'wordet\nanother' });
testVim('mark', function(cm, vim, helpers) {
cm.setCursor(2, 2);
helpers.doKeys('m', 't');
@@ -806,6 +813,242 @@ testVim('mark', function(cm, vim, helpers) {
helpers.doKeys('`', 't');
helpers.assertCursorAt(2, 2);
});
testVim('jumpToMark_next', function(cm, vim, helpers) {
cm.setCursor(2, 2);
helpers.doKeys('m', 't');
cm.setCursor(0, 0);
helpers.doKeys(']', '`');
helpers.assertCursorAt(2, 2);
cm.setCursor(0, 0);
helpers.doKeys(']', '\'');
helpers.assertCursorAt(2, 0);
});
testVim('jumpToMark_next_repeat', function(cm, vim, helpers) {
cm.setCursor(2, 2);
helpers.doKeys('m', 'a');
cm.setCursor(3, 2);
helpers.doKeys('m', 'b');
cm.setCursor(4, 2);
helpers.doKeys('m', 'c');
cm.setCursor(0, 0);
helpers.doKeys('2', ']', '`');
helpers.assertCursorAt(3, 2);
cm.setCursor(0, 0);
helpers.doKeys('2', ']', '\'');
helpers.assertCursorAt(3, 1);
});
testVim('jumpToMark_next_sameline', function(cm, vim, helpers) {
cm.setCursor(2, 0);
helpers.doKeys('m', 'a');
cm.setCursor(2, 4);
helpers.doKeys('m', 'b');
cm.setCursor(2, 2);
helpers.doKeys(']', '`');
helpers.assertCursorAt(2, 4);
});
testVim('jumpToMark_next_onlyprev', function(cm, vim, helpers) {
cm.setCursor(2, 0);
helpers.doKeys('m', 'a');
cm.setCursor(4, 0);
helpers.doKeys(']', '`');
helpers.assertCursorAt(4, 0);
});
testVim('jumpToMark_next_nomark', function(cm, vim, helpers) {
cm.setCursor(2, 2);
helpers.doKeys(']', '`');
helpers.assertCursorAt(2, 2);
helpers.doKeys(']', '\'');
helpers.assertCursorAt(2, 0);
});
testVim('jumpToMark_next_linewise_over', function(cm, vim, helpers) {
cm.setCursor(2, 2);
helpers.doKeys('m', 'a');
cm.setCursor(3, 4);
helpers.doKeys('m', 'b');
cm.setCursor(2, 1);
helpers.doKeys(']', '\'');
helpers.assertCursorAt(3, 1);
});
testVim('jumpToMark_next_action', function(cm, vim, helpers) {
cm.setCursor(2, 2);
helpers.doKeys('m', 't');
cm.setCursor(0, 0);
helpers.doKeys('d', ']', '`');
helpers.assertCursorAt(0, 0);
var actual = cm.getLine(0);
var expected = 'pop pop 0 1 2 3 4';
eq(actual, expected, "Deleting while jumping to the next mark failed.");
});
testVim('jumpToMark_next_line_action', function(cm, vim, helpers) {
cm.setCursor(2, 2);
helpers.doKeys('m', 't');
cm.setCursor(0, 0);
helpers.doKeys('d', ']', '\'');
helpers.assertCursorAt(0, 1);
var actual = cm.getLine(0);
var expected = ' (a) [b] {c} '
eq(actual, expected, "Deleting while jumping to the next mark line failed.");
});
testVim('jumpToMark_prev', function(cm, vim, helpers) {
cm.setCursor(2, 2);
helpers.doKeys('m', 't');
cm.setCursor(4, 0);
helpers.doKeys('[', '`');
helpers.assertCursorAt(2, 2);
cm.setCursor(4, 0);
helpers.doKeys('[', '\'');
helpers.assertCursorAt(2, 0);
});
testVim('jumpToMark_prev_repeat', function(cm, vim, helpers) {
cm.setCursor(2, 2);
helpers.doKeys('m', 'a');
cm.setCursor(3, 2);
helpers.doKeys('m', 'b');
cm.setCursor(4, 2);
helpers.doKeys('m', 'c');
cm.setCursor(5, 0);
helpers.doKeys('2', '[', '`');
helpers.assertCursorAt(3, 2);
cm.setCursor(5, 0);
helpers.doKeys('2', '[', '\'');
helpers.assertCursorAt(3, 1);
});
testVim('jumpToMark_prev_sameline', function(cm, vim, helpers) {
cm.setCursor(2, 0);
helpers.doKeys('m', 'a');
cm.setCursor(2, 4);
helpers.doKeys('m', 'b');
cm.setCursor(2, 2);
helpers.doKeys('[', '`');
helpers.assertCursorAt(2, 0);
});
testVim('jumpToMark_prev_onlynext', function(cm, vim, helpers) {
cm.setCursor(4, 4);
helpers.doKeys('m', 'a');
cm.setCursor(2, 0);
helpers.doKeys('[', '`');
helpers.assertCursorAt(2, 0);
});
testVim('jumpToMark_prev_nomark', function(cm, vim, helpers) {
cm.setCursor(2, 2);
helpers.doKeys('[', '`');
helpers.assertCursorAt(2, 2);
helpers.doKeys('[', '\'');
helpers.assertCursorAt(2, 0);
});
testVim('jumpToMark_prev_linewise_over', function(cm, vim, helpers) {
cm.setCursor(2, 2);
helpers.doKeys('m', 'a');
cm.setCursor(3, 4);
helpers.doKeys('m', 'b');
cm.setCursor(3, 6);
helpers.doKeys('[', '\'');
helpers.assertCursorAt(2, 0);
});
testVim('delmark_single', function(cm, vim, helpers) {
cm.setCursor(1, 2);
helpers.doKeys('m', 't');
helpers.doEx('delmarks t');
cm.setCursor(0, 0);
helpers.doKeys('`', 't');
helpers.assertCursorAt(0, 0);
});
testVim('delmark_range', function(cm, vim, helpers) {
cm.setCursor(1, 2);
helpers.doKeys('m', 'a');
cm.setCursor(2, 2);
helpers.doKeys('m', 'b');
cm.setCursor(3, 2);
helpers.doKeys('m', 'c');
cm.setCursor(4, 2);
helpers.doKeys('m', 'd');
cm.setCursor(5, 2);
helpers.doKeys('m', 'e');
helpers.doEx('delmarks b-d');
cm.setCursor(0, 0);
helpers.doKeys('`', 'a');
helpers.assertCursorAt(1, 2);
helpers.doKeys('`', 'b');
helpers.assertCursorAt(1, 2);
helpers.doKeys('`', 'c');
helpers.assertCursorAt(1, 2);
helpers.doKeys('`', 'd');
helpers.assertCursorAt(1, 2);
helpers.doKeys('`', 'e');
helpers.assertCursorAt(5, 2);
});
testVim('delmark_multi', function(cm, vim, helpers) {
cm.setCursor(1, 2);
helpers.doKeys('m', 'a');
cm.setCursor(2, 2);
helpers.doKeys('m', 'b');
cm.setCursor(3, 2);
helpers.doKeys('m', 'c');
cm.setCursor(4, 2);
helpers.doKeys('m', 'd');
cm.setCursor(5, 2);
helpers.doKeys('m', 'e');
helpers.doEx('delmarks bcd');
cm.setCursor(0, 0);
helpers.doKeys('`', 'a');
helpers.assertCursorAt(1, 2);
helpers.doKeys('`', 'b');
helpers.assertCursorAt(1, 2);
helpers.doKeys('`', 'c');
helpers.assertCursorAt(1, 2);
helpers.doKeys('`', 'd');
helpers.assertCursorAt(1, 2);
helpers.doKeys('`', 'e');
helpers.assertCursorAt(5, 2);
});
testVim('delmark_multi_space', function(cm, vim, helpers) {
cm.setCursor(1, 2);
helpers.doKeys('m', 'a');
cm.setCursor(2, 2);
helpers.doKeys('m', 'b');
cm.setCursor(3, 2);
helpers.doKeys('m', 'c');
cm.setCursor(4, 2);
helpers.doKeys('m', 'd');
cm.setCursor(5, 2);
helpers.doKeys('m', 'e');
helpers.doEx('delmarks b c d');
cm.setCursor(0, 0);
helpers.doKeys('`', 'a');
helpers.assertCursorAt(1, 2);
helpers.doKeys('`', 'b');
helpers.assertCursorAt(1, 2);
helpers.doKeys('`', 'c');
helpers.assertCursorAt(1, 2);
helpers.doKeys('`', 'd');
helpers.assertCursorAt(1, 2);
helpers.doKeys('`', 'e');
helpers.assertCursorAt(5, 2);
});
testVim('delmark_all', function(cm, vim, helpers) {
cm.setCursor(1, 2);
helpers.doKeys('m', 'a');
cm.setCursor(2, 2);
helpers.doKeys('m', 'b');
cm.setCursor(3, 2);
helpers.doKeys('m', 'c');
cm.setCursor(4, 2);
helpers.doKeys('m', 'd');
cm.setCursor(5, 2);
helpers.doKeys('m', 'e');
helpers.doEx('delmarks a b-de');
cm.setCursor(0, 0);
helpers.doKeys('`', 'a');
helpers.assertCursorAt(0, 0);
helpers.doKeys('`', 'b');
helpers.assertCursorAt(0, 0);
helpers.doKeys('`', 'c');
helpers.assertCursorAt(0, 0);
helpers.doKeys('`', 'd');
helpers.assertCursorAt(0, 0);
helpers.doKeys('`', 'e');
helpers.assertCursorAt(0, 0);
});
testVim('visual', function(cm, vim, helpers) {
helpers.doKeys('l', 'v', 'l', 'l');
helpers.assertCursorAt(0, 3);
@@ -861,15 +1104,6 @@ testVim('? and n/N', function(cm, vim, helpers) {
helpers.doKeys('2', '?');
helpers.assertCursorAt(0, 11);
}, { value: 'match nope match \n nope Match' });
//:noh should clear highlighting of search-results but allow to resume search through n
testVim('noh_clearSearchHighlight', function(cm, vim, helpers) {
cm.openDialog = helpers.fakeOpenDialog('match');
helpers.doKeys('?');
helpers.doEx('noh');
eq(vim.searchState_.getOverlay(),null,'match-highlighting wasn\'t cleared');
helpers.doKeys('n');
helpers.assertCursorAt(0, 11,'can\'t resume search after clearing highlighting');
}, { value: 'match nope match \n nope Match' });
testVim('*', function(cm, vim, helpers) {
cm.setCursor(0, 9);
helpers.doKeys('*');
@@ -910,6 +1144,25 @@ testVim('#', function(cm, vim, helpers) {
helpers.doKeys('#');
helpers.assertCursorAt(1, 8);
}, { value: ' := match nomatch match \nnomatch Match' });
testVim('.', function(cm, vim, helpers) {
cm.setCursor(0, 0);
helpers.doKeys('2', 'd', 'w');
helpers.doKeys('.');
eq('5 6', cm.getValue());
}, { value: '1 2 3 4 5 6'});
testVim('._repeat', function(cm, vim, helpers) {
cm.setCursor(0, 0);
helpers.doKeys('2', 'd', 'w');
helpers.doKeys('3', '.');
eq('6', cm.getValue());
}, { value: '1 2 3 4 5 6'});

// Ex mode tests
testVim('ex_go_to_line', function(cm, vim, helpers) {
cm.setCursor(0, 0);
helpers.doEx('4');
helpers.assertCursorAt(3, 0);
}, { value: 'a\nb\nc\nd\ne\n'});
testVim('ex_write', function(cm, vim, helpers) {
var tmp = CodeMirror.commands.save;
var written;
@@ -974,6 +1227,15 @@ testVim('ex_substitute_count_with_range', function(cm, vim, helpers) {
helpers.doEx('1,3s/\\d/0/ 3');
eq('1\n2\n0\n0', cm.getValue());
}, { value: '1\n2\n3\n4' });
//:noh should clear highlighting of search-results but allow to resume search through n
testVim('ex_noh_clearSearchHighlight', function(cm, vim, helpers) {
cm.openDialog = helpers.fakeOpenDialog('match');
helpers.doKeys('?');
helpers.doEx('noh');
eq(vim.searchState_.getOverlay(),null,'match-highlighting wasn\'t cleared');
helpers.doKeys('n');
helpers.assertCursorAt(0, 11,'can\'t resume search after clearing highlighting');
}, { value: 'match nope match \n nope Match' });
// TODO: Reset key maps after each test.
testVim('ex_map_key2key', function(cm, vim, helpers) {
helpers.doEx('map a x');
@@ -1,6 +1,5 @@
.cm-s-ambiance.CodeMirror {
-webkit-box-shadow: none;
-moz-box-shadow: none;
-o-box-shadow: none;
box-shadow: none;
}
@@ -20,6 +20,6 @@
.cm-s-eclipse span.cm-link {color: #219;}

.cm-s-eclipse .CodeMirror-matchingbracket {
border:1px solid grey;
outline:1px solid grey;
color:black !important;;
}
@@ -7,15 +7,15 @@
.cm-s-erlang-dark span.cm-atom { color: #845dc4; }
.cm-s-erlang-dark span.cm-attribute { color: #ff80e1; }
.cm-s-erlang-dark span.cm-bracket { color: #ff9d00; }
.cm-s-erlang-dark span.cm-builtin { color: #eeaaaa; }
.cm-s-erlang-dark span.cm-comment { color: #7777ff; }
.cm-s-erlang-dark span.cm-def { color: #ee77aa; }
.cm-s-erlang-dark span.cm-builtin { color: #eaa; }
.cm-s-erlang-dark span.cm-comment { color: #77f; }
.cm-s-erlang-dark span.cm-def { color: #e7a; }
.cm-s-erlang-dark span.cm-error { color: #9d1e15; }
.cm-s-erlang-dark span.cm-keyword { color: #ffee80; }
.cm-s-erlang-dark span.cm-meta { color: #50fefe; }
.cm-s-erlang-dark span.cm-number { color: #ffd0d0; }
.cm-s-erlang-dark span.cm-operator { color: #dd1111; }
.cm-s-erlang-dark span.cm-operator { color: #d11; }
.cm-s-erlang-dark span.cm-string { color: #3ad900; }
.cm-s-erlang-dark span.cm-tag { color: #9effff; }
.cm-s-erlang-dark span.cm-variable { color: #50fe50; }
.cm-s-erlang-dark span.cm-variable-2 { color: #ee00ee; }
.cm-s-erlang-dark span.cm-variable-2 { color: #e0e; }
@@ -0,0 +1,43 @@
/*
Copyright (C) 2011 by MarkLogic Corporation
Author: Mike Brevoort <mike@brevoort.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
.cm-s-xq-light span.cm-keyword {line-height: 1em; font-weight: bold; color: #5A5CAD; }
.cm-s-xq-light span.cm-atom {color: #6C8CD5;}
.cm-s-xq-light span.cm-number {color: #164;}
.cm-s-xq-light span.cm-def {text-decoration:underline;}
.cm-s-xq-light span.cm-variable {color: black; }
.cm-s-xq-light span.cm-variable-2 {color:black;}
.cm-s-xq-light span.cm-variable-3 {color: black; }
.cm-s-xq-light span.cm-property {}
.cm-s-xq-light span.cm-operator {}
.cm-s-xq-light span.cm-comment {color: #0080FF; font-style: italic;}
.cm-s-xq-light span.cm-string {color: red;}
.cm-s-xq-light span.cm-meta {color: yellow;}
.cm-s-xq-light span.cm-error {color: #f00;}
.cm-s-xq-light span.cm-qualifier {color: grey}
.cm-s-xq-light span.cm-builtin {color: #7EA656;}
.cm-s-xq-light span.cm-bracket {color: #cc7;}
.cm-s-xq-light span.cm-tag {color: #3F7F7F;}
.cm-s-xq-light span.cm-attribute {color: #7F007F;}

.cm-s-xq-light .CodeMirror-activeline-background {background: #e8f2ff !important;}
.cm-s-xq-light .CodeMirror-matchingbracket {border:1px solid grey;color:black !important;background:yellow;}