7 changes: 7 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Brian Sletten
Bruce Mitchener
Caitlin Potter
Calin Barbat
Chad Jolly
Chandra Sekhar Pydi
Charles Skelton
Cheah Chu Yeow
Expand Down Expand Up @@ -233,6 +234,7 @@ jeffkenton
Jeff Pickhardt
jem (graphite)
Jeremy Parmenter
JobJob
Jochen Berger
Johan Ask
John Connor
Expand All @@ -247,6 +249,7 @@ Jon Malmaud
Jon Sangster
Joost-Wim Boekesteijn
Joseph Pecoraro
Josh Cohen
Joshua Newman
Josh Watzman
jots
Expand All @@ -259,6 +262,7 @@ Justin Hileman
jwallers@gmail.com
kaniga
karevn
Kayur Patel
Ken Newman
Ken Rockot
Kevin Earls
Expand Down Expand Up @@ -437,6 +441,7 @@ SCLINIC\jdecker
Scott Aikin
Scott Goodhew
Sebastian Zaha
Sergey Goder
Se-Won Kim
shaund
shaun gilchrist
Expand All @@ -459,12 +464,14 @@ Steffen Beyer
Stephen Lavelle
Steve O'Hara
stoskov
Stu Kennedy
Sungho Kim
sverweij
Taha Jahangir
Tako Schotanus
Takuji Shimokawa
Tarmil
TDaglis
tel
tfjgeorge
Thaddee Tyl
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ new functionality.
You can find more information (and the
[manual](http://codemirror.net/doc/manual.html)) on the [project
page](http://codemirror.net). For questions and discussion, use the
[discussion forum](http://discuss.codemirror.net/).
[discussion forum](https://discuss.codemirror.net/).

See
[CONTRIBUTING.md](https://github.com/codemirror/CodeMirror/blob/master/CONTRIBUTING.md)
Expand Down
4 changes: 3 additions & 1 deletion addon/fold/comment-fold.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ CodeMirror.registerGlobalHelper("fold", "comment", function(mode) {
continue;
}
if (pass == 1 && found < start.ch) return;
if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1)))) {
if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1))) &&
(lineText.slice(found - endToken.length, found) == endToken ||
!/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found))))) {
startCh = found + startToken.length;
break;
}
Expand Down
9 changes: 8 additions & 1 deletion addon/hint/show-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,13 @@
setTimeout(function(){cm.focus();}, 20);
});

if (completion.options.completeOnSingleClick)
CodeMirror.on(hints, "mousemove", function(e) {
var elt = getHintElement(hints, e.target || e.srcElement);
if (elt && elt.hintId != null)
widget.changeActive(elt.hintId);
});

CodeMirror.signal(data, "select", completions[0], hints.firstChild);
return true;
}
Expand Down Expand Up @@ -430,7 +437,7 @@
alignWithWord: true,
closeCharacters: /[\s()\[\]{};:>,]/,
closeOnUnfocus: true,
completeOnSingleClick: false,
completeOnSingleClick: true,
container: null,
customKeys: null,
extraKeys: null
Expand Down
1 change: 1 addition & 0 deletions addon/runmode/runmode.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,4 @@ exports.runMode = function(string, modespec, callback, options) {
};

