Comparing changes
Open a pull request
|
|
marijnh |
Bump version number post-4.4
|
d894811
|
|||
|
|
marijnh |
[real-world uses] Add Codeanywhere
|
466319f
|
|
|
gekkoe + mightyguava |
[vim] Generalized two-letter ESC sequences for insert mode
You can now edit vim.js and set enableEscKeymap to true and tweak any related settings that you see fit and have a two-character sequence to ESC from insert mode. |
2ae5509
|
|||
|
|
mightyguava |
[vim] Add vim options for insert mode esc keys and cleanup
|
4d25787
|
|||
|
|
mightyguava |
[vim] Fix macro recording for insert mode keys esc
|
45fe0a1
|
|||
|
|
mightyguava |
[vim] Default insert mode esc keys back to false
|
23302ba
|
|||
|
|
mightyguava |
[vim] Lint run
|
e4e7c19
|
|
|
marijnh |
[clojure mode] Fix null dereference bug
|
b5e19db
|
|||
|
|
marijnh |
Sanitize scrolling code, make it deal with being asked to show rect l…
…arger than view Issue #2736 |
70ebf9f
|
|||
|
|
marijnh |
Scroll correct positions into view after undo/redo
Issue #2736 |
95ec536
|
|||
|
|
marijnh |
[xml-fold addon] Make doMatchTags also return info about self-closing…
… tags This way, the matchtags addon highlights them the same as normal tags. Closes #2737 |
d17eade
|
|||
|
|
marijnh |
Also update line heights from updateDisplaySimple
Issue #2726 |
996b37a
|
|||
|
|
marijnh |
[real-world uses] Add IPython
|
41bd14d
|
|
|
binny + mightyguava |
[vim] replay change for blockwise visual
|
a711779
|
|||
|
|
binny |
[vim] remove visualBlock check in exitVisualMode
|
5969140
|
|
|
gekkoe + mightyguava |
[vim] Removed defunct comment.
@mightyguava fixed this issue in 45fe0a1 |
b4ecdde
|
|
|
marijnh |
Fix gutter width compensation in calculateScrollPos
Issue #2745 |
a7201ac
|
|||
|
|
marijnh |
Less fragile way to deal with updating the scrollbar during editor wi…
…dth changes Issue #2745 |
a183fa6
|
|
|
binny + mightyguava |
[vim] blockwise paste
|
9de315b
|
|
|
marijnh |
Bump supported Firefox to 4
Range.getBoundingClientRect is not supported in FF 3.x |
1a58ac5
|
|||
|
|
marijnh |
[sass mode] Clean up coding style
|
8432b6d
|
|||
|
|
marijnh |
[sass mode] Terminate multiline comments on dedentation
Closes #2752 |
f2a917e
|
|||
|
|
marijnh |
[sass mode] Add support for indented single-line comments
Issue #2752 |
0d45a4d
|
|||
|
|
marijnh |
[merge addon] Add a revertButtons option to turn off revert buttons
Closes #2754 |
2f2fcf9
|
|||
|
|
arBmind + marijnh |
[slim mode] Add
|
11d1a23
|
|||
|
|
marijnh |
[slim mode] Integrate
Issue #2755 |
b6e9eea
|
|||
|
|
hakantunc + marijnh |
Add mimetype text/x-nesc
|
bbc53eb
|
|||
|
|
optimix + marijnh |
[merge] new allowEditingOriginals option to edit all compared files
|
a46ad91
|
|||
|
|
dwikle + marijnh |
[verilog mode] Addressed indentation issue
Blocking indentation for import/export keywords |
162c607
|
|||
|
|
thehowl + marijnh |
[php mode] Add json, curl, mysqli extensions
|
d091604
|
|||
|
|
marijnh |
[sql-hint addon] Clean up, fix handling of whitespace
Closes #2761 |
d46fd84
|
|
|
binny + mightyguava |
[vim] visual block bugs
|
9b06427
|
|
|
marijnh |
Add a wordCharacters option to the JavaScript mode
|
85e8aa1
|
|||
|
|
aslushnikov + marijnh |
[comment addon] Fix two border cases
Issue #2768 |
f145676
|
|||
|
|
nickjs + marijnh |
[dialog addon] Add more options
* closeOnEnter: whether or not the dialog should be closed when you press enter with it focused. Defaults to true. * closeOnBlur: whether or not the dialog should be closed when the textfield or button loses focus. Defaults to true. * onClose: a callback that will be called when the close function completes. * onInput: very similar to onKeyDown, but uses the input event instead of keydown. Just an additional event handler basically. |
5460e4d
|
|||
|
|
marijnh |
[dialog addon] Small style tweaks
Issue #2777 |
dee145a
|
|||
|
|
marijnh |
[search addon] Add classes to styled elements in dialogs
Closes #2776 |
c4175a0
|
|||
|
|
marijnh |
Make indentSelection not scroll cursor into view
Closes #2769 |
e3da5be
|
|||
|
|
marijnh |
Work around Webkit returning a null rectangle for a zero-size wrapped…
… space Issue #2775 |
7792d88
|
|||
|
|
marijnh |
Mark release 4.5.0
|
43e88d4
|
- +6 −0 AUTHORS
- +2 −2 addon/comment/comment.js
- +26 −14 addon/dialog/dialog.js
- +4 −0 addon/edit/closetag.js
- +2 −1 addon/fold/xml-fold.js
- +53 −57 addon/hint/sql-hint.js
- +6 −0 addon/merge/merge.css
- +39 −16 addon/merge/merge.js
- +3 −3 addon/search/search.js
- +1 −1 bower.json
- +2 −0 doc/compress.html
- +11 −4 doc/manual.html
- +6 −2 doc/realworld.html
- +10 −0 doc/releases.html
- +2 −2 index.html
- +6 −3 keymap/sublime.js
- +333 −90 keymap/vim.js
- +77 −47 lib/codemirror.js
- +11 −0 mode/clike/clike.js
- +1 −1 mode/clojure/clojure.js
- +2 −2 mode/haml/test.js
- +1 −0 mode/index.html
- +5 −0 mode/javascript/index.html
- +5 −4 mode/javascript/javascript.js
- +1 −0 mode/meta.js
- +1 −1 mode/perl/perl.js
- +2 −2 mode/php/php.js
- +15 −9 mode/ruby/ruby.js
- +91 −110 mode/sass/sass.js
- +96 −0 mode/slim/index.html
- +575 −0 mode/slim/slim.js
- +96 −0 mode/slim/test.js
- +9 −1 mode/sql/index.html
- +133 −11 mode/verilog/test.js
- +5 −0 mode/verilog/verilog.js
- +1 −1 package.json
- +2 −0 test/index.html
- +9 −0 test/test.js
- +94 −1 test/vim_test.js
| @@ -24,12 +24,14 @@ Alexandre Bique | ||
| alexey-k | ||
| Alex Piggott | ||
| Amsul | ||
| +amuntean | ||
| Amy | ||
| Ananya Sen | ||
| anaran | ||
| AndersMad | ||
| Anders Nawroth | ||
| Anderson Mesquita | ||
| +Andreas Reischuck | ||
| Andre von Houck | ||
| Andrey Lushnikov | ||
| Andy Joslin | ||
| @@ -128,6 +130,7 @@ Gabriel Horner | ||
| Gabriel Nahmias | ||
| galambalazs | ||
| Gautam Mehta | ||
| +gekkoe | ||
| Gergely Hegykozi | ||
| Glenn Jorde | ||
| Glenn Ruehle | ||
| @@ -138,6 +141,7 @@ greengiant | ||
| Guillaume Massé | ||
| Guillaume Massé | ||
| Gustavo Rodrigues | ||
| +Hakan Tunc | ||
| Hans Engel | ||
| Hardest | ||
| Hasan Karahan | ||
| @@ -268,6 +272,7 @@ nextrevision | ||
| nguillaumin | ||
| Ng Zhi An | ||
| Nicholas Bollweg | ||
| +Nick Small | ||
| Niels van Groningen | ||
| Nikita Beloglazov | ||
| Nikita Vasilyev | ||
| @@ -334,6 +339,7 @@ Takuji Shimokawa | ||
| Tarmil | ||
| tfjgeorge | ||
| Thaddee Tyl | ||
| +TheHowl | ||
| think | ||
| Thomas Dvornik | ||
| Thomas Schmid | ||
| @@ -157,12 +157,12 @@ | ||
| // Positions of the last startString before the start of the selection, and the first endString after it. | ||
| var lastStart = startLine.lastIndexOf(startString, from.ch); | ||
| var firstEnd = lastStart == -1 ? -1 : startLine.slice(0, from.ch).indexOf(endString, lastStart + startString.length); | ||
| - if (lastStart != -1 && firstEnd != -1) return false; | ||
| + if (lastStart != -1 && firstEnd != -1 && firstEnd + endString.length != from.ch) return false; | ||
| // Positions of the first endString after the end of the selection, and the last startString before it. | ||
| firstEnd = endLine.indexOf(endString, to.ch); | ||
| var almostLastStart = endLine.slice(to.ch).lastIndexOf(startString, firstEnd - to.ch); | ||
| lastStart = (firstEnd == -1 || almostLastStart == -1) ? -1 : to.ch + almostLastStart; | ||
| - if (firstEnd != -1 && lastStart != -1) return false; | ||
| + if (firstEnd != -1 && lastStart != -1 && lastStart != to.ch) return false; | ||
| self.operation(function() { | ||
| self.replaceRange("", Pos(end, close - (pad && endLine.slice(close - pad.length, close) == pad ? pad.length : 0)), | ||
| @@ -15,11 +15,11 @@ | ||
| var wrap = cm.getWrapperElement(); | ||
| var dialog; | ||
| dialog = wrap.appendChild(document.createElement("div")); | ||
| - if (bottom) { | ||
| + if (bottom) | ||
| dialog.className = "CodeMirror-dialog CodeMirror-dialog-bottom"; | ||
| - } else { | ||
| + else | ||
| dialog.className = "CodeMirror-dialog CodeMirror-dialog-top"; | ||
| - } | ||
| + | ||
| if (typeof template == "string") { | ||
| dialog.innerHTML = template; | ||
| } else { // Assuming it's a detached DOM element. | ||
| @@ -35,8 +35,11 @@ | ||
| } | ||
| CodeMirror.defineExtension("openDialog", function(template, callback, options) { | ||
| + if (!options) options = {}; | ||
| + | ||
| closeNotification(this, null); | ||
| - var dialog = dialogDiv(this, template, options && options.bottom); | ||
| + | ||
| + var dialog = dialogDiv(this, template, options.bottom); | ||
| var closed = false, me = this; | ||
| function close(newVal) { | ||
| if (typeof newVal == 'string') { | ||
| @@ -45,34 +48,43 @@ | ||
| if (closed) return; | ||
| closed = true; | ||
| dialog.parentNode.removeChild(dialog); | ||
| + me.focus(); | ||
| + | ||
| + if (options.onClose) options.onClose(dialog); | ||
| } | ||
| } | ||
| + | ||
| var inp = dialog.getElementsByTagName("input")[0], button; | ||
| if (inp) { | ||
| - if (options && options.value) inp.value = options.value; | ||
| + if (options.value) inp.value = options.value; | ||
| + | ||
| + if (options.onInput) | ||
| + CodeMirror.on(inp, "input", function(e) { options.onInput(e, inp.value, close);}); | ||
| + if (options.onKeyUp) | ||
| + CodeMirror.on(inp, "keyup", function(e) {options.onKeyUp(e, inp.value, close);}); | ||
| + | ||
| CodeMirror.on(inp, "keydown", function(e) { | ||
| if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; } | ||
| - if (e.keyCode == 13 || e.keyCode == 27) { | ||
| + if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) { | ||
| inp.blur(); | ||
| CodeMirror.e_stop(e); | ||
| close(); | ||
| - me.focus(); | ||
| - if (e.keyCode == 13) callback(inp.value); | ||
| } | ||
| + if (e.keyCode == 13) callback(inp.value); | ||
| }); | ||
| - if (options && options.onKeyUp) { | ||
| - CodeMirror.on(inp, "keyup", function(e) {options.onKeyUp(e, inp.value, close);}); | ||
| - } | ||
| - if (options && options.value) inp.value = options.value; | ||
| + | ||
| + if (options.closeOnBlur !== false) CodeMirror.on(inp, "blur", close); | ||
| + | ||
| inp.focus(); | ||
| - CodeMirror.on(inp, "blur", close); | ||
| } else if (button = dialog.getElementsByTagName("button")[0]) { | ||
| CodeMirror.on(button, "click", function() { | ||
| close(); | ||
| me.focus(); | ||
| }); | ||
| + | ||
| + if (options.closeOnBlur !== false) CodeMirror.on(button, "blur", close); | ||
| + | ||
| button.focus(); | ||
| - CodeMirror.on(button, "blur", close); | ||
| } | ||
| return close; | ||
| }); | ||
| @@ -109,6 +109,10 @@ | ||
| replacements[i] = "/" + state.context.tagName + ">"; | ||
| } | ||
| cm.replaceSelections(replacements); | ||
| + ranges = cm.listSelections(); | ||
| + for (var i = 0; i < ranges.length; i++) | ||
| + if (i == ranges.length - 1 || ranges[i].head.line < ranges[i + 1].head.line) | ||
| + cm.indentLine(ranges[i].head.line); | ||
| } | ||
| function indexOf(collection, elt) { | ||
| @@ -151,8 +151,9 @@ | ||
| if (iter.text.indexOf(">") == -1 && iter.text.indexOf("<") == -1) return; | ||
| var end = toTagEnd(iter), to = end && Pos(iter.line, iter.ch); | ||
| var start = end && toTagStart(iter); | ||
| - if (!end || end == "selfClose" || !start || cmp(iter, pos) > 0) return; | ||
| + if (!end || !start || cmp(iter, pos) > 0) return; | ||
| var here = {from: Pos(iter.line, iter.ch), to: to, tag: start[2]}; | ||
| + if (end == "selfClose") return {open: here, close: null, at: "open"}; | ||
| if (start[1]) { // closing tag | ||
| return {open: findMatchingOpen(iter, start[2]), close: here, at: "close"}; | ||
| @@ -21,7 +21,7 @@ | ||
| function getKeywords(editor) { | ||
| var mode = editor.doc.modeOption; | ||
| - if(mode === "sql") mode = "text/x-sql"; | ||
| + if (mode === "sql") mode = "text/x-sql"; | ||
| return CodeMirror.resolveMode(mode).keywords; | ||
| } | ||
| @@ -32,12 +32,12 @@ | ||
| } | ||
| function addMatches(result, search, wordlist, formatter) { | ||
| - for(var word in wordlist) { | ||
| - if(!wordlist.hasOwnProperty(word)) continue; | ||
| - if(Array.isArray(wordlist)) { | ||
| + for (var word in wordlist) { | ||
| + if (!wordlist.hasOwnProperty(word)) continue; | ||
| + if (Array.isArray(wordlist)) { | ||
| word = wordlist[word]; | ||
| } | ||
| - if(match(search, word)) { | ||
| + if (match(search, word)) { | ||
| result.push(formatter(word)); | ||
| } | ||
| } | ||
| @@ -49,33 +49,30 @@ | ||
| var string = token.string.substr(1); | ||
| var prevCur = Pos(cur.line, token.start); | ||
| var table = editor.getTokenAt(prevCur).string; | ||
| - if( !tables.hasOwnProperty( table ) ){ | ||
| + if (!tables.hasOwnProperty(table)) | ||
| table = findTableByAlias(table, editor); | ||
| - } | ||
| var columns = tables[table]; | ||
| - if(!columns) { | ||
| - return; | ||
| - } | ||
| - addMatches(result, string, columns, | ||
| - function(w) {return "." + w;}); | ||
| + if (!columns) return; | ||
| + | ||
| + addMatches(result, string, columns, function(w) {return "." + w;}); | ||
| } | ||
| function eachWord(lineText, f) { | ||
| - if( !lineText ){return;} | ||
| + if (!lineText) return; | ||
| var excepted = /[,;]/g; | ||
| - var words = lineText.split( " " ); | ||
| - for( var i = 0; i < words.length; i++ ){ | ||
| - f( words[i]?words[i].replace( excepted, '' ) : '' ); | ||
| + var words = lineText.split(" "); | ||
| + for (var i = 0; i < words.length; i++) { | ||
| + f(words[i]?words[i].replace(excepted, '') : ''); | ||
| } | ||
| } | ||
| - function convertCurToNumber( cur ){ | ||
| + function convertCurToNumber(cur) { | ||
| // max characters of a line is 999,999. | ||
| - return cur.line + cur.ch / Math.pow( 10, 6 ); | ||
| + return cur.line + cur.ch / Math.pow(10, 6); | ||
| } | ||
| - function convertNumberToCur( num ){ | ||
| - return Pos(Math.floor( num ), +num.toString().split( '.' ).pop()); | ||
| + function convertNumberToCur(num) { | ||
| + return Pos(Math.floor(num), +num.toString().split('.').pop()); | ||
| } | ||
| function findTableByAlias(alias, editor) { | ||
| @@ -86,79 +83,78 @@ | ||
| var table = ""; | ||
| var separator = []; | ||
| var validRange = { | ||
| - start: Pos( 0, 0 ), | ||
| - end: Pos( editor.lastLine(), editor.getLineHandle( editor.lastLine() ).length ) | ||
| + start: Pos(0, 0), | ||
| + end: Pos(editor.lastLine(), editor.getLineHandle(editor.lastLine()).length) | ||
| }; | ||
| //add separator | ||
| - var indexOfSeparator = fullQuery.indexOf( CONS.QUERY_DIV ); | ||
| - while( indexOfSeparator != -1 ){ | ||
| - separator.push( doc.posFromIndex(indexOfSeparator)); | ||
| - indexOfSeparator = fullQuery.indexOf( CONS.QUERY_DIV, indexOfSeparator+1); | ||
| + var indexOfSeparator = fullQuery.indexOf(CONS.QUERY_DIV); | ||
| + while(indexOfSeparator != -1) { | ||
| + separator.push(doc.posFromIndex(indexOfSeparator)); | ||
| + indexOfSeparator = fullQuery.indexOf(CONS.QUERY_DIV, indexOfSeparator+1); | ||
| } | ||
| - separator.unshift( Pos( 0, 0 ) ); | ||
| - separator.push( Pos( editor.lastLine(), editor.getLineHandle( editor.lastLine() ).text.length ) ); | ||
| + separator.unshift(Pos(0, 0)); | ||
| + separator.push(Pos(editor.lastLine(), editor.getLineHandle(editor.lastLine()).text.length)); | ||
| - //find valieRange | ||
| + //find valid range | ||
| var prevItem = 0; | ||
| - var current = convertCurToNumber( editor.getCursor() ); | ||
| - for( var i=0; i< separator.length; i++){ | ||
| - var _v = convertCurToNumber( separator[i] ); | ||
| - if( current > prevItem && current <= _v ){ | ||
| - validRange = { start: convertNumberToCur( prevItem ), end: convertNumberToCur( _v ) }; | ||
| + var current = convertCurToNumber(editor.getCursor()); | ||
| + for (var i=0; i< separator.length; i++) { | ||
| + var _v = convertCurToNumber(separator[i]); | ||
| + if (current > prevItem && current <= _v) { | ||
| + validRange = { start: convertNumberToCur(prevItem), end: convertNumberToCur(_v) }; | ||
| break; | ||
| } | ||
| prevItem = _v; | ||
| } | ||
| var query = doc.getRange(validRange.start, validRange.end, false); | ||
| - for(var i=0; i < query.length; i++){ | ||
| + for (var i = 0; i < query.length; i++) { | ||
| var lineText = query[i]; | ||
| - eachWord( lineText, function( word ){ | ||
| + eachWord(lineText, function(word) { | ||
| var wordUpperCase = word.toUpperCase(); | ||
| - if( wordUpperCase === aliasUpperCase && tables.hasOwnProperty( previousWord ) ){ | ||
| + if (wordUpperCase === aliasUpperCase && tables.hasOwnProperty(previousWord)) { | ||
| table = previousWord; | ||
| } | ||
| - if( wordUpperCase !== CONS.ALIAS_KEYWORD ){ | ||
| + if (wordUpperCase !== CONS.ALIAS_KEYWORD) { | ||
| previousWord = word; | ||
| } | ||
| }); | ||
| - if( table ){ break; } | ||
| + if (table) break; | ||
| } | ||
| return table; | ||
| } | ||
| - function sqlHint(editor, options) { | ||
| + CodeMirror.registerHelper("hint", "sql", function(editor, options) { | ||
| tables = (options && options.tables) || {}; | ||
| keywords = keywords || getKeywords(editor); | ||
| var cur = editor.getCursor(); | ||
| - var token = editor.getTokenAt(cur), end = token.end; | ||
| var result = []; | ||
| - var search = token.string.trim(); | ||
| - | ||
| + var token = editor.getTokenAt(cur), start, end, search; | ||
| + if (token.string.match(/^[.\w@]\w*$/)) { | ||
| + search = token.string; | ||
| + start = token.start; | ||
| + end = token.end; | ||
| + } else { | ||
| + start = end = cur.ch; | ||
| + search = ""; | ||
| + } | ||
| if (search.charAt(0) == ".") { | ||
| columnCompletion(result, editor); | ||
| if (!result.length) { | ||
| - while (token.start && search.charAt(0) == ".") { | ||
| + while (start && search.charAt(0) == ".") { | ||
| token = editor.getTokenAt(Pos(cur.line, token.start - 1)); | ||
| + start = token.start; | ||
| search = token.string + search; | ||
| } | ||
| - addMatches(result, search, tables, | ||
| - function(w) {return w;}); | ||
| + addMatches(result, search, tables, function(w) {return w;}); | ||
| } | ||
| } else { | ||
| - addMatches(result, search, keywords, | ||
| - function(w) {return w.toUpperCase();}); | ||
| - addMatches(result, search, tables, | ||
| - function(w) {return w;}); | ||
| + addMatches(result, search, tables, function(w) {return w;}); | ||
| + addMatches(result, search, keywords, function(w) {return w.toUpperCase();}); | ||
| } | ||
| - return { | ||
| - list: result, | ||
| - from: Pos(cur.line, token.start), | ||
| - to: Pos(cur.line, end) | ||
| - }; | ||
| - } | ||
| - CodeMirror.registerHelper("hint", "sql", sqlHint); | ||
| + return {list: result, from: Pos(cur.line, start), to: Pos(cur.line, end)}; | ||
| + }); | ||
| }); | ||
| @@ -62,6 +62,12 @@ | ||
| color: #44c; | ||
| } | ||
| +.CodeMirror-merge-copy-reverse { | ||
| + position: absolute; | ||
| + cursor: pointer; | ||
| + color: #44c; | ||
| +} | ||
| + | ||
| .CodeMirror-merge-copybuttons-left .CodeMirror-merge-copy { left: 2px; } | ||
| .CodeMirror-merge-copybuttons-right .CodeMirror-merge-copy { right: 2px; } | ||
Showing you all comments on commits in this comparison.
|
@mightyguava when I tried returning Are you certain it works when used this way? If so, I wonder what I was doing wrong since my code looked very similar to this at one point the process. |
|
See note on line 4540. |
|
@mightyguava I had tried something along these lines but got a bunch of errors. I assumed it was because the function expected here should be of a type that can receive a cm as its argument rather than a character. Seemed counter-intuitive, since the function I wrote returned a function of the proper type, but I just hacked in the |
|
It works for me. If the code didn't work, either your CodeMirror.Pass didn't get propagated all the way up, or there was an error that just killed the event. |
|
I'd be happy to take a look at the broken code you had before. I can't really debug based on what you say you think you had. |
|
Indeed, bit much to ask eh? ;-) I'll see if I committed it locally (I may not have since it failed to run) and, if so, will post a snippet here. It's nice to see that the sane way to write it does in fact work though. I was a little annoyed at having to put in a hack like that. Thanks. |
|
This breaks replay in case of |