Skip to content

Commit ad86c7f

Browse files
committed
ed -> editor
1 parent 0063efb commit ad86c7f

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

lib_src/misc/cells.ts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ import { getLine } from "./blocks.js"
66

77
import { Point } from "atom"
88

9-
export function getRange(ed) {
9+
export function getRange(editor) {
1010
// Cell range is:
1111
// Start of line below top delimiter (and/or start of top row of file) to
1212
// End of line before end delimiter
13-
const buffer = ed.getBuffer()
13+
const buffer = editor.getBuffer()
1414
const start = buffer.getFirstPosition()
1515
const end = buffer.getEndPosition()
1616
const regexString = "^(" + atom.config.get("julia-client.uiOptions.cellDelimiter").join("|") + ")"
1717
const regex = new RegExp(regexString)
18-
const cursor = ed.getCursorBufferPosition()
18+
const cursor = editor.getCursorBufferPosition()
1919
cursor.column = Infinity // cursor on delimiter line means eval cell below
2020

2121
let foundDelim = false
22-
for (let i = cursor.row + 1; i <= ed.getLastBufferRow(); i++) {
23-
const { line, scope } = getLine(ed, i)
22+
for (let i = cursor.row + 1; i <= editor.getLastBufferRow(); i++) {
23+
const { line, scope } = getLine(editor, i)
2424
foundDelim = regex.test(line) && scope.join(".").indexOf("comment.line") > -1
2525
end.row = i
2626
if (foundDelim) break
@@ -35,7 +35,7 @@ export function getRange(ed) {
3535
foundDelim = false
3636
if (cursor.row > 0) {
3737
for (let i = end.row; i >= 0; i--) {
38-
const { line, scope } = getLine(ed, i)
38+
const { line, scope } = getLine(editor, i)
3939
foundDelim = regex.test(line) && scope.join(".").indexOf("comment.line") > -1
4040
start.row = i
4141
if (foundDelim) {
@@ -48,66 +48,66 @@ export function getRange(ed) {
4848
return [start, end]
4949
}
5050

51-
export function get(ed) {
52-
if (ed.getGrammar().scopeName.indexOf("source.julia") > -1) {
53-
return jlGet(ed)
51+
export function get(editor) {
52+
if (editor.getGrammar().scopeName.indexOf("source.julia") > -1) {
53+
return jlGet(editor)
5454
} else {
55-
return weaveGet(ed)
55+
return weaveGet(editor)
5656
}
5757
}
5858

59-
function jlGet(ed) {
60-
const range = getRange(ed)
61-
let text = ed.getTextInBufferRange(range)
59+
function jlGet(editor) {
60+
const range = getRange(editor)
61+
let text = editor.getTextInBufferRange(range)
6262
if (text.trim() === "") text = " "
6363
const res = {
6464
range: [
6565
[range[0].row, range[0].column],
6666
[range[1].row, range[1].column],
6767
],
68-
selection: ed.getSelections()[0],
68+
selection: editor.getSelections()[0],
6969
line: range[0].row,
7070
text: text,
7171
}
7272
return [res]
7373
}
7474

75-
export function moveNext(ed) {
76-
if (ed == null) {
77-
ed = atom.workspace.getActiveTextEditor()
75+
export function moveNext(editor) {
76+
if (editor == null) {
77+
editor = atom.workspace.getActiveTextEditor()
7878
}
79-
if (ed.getGrammar().scopeName.indexOf("source.julia") > -1) {
80-
return jlMoveNext(ed)
79+
if (editor.getGrammar().scopeName.indexOf("source.julia") > -1) {
80+
return jlMoveNext(editor)
8181
} else {
82-
return weaveMoveNext(ed)
82+
return weaveMoveNext(editor)
8383
}
8484
}
8585

86-
function jlMoveNext(ed) {
87-
const range = getRange(ed)
88-
const sel = ed.getSelections()[0]
86+
function jlMoveNext(editor) {
87+
const range = getRange(editor)
88+
const sel = editor.getSelections()[0]
8989
const nextRow = range[1].row + 2 // 2 = 1 to get to delimiter line + 1 more to go past it
9090
return sel.setBufferRange([
9191
[nextRow, 0],
9292
[nextRow, 0],
9393
])
9494
}
9595

96-
export function movePrev(ed) {
97-
if (ed == null) {
98-
ed = atom.workspace.getActiveTextEditor()
96+
export function movePrev(editor) {
97+
if (editor == null) {
98+
editor = atom.workspace.getActiveTextEditor()
9999
}
100-
if (ed.getGrammar().scopeName.indexOf("source.weave") > -1) {
101-
return weaveMovePrev(ed)
100+
if (editor.getGrammar().scopeName.indexOf("source.weave") > -1) {
101+
return weaveMovePrev(editor)
102102
} else {
103-
return jlMovePrev(ed)
103+
return jlMovePrev(editor)
104104
}
105105
}
106106

107-
function jlMovePrev(ed) {
108-
const range = getRange(ed)
107+
function jlMovePrev(editor) {
108+
const range = getRange(editor)
109109
const prevRow = range[0].row - 2 // 2 = 1 to get to delimiter line + 1 more to go past it
110-
const sel = ed.getSelections()[0]
110+
const sel = editor.getSelections()[0]
111111
return sel.setBufferRange([
112112
[prevRow, 0],
113113
[prevRow, 0],

0 commit comments

Comments
 (0)