require.cache[require.resolve("../../lib/codemirror")] = require.cache[require.resolve("./runmode.node")];
require.cache[require.resolve("../../addon/runmode/runmode")] = require.cache[require.resolve("./runmode.node")];
2 changes: 1 addition & 1 deletion addon/scroll/annotatescrollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
Annotation.prototype.computeScale = function() {
var cm = this.cm;
var hScale = (cm.getWrapperElement().clientHeight - cm.display.barHeight - this.buttonHeight * 2) /
cm.heightAtLine(cm.lastLine() + 1, "local");
cm.getScrollerElement().scrollHeight
if (hScale != this.hScale) {
this.hScale = hScale;
return true;
Expand Down
2 changes: 1 addition & 1 deletion addon/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
query.lastIndex = stream.pos;
var match = query.exec(stream.string);
if (match && match.index == stream.pos) {
stream.pos += match[0].length;
stream.pos += match[0].length || 1;
return "searching";
} else if (match) {
stream.pos = match.index;
Expand Down
1 change: 1 addition & 0 deletions addon/tern/tern.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
},

destroy: function () {
closeArgHints(this)
if (this.worker) {
this.worker.terminate();
this.worker = null;
Expand Down
22 changes: 11 additions & 11 deletions demo/tern.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
<script src="../addon/dialog/dialog.js"></script>
<script src="../addon/hint/show-hint.js"></script>
<script src="../addon/tern/tern.js"></script>
<script src="http://ternjs.net/node_modules/acorn/dist/acorn.js"></script>
<script src="http://ternjs.net/node_modules/acorn/dist/acorn_loose.js"></script>
<script src="http://ternjs.net/node_modules/acorn/dist/walk.js"></script>
<script src="http://ternjs.net/doc/demo/polyfill.js"></script>
<script src="http://ternjs.net/lib/signal.js"></script>
<script src="http://ternjs.net/lib/tern.js"></script>
<script src="http://ternjs.net/lib/def.js"></script>
<script src="http://ternjs.net/lib/comment.js"></script>
<script src="http://ternjs.net/lib/infer.js"></script>
<script src="http://ternjs.net/plugin/doc_comment.js"></script>
<script src="//ternjs.net/node_modules/acorn/dist/acorn.js"></script>
<script src="//ternjs.net/node_modules/acorn/dist/acorn_loose.js"></script>
<script src="//ternjs.net/node_modules/acorn/dist/walk.js"></script>
<script src="//ternjs.net/doc/demo/polyfill.js"></script>
<script src="//ternjs.net/lib/signal.js"></script>
<script src="//ternjs.net/lib/tern.js"></script>
<script src="//ternjs.net/lib/def.js"></script>
<script src="//ternjs.net/lib/comment.js"></script>
<script src="//ternjs.net/lib/infer.js"></script>
<script src="//ternjs.net/plugin/doc_comment.js"></script>
<style>
.CodeMirror {border: 1px solid #ddd;}
</style>
Expand Down Expand Up @@ -109,7 +109,7 @@ <h2>Tern Demo</h2>
}

var server;
getURL("http://ternjs.net/defs/ecma5.json", function(err, code) {
getURL("//ternjs.net/defs/ecma5.json", function(err, code) {
if (err) throw new Error("Request for ecma5.json: " + err);
server = new CodeMirror.TernServer({defs: [JSON.parse(code)]});
editor.setOption("extraKeys", {
Expand Down
1 change: 1 addition & 0 deletions doc/compress.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ <h2>Script compression helper</h2>
<input type="hidden" id="download" name="download" value="codemirror-compressed.js"/>
<p>Version: <select id="version" onchange="setVersion(this);" style="padding: 1px;">
<option value="http://codemirror.net/">HEAD</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=5.9.0;f=">5.9</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=5.8.0;f=">5.8</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=5.7.0;f=">5.7</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=5.6.0;f=">5.6</option>
Expand Down
2 changes: 1 addition & 1 deletion doc/manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<section class=first id=overview>
<h2 style="position: relative">
User manual and reference guide
<span style="color: #888; font-size: 1rem; position: absolute; right: 0; bottom: 0">version 5.8.0</span>
<span style="color: #888; font-size: 1rem; position: absolute; right: 0; bottom: 0">version 5.9.0</span>
</h2>

<p>CodeMirror is a code-editor component that can be embedded in
Expand Down
11 changes: 11 additions & 0 deletions doc/releases.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ <h2>Release notes and version history</h2>

<h2>Version 5.x</h2>

<p class="rel">23-10-2015: <a href="http://codemirror.net/codemirror-5.9.zip">Version 5.9</a>:</p>

<ul class="rel-note">
<li>Improve the way overlay (OS X-style) scrollbars are handled</li>
<li>Make <a href="manual.html#addon_annotatescrollbar">annotatescrollbar</a> and scrollpastend addons work properly together</li>
<li>Make <a href="manual.html#addon_show-hint">show-hint</a> addon select options on single click by default, move selection to hovered item</li>
<li>Properly fold comments that include block-comment-start markers</li>
<li>Many small language mode fixes</li>
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.8.0...5.9.0">list of patches</a></li>
</ul>

<p class="rel">20-10-2015: <a href="http://codemirror.net/codemirror-5.8.zip">Version 5.8</a>:</p>

<ul class="rel-note">
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ <h2>This is CodeMirror</h2>
</div>
</div>
<div class=actionsleft>
Get the current version: <a href="http://codemirror.net/codemirror.zip">5.8</a>.<br>
Get the current version: <a href="http://codemirror.net/codemirror.zip">5.9</a>.<br>
You can see the <a href="https://github.com/codemirror/codemirror" title="Github repository">code</a> or<br>
read the <a href="doc/releases.html">release notes</a>.<br>
There is a <a href="doc/compress.html">minification helper</a>.
Expand Down Expand Up @@ -162,7 +162,7 @@ <h2>Community</h2>
license that CodeMirror uses.</p>

<p>Discussion around the project is done on
a <a href="http://discuss.codemirror.net">discussion forum</a>.
a <a href="https://discuss.codemirror.net">discussion forum</a>.
There is also
the <a href="http://groups.google.com/group/codemirror-announce">codemirror-announce</a>
list, which is only used for major announcements (such as new
Expand Down
2 changes: 1 addition & 1 deletion keymap/vim.js
Original file line number Diff line number Diff line change
Expand Up @@ -3208,7 +3208,7 @@
return cur;
}

/*
/**
* Returns the boundaries of the next word. If the cursor in the middle of
* the word, then returns the boundaries of the current word, starting at
* the cursor. If the cursor is at the start/end of a word, and we are going
Expand Down
56 changes: 36 additions & 20 deletions lib/codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@
if (horiz.clientWidth) scroll(horiz.scrollLeft, "horizontal");
});

this.checkedOverlay = false;
this.checkedZeroWidth = false;
// Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
if (ie && ie_version < 8) this.horiz.style.minHeight = this.vert.style.minWidth = "18px";
}
Expand Down Expand Up @@ -445,29 +445,43 @@
this.horiz.firstChild.style.width = "0";
}

if (!this.checkedOverlay && measure.clientHeight > 0) {
if (sWidth == 0) this.overlayHack();
this.checkedOverlay = true;
if (!this.checkedZeroWidth && measure.clientHeight > 0) {
if (sWidth == 0) this.zeroWidthHack();
this.checkedZeroWidth = true;
}

return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0};
},
setScrollLeft: function(pos) {
if (this.horiz.scrollLeft != pos) this.horiz.scrollLeft = pos;
if (this.disableHoriz) this.enableZeroWidthBar(this.horiz, this.disableHoriz);
},
setScrollTop: function(pos) {
if (this.vert.scrollTop != pos) this.vert.scrollTop = pos;
if (this.disableVert) this.enableZeroWidthBar(this.vert, this.disableVert);
},
overlayHack: function() {
zeroWidthHack: function() {
var w = mac && !mac_geMountainLion ? "12px" : "18px";
this.horiz.style.minHeight = this.vert.style.minWidth = w;
var self = this;
var barMouseDown = function(e) {
if (e_target(e) != self.vert && e_target(e) != self.horiz)
operation(self.cm, onMouseDown)(e);
};
on(this.vert, "mousedown", barMouseDown);
on(this.horiz, "mousedown", barMouseDown);
this.horiz.style.height = this.vert.style.width = w;
this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
this.disableHoriz = new Delayed;
this.disableVert = new Delayed;
},
enableZeroWidthBar: function(bar, delay) {
bar.style.pointerEvents = "auto";
function maybeDisable() {
// To find out whether the scrollbar is still visible, we
// check whether the element under the pixel in the bottom
// left corner of the scrollbar box is the scrollbar box
// itself (when the bar is still visible) or its filler child
// (when the bar is hidden). If it is still visible, we keep
// it enabled, if it's hidden, we disable pointer events.
var box = bar.getBoundingClientRect();
var elt = document.elementFromPoint(box.left + 1, box.bottom - 1);
if (elt != bar) bar.style.pointerEvents = "none";
else delay.set(1000, maybeDisable);
}
delay.set(1000, maybeDisable);
},
clear: function() {
var parent = this.horiz.parentNode;
Expand Down Expand Up @@ -3093,7 +3107,8 @@

if (cm.state.focused && op.updateInput)
cm.display.input.reset(op.typing);
if (op.focus && op.focus == activeElt()) ensureFocus(op.cm);
if (op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus()))
ensureFocus(op.cm);
}

function endOperation_finish(op) {
Expand Down Expand Up @@ -3778,7 +3793,7 @@

// Determines whether an event happened in the gutter, and fires the
// handlers for the corresponding event.
function gutterEvent(cm, e, type, prevent, signalfn) {
function gutterEvent(cm, e, type, prevent) {
try { var mX = e.clientX, mY = e.clientY; }
catch(e) { return false; }
if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;
Expand All @@ -3795,14 +3810,14 @@
if (g && g.getBoundingClientRect().right >= mX) {
var line = lineAtHeight(cm.doc, mY);
var gutter = cm.options.gutters[i];
signalfn(cm, type, cm, line, gutter, e);
signal(cm, type, cm, line, gutter, e);
return e_defaultPrevented(e);
}
}
}

function clickInGutter(cm, e) {
return gutterEvent(cm, e, "gutterClick", true, signalLater);
return gutterEvent(cm, e, "gutterClick", true);
}

// Kludge to work around strange IE behavior where it'll sometimes
Expand Down Expand Up @@ -4241,7 +4256,7 @@

function contextMenuInGutter(cm, e) {
if (!hasHandler(cm, "gutterContextMenu")) return false;
return gutterEvent(cm, e, "gutterContextMenu", false, signal);
return gutterEvent(cm, e, "gutterContextMenu", false);
}

// UPDATING
Expand Down Expand Up @@ -7074,7 +7089,7 @@
spanEndStyle = "";
}
if (m.className) spanStyle += " " + m.className;
if (m.css) css = m.css;
if (m.css) css = (css ? css + ";" : "") + m.css;
if (m.startStyle && sp.from == pos) spanStartStyle += " " + m.startStyle;
if (m.endStyle && sp.to == nextChange) spanEndStyle += " " + m.endStyle;
if (m.title && !title) title = m.title;
Expand Down Expand Up @@ -7343,6 +7358,7 @@
this.id = ++nextDocId;
this.modeOption = mode;
this.lineSep = lineSep;
this.extend = false;

if (typeof text == "string") text = this.splitLines(text);
updateDoc(this, {from: start, to: start, text: text});
Expand Down Expand Up @@ -8850,7 +8866,7 @@

// THE END

CodeMirror.version = "5.8.0";
CodeMirror.version = "5.9.0";

return CodeMirror;
});
Loading