This repository has been archived by the owner on Sep 9, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
editor.go
748 lines (606 loc) · 24.2 KB
/
editor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
package ace
import (
"github.com/gopherjs/gopherjs/js"
)
// Editor is a wrapper for the Ace Editor type.
type Editor struct {
*js.Object
}
// OnBlur binds the given function to the Ace blur event.
func (edit Editor) OnBlur(f func()) {
edit.Call("on", "blur", f)
}
// OnChange binds the given function to the Ace change event.
func (edit Editor) OnChange(f func(e *js.Object)) {
edit.Call("on", "change", f)
}
// OnChangeSelectionStyle binds the given function to the Ace changeSelectionStyle event.
func (edit Editor) OnChangeSelectionStyle(f func(data *js.Object)) {
edit.Call("on", "changeSelectionStyle", f)
}
// OnChangeSession binds the given function to the Ace changeSession event.
func (edit Editor) OnChangeSession(f func(oldSession, session EditSession)) {
edit.Call("on", "changeSession", func(dat *js.Object) {
f(EditSession{dat.Get("oldSession")}, EditSession{dat.Get("session")})
})
}
// OnCopy binds the given function to the Ace copy event.
func (edit Editor) OnCopy(f func(text string)) {
edit.Call("on", "copy", func(dat *js.Object) {
f(dat.String())
})
}
// OnFocus binds the given function to the Ace focus event.
func (edit Editor) OnFocus(f func()) {
edit.Call("on", "focus", f)
}
// OnPaste binds the given function to the Ace paste event.
func (edit Editor) OnPaste(f func(pasted string) string) {
edit.Call("on", "paste", func(dat *js.Object) {
dat.Set("text", f(dat.Get("text").String()))
})
}
// On binds the given function to the given Ace event.
func (edit Editor) On(on string, f interface{}) {
edit.Call("on", on, f)
}
// AddSelectionMarker adds the selection and cursor.
func (edit Editor) AddSelectionMarker(obj Range) Range {
return Range{edit.Call("addSelectionMarker", obj)}
}
// AlignCursors aligns the cursors or selected text.
func (edit Editor) AlignCursors() {
edit.Call("alignCursors")
}
// BlockOutdent outdents the current line.
func (edit Editor) BlockOutdent() {
edit.Call("blockOutdent")
}
// Blur blurs the current `textInput`
func (edit Editor) Blur() {
edit.Call("blur")
}
// CenterSelection attempts to center the current selection on the screen.
func (edit Editor) CenterSelection() {
edit.Call("centerSelection")
}
// ClearSelection empties the selection (by de-selecting it).
// This function also emits the `change-selection` event
func (edit Editor) ClearSelection() {
edit.Call("clearSelection")
}
// CopyLinesDown copies all the selected lines down one row.
func (edit Editor) CopyLinesDown() int {
return edit.Call("copyLinesDown").Int()
}
// CopyLinesUp copies all the selected lines up one row.
func (edit Editor) CopyLinesUp() int {
return edit.Call("copyLinesUp").Int()
}
// Destroy cleans up the entire editor.
func (edit Editor) Destroy() {
edit.Call("destroy")
}
// DuplicateSelection is an undocumented Ace function.
func (edit Editor) DuplicateSelection(args ...interface{}) *js.Object {
return edit.Call("duplicateSelection", args...)
}
// ExecCommand is an undocumented Ace function.
func (edit Editor) ExecCommand(args ...interface{}) *js.Object {
return edit.Call("execCommand", args...)
}
// ExitMultiSelectMode removes all selections except the last added one.
func (edit Editor) ExitMultiSelectMode() {
edit.Call("exitMultiSelectMode")
}
// Find attempts to find `needle` within the document.
// For more information on `options`, see `Search`
func (edit Editor) Find(needle string, options interface{}, animate bool) {
edit.Call("find", needle, options, animate)
}
// FindAll finds and selects all the occurences of `needle`
func (edit Editor) FindAll(needle string, the interface{}, keeps bool) int {
return edit.Call("findAll", needle, the, keeps).Int()
}
// FindNext performs another search for `needle` in the document.
// For more information on `options`, see `Search`.
func (edit Editor) FindNext(options interface{}, animate bool) {
edit.Call("findNext", options, animate)
}
// FindPrevious performs a search for `needle` backwards.
// For more information on `options`, see `Search`.
func (edit Editor) FindPrevious(options interface{}, animate bool) {
edit.Call("findPrevious", options, animate)
}
// Focus brings the current `textInput` into focus.
func (edit Editor) Focus() {
edit.Call("focus")
}
// ForEachSelection executes a command for each selection range
func (edit Editor) ForEachSelection(cmd, args string) {
edit.Call("forEachSelection", cmd, args)
}
// GetAnimatedScroll is an undocumented Ace function.
func (edit Editor) GetAnimatedScroll(args ...interface{}) *js.Object {
return edit.Call("getAnimatedScroll", args...)
}
// GetBehavioursEnabled returns `true` if the behaviors are currently enabled.
// "Behaviors" in this case is the auto-pairing of special characters,
// like quotation marks, parenthesis, or brackets.
func (edit Editor) GetBehavioursEnabled() bool {
return edit.Call("getBehavioursEnabled").Bool()
}
// GetCopyText returns the string of text currently highlighted.
func (edit Editor) GetCopyText() string {
return edit.Call("getCopyText").String()
}
// GetCursorPosition get sthe current position of the cursor
func (edit Editor) GetCursorPosition() *js.Object {
return edit.Call("getCursorPosition")
}
// GetCursorPositionScreen returns the screen position of the cursor
func (edit Editor) GetCursorPositionScreen() int {
return edit.Call("getCursorPositionScreen").Int()
}
// GetDisplayIndentGuides is an undocumented Ace function.
func (edit Editor) GetDisplayIndentGuides(args ...interface{}) *js.Object {
return edit.Call("getDisplayIndentGuides", args...)
}
// GetDragDelay returns the current mouse drag delay.
func (edit Editor) GetDragDelay() int {
return edit.Call("getDragDelay").Int()
}
// GetFadeFoldWidgets is an undocumented Ace function.
func (edit Editor) GetFadeFoldWidgets(args ...interface{}) *js.Object {
return edit.Call("getFadeFoldWidgets", args...)
}
// GetFirstVisibleRow returns the index of the first visible row.
func (edit Editor) GetFirstVisibleRow() int {
return edit.Call("getFirstVisibleRow").Int()
}
// GetHighlightActiveLine returns `true` if the current lines are always highlighted.
func (edit Editor) GetHighlightActiveLine() bool {
return edit.Call("getHighlightActiveLine").Bool()
}
// GetHighlightGutterLine is an undocumented Ace function.
func (edit Editor) GetHighlightGutterLine(args ...interface{}) *js.Object {
return edit.Call("getHighlightGutterLine", args...)
}
// GetHighlightSelectedWord returns `true` if currently highlighted words are to be highlighted.
func (edit Editor) GetHighlightSelectedWord() bool {
return edit.Call("getHighlightSelectedWord").Bool()
}
// GetKeyboardHandler returns the keyboard handler, such as "vim" or "windows"
func (edit Editor) GetKeyboardHandler() string {
return edit.Call("getKeyboardHandler").String()
}
// GetLastSearchOptions returns an object containing all the search options.
// For more information on `options`, see `Search`.
func (edit Editor) GetLastSearchOptions() *js.Object {
return edit.Call("GetLastSearchOptions")
}
// GetLastVisibleRow returns the index of the last visible row.
func (edit Editor) GetLastVisibleRow() int {
return edit.Call("getLastVisibleRow").Int()
}
// GetNumberAt works like `EditSession.GetTokenAt()`, except it returns an integer.
func (edit Editor) GetNumberAt(row, column interface{}) int {
return edit.Call("getNumberAt", row, column).Int()
}
// GetOverwrite returns `true` if overwrites are enabled; `false` otherwise.
func (edit Editor) GetOverwrite() bool {
return edit.Call("getOverwrite").Bool()
}
// GetPrintMarginColumn returns the column number of where the print margin is.
func (edit Editor) GetPrintMarginColumn() int {
return edit.Call("getPrintMarginColumn").Int()
}
// GetReadOnly returns `true` if the editor is set to read-only mode.
func (edit Editor) GetReadOnly() bool {
return edit.Call("getReadOnly").Bool()
}
// GetScrollSpeed returns the value indicating how fast the mouse scroll speed is (in milliseconds).
func (edit Editor) GetScrollSpeed() int {
return edit.Call("getScrollSpeed").Int()
}
// GetSelection returns the selection object.
func (edit Editor) GetSelection() *js.Object {
return edit.Call("getSelection")
}
// GetSelectionRange returns the `Range` for the selected text.
func (edit Editor) GetSelectionRange() Range {
return Range{edit.Call("getSelectionRange")}
}
// GetSelectionStyle returns the current selection style.
func (edit Editor) GetSelectionStyle() string {
return edit.Call("getSelectionStyle").String()
}
// GetShowFoldWidgets returns `true` if the fold widgets are shown.
func (edit Editor) GetShowFoldWidgets() bool {
return edit.Call("getShowFoldWidgets").Bool()
}
// GetShowInvisibles returns `true` if invisible characters are being shown.
func (edit Editor) GetShowInvisibles() bool {
return edit.Call("getShowInvisibles").Bool()
}
// GetShowPrintMargin returns `true` if the print margin is being shown.
func (edit Editor) GetShowPrintMargin() bool {
return edit.Call("getShowPrintMargin").Bool()
}
// GetValue returns the path of the current theme.
func (edit Editor) GetValue() string {
return edit.Call("getValue").String()
}
// GetTheme returns the content in the editor.
func (edit Editor) GetTheme() string {
return edit.Call("getTheme").String()
}
// GetWrapBehavioursEnabled returns `true` if the wrapping behaviors are currently enabled.
func (edit Editor) GetWrapBehavioursEnabled() bool {
return edit.Call("getWrapBehavioursEnabled").Bool()
}
// GotoLine moves the cursor to the specified line number, and also into the indiciated column.
func (edit Editor) GotoLine(lineNumber, column int, animate bool) {
edit.Call("gotoLine", lineNumber, column, animate)
}
// GotoPageDown shifts the document to wherever "page down" is, as well as moving the cursor position.
func (edit Editor) GotoPageDown() {
edit.Call("gotoPageDown")
}
// GotoPageUp shifts the document to wherever "page up" is, as well as moving the cursor position.
func (edit Editor) GotoPageUp() {
edit.Call("gotoPageUp")
}
// Indent indents the current line,
func (edit Editor) Indent() {
edit.Call("indent")
}
// Insert inserts `text` into wherever the cursor is pointing.
func (edit Editor) Insert(text string) {
edit.Call("insert", text)
}
// IsFocused returns `true` if the current `textInput` is in focus.
func (edit Editor) IsFocused() bool {
return edit.Call("isFocused").Bool()
}
// IsRowFullyVisible indicates if the entire row is currently visible on the screen.
func (edit Editor) IsRowFullyVisible(row int) bool {
return edit.Call("isRowFullyVisible", row).Bool()
}
// IsRowVisible indicates if the row is currently visible on the screen.
func (edit Editor) IsRowVisible(row int) bool {
return edit.Call("isRowVisible", row).Bool()
}
// JumpToMatching moves the cursor's row and column to the next matching bracket.
func (edit Editor) JumpToMatching(sel interface{}) {
edit.Call("jumpToMatching", sel)
}
// ModifyNumber - change the value of the character before the cursor by `amount` if it is a number.
func (edit Editor) ModifyNumber(amount int) {
edit.Call("modifyNumber", amount)
}
// MoveCursorTo moves the cursor to the specified row and column.
// Note that this does not de-select the current selection.
func (edit Editor) MoveCursorTo(row, column int) {
edit.Call("moveCursorTo", row, column)
}
// MoveCursorToPosition moves the cursor to the position indicated by `pos.row` and `pos.column`.
func (edit Editor) MoveCursorToPosition(pos map[string]interface{}) {
edit.Call("moveCursorToPosition", pos)
}
// MoveLinesDown shifts all the selected lines down one row.
func (edit Editor) MoveLinesDown() int {
return edit.Call("moveLinesDown").Int()
}
// MoveLinesUp shifts all the selected lines up one row.
func (edit Editor) MoveLinesUp() int {
return edit.Call("moveLinesUp").Int()
}
// MoveText is an undocumented Ace function.
func (edit Editor) MoveText(args ...interface{}) *js.Object {
return edit.Call("moveText", args...)
}
// NavigateUp moves the cursor up in the document the specified number of times.
// Note that this does de-select the current selection.
func (edit Editor) NavigateUp(times int) {
edit.Call("navigateUp", times)
}
// NavigateDown moves the cursor down in the document the specified number of times.
// Note that this does de-select the current selection.
func (edit Editor) NavigateDown(times int) {
edit.Call("navigateDown", times)
}
// NavigateLeft moves the cursor left in the document the specified number of times.
// Note that this does de-select the current selection.
func (edit Editor) NavigateLeft(times int) {
edit.Call("navigateLeft", times)
}
// NavigateRight moves the cursor right in the document the specified number of times.
// Note that this does de-select the current selection.
func (edit Editor) NavigateRight(times int) {
edit.Call("navigateRight", times)
}
// NavigateTo moves the cursor to the specified row and column.
// Note that this does de-select the current selection.
func (edit Editor) NavigateTo(row, column int) {
edit.Call("navigateTo", row, column)
}
// NavigateFileStart moves the cursor to the start of the current file.
// Note that this does de-select the current selection.
func (edit Editor) NavigateFileStart() {
edit.Call("navigateFileStart")
}
// NavigateFileEnd moves the cursor to the end of the current file.
// Note that this does de-select the current selection.
func (edit Editor) NavigateFileEnd() {
edit.Call("navigateFileEnd")
}
// NavigateLineStart moves the cursor to the start of the current line.
// Note that this does de-select the current selection.
func (edit Editor) NavigateLineStart() {
edit.Call("navigateLineStart")
}
// NavigateLineEnd moves the cursor to the end of the current line.
// Note that this does de-select the current selection.
func (edit Editor) NavigateLineEnd() {
edit.Call("navigateLineEnd")
}
// NavigateWordLeft moves the cursor to the word immediately to the left of the current position.
// Note that this does de-select the current selection.
func (edit Editor) NavigateWordLeft() {
edit.Call("navigateLineLeft")
}
// NavigateWordRight moves the cursor to the word immediately to the right of the current position.
// Note that this does de-select the current selection.
func (edit Editor) NavigateWordRight() {
edit.Call("navigateLineRight")
}
// Redo performs a redo operation on the document, reimplementing the last change.
func (edit Editor) Redo() {
edit.Call("redo")
}
// Remove removes words of text from the editor.
// A "word" is defined as a string of characters bookended by whitespace.
func (edit Editor) Remove(dir string) {
edit.Call("remove", dir)
}
// RemoveLines removes all the lines in the current selection.
func (edit Editor) RemoveLines() {
edit.Call("removeLines")
}
// RemoveSelectionMarker removes the selection marker.
func (edit Editor) RemoveSelectionMarker(rangee Range) {
edit.Call("removeSelectionMarker", rangee)
}
// RemoveToLineStart removes all the words to the left of the current selection,
// until the start of the line.
func (edit Editor) RemoveToLineStart() {
edit.Call("removeToLineStart")
}
// RemoveToLineEnd removes all the words to the right of the current selection,
// until the end of the line.
func (edit Editor) RemoveToLineEnd() {
edit.Call("removeToLineEnd")
}
// RemoveToLineLeft removes the word directly to the left of the current selection.
func (edit Editor) RemoveToLineLeft() {
edit.Call("removeToLineLeft")
}
// RemoveToLineRight removes the word directly to the right of the current selection.
func (edit Editor) RemoveToLineRight() {
edit.Call("removeToLineRight")
}
// Replace replaces the first occurance of `options.needle` with the value in `replacement`.
func (edit Editor) Replace(replacement string, options interface{}) {
edit.Call("replace", replacement, options)
}
// ReplaceAll replaces all occurances of `options.needle` with the value in `replacement`.
func (edit Editor) ReplaceAll(replacement string, options interface{}) {
edit.Call("replaceAll", replacement, options)
}
// RevealRange is an undocumented Ace function.
func (edit Editor) RevealRange(args ...interface{}) *js.Object {
return edit.Call("revealRange", args...)
}
// ScrollPageUp scrolls the document to wherever "page up" is, without changing the cursor position.
func (edit Editor) ScrollPageUp() {
edit.Call("scrollPageUp")
}
// ScrollPageDown scrolls the document to wherever "page down" is, without changing the cursor position.
func (edit Editor) ScrollPageDown() {
edit.Call("scrollPageDown")
}
// ScrollToLine scrolls to a line.
// If center is true, it puts the line in middle of screen (or attempts to).
func (edit Editor) ScrollToLine(line int, center, animate bool, callback func()) {
edit.Call("scrollToLine", line, center, animate, callback)
}
// ScrollToRow moves the editor to the specified row.
func (edit Editor) ScrollToRow(row interface{}) {
edit.Call("scrollToRow", row)
}
// SelectAll Selects all the text in editor.
func (edit Editor) SelectAll() {
edit.Call("selectAll")
}
// SelectMore finds the next occurence of text in an active selection and adds it to the selections.
func (edit Editor) SelectMore(dir int, skip bool) {
edit.Call("selctMore", dir, skip)
}
// SelectMoreLines adds a cursor above or below the active cursor.
func (edit Editor) SelectMoreLines(dir int, skip bool) {
edit.Call("selectMoreLines", dir, skip)
}
// SelectPageDown selects the text from the current position of the document until where a "page down" finishes.
func (edit Editor) SelectPageDown() {
edit.Call("selectPageDown")
}
// SelectPageUp selects the text from the current position of the document until where a "page up" finishes.
func (edit Editor) SelectPageUp() {
edit.Call("selectPageUp")
}
// SetAnimatedScroll is an undocumented Ace function.
func (edit Editor) SetAnimatedScroll(args ...interface{}) *js.Object {
return edit.Call("setAnimatedScroll")
}
// SetBehavioursEnabled specifies whether to use behaviors or not.
// "Behaviors" in this case is the auto-pairing of special characters,
// like quotation marks, parenthesis, or brackets.
func (edit Editor) SetBehavioursEnabled(enabled bool) {
edit.Call("setBehavioursEnabled", enabled)
}
// SetDisplayIndentGuides is an undocumented Ace function.
func (edit Editor) SetDisplayIndentGuides(args ...interface{}) *js.Object {
return edit.Call("setDisplayIndentGuides", args...)
}
// SetDragDelay sets the delay (in milliseconds) of the mouse drag.
func (edit Editor) SetDragDelay(dragDelay int) {
edit.Call("setDragDelay", dragDelay)
}
// SetFadeFoldWidgets is an undocumented Ace function.
func (edit Editor) SetFadeFoldWidgets(args ...interface{}) *js.Object {
return edit.Call("setFadeFoldWidgets", args...)
}
// SetFontSize sets a new font size (in pixels) for the text editor
func (edit Editor) SetFontSize(fontSize int) {
edit.Call("setFontSize", fontSize)
}
// SetHighlightActiveLine determines whether or not the current line should be highlighted.
func (edit Editor) SetHighlightActiveLine(shouldHighlight bool) {
edit.Call("setHighlightActiveLine", shouldHighlight)
}
// SetHighlightGutterLine is an undocumented Ace function.
func (edit Editor) SetHighlightGutterLine() {
edit.Call("setHighlightGutterLine")
}
// SetHighlightSelectedWord determines if the currently selected word should be highlighted.
func (edit Editor) SetHighlightSelectedWord(shouldHighlight bool) {
edit.Call("setHighlightSelectedWord", shouldHighlight)
}
// SetKeyboardHandler determines if the currently selected word should be highlighted.
func (edit Editor) SetKeyboardHandler(keyboardHandler string) {
edit.Call("setKeyboardHandler", keyboardHandler)
}
// SetOverwrite - Pass in `true` to enable overwrites in your session, or `false` to disable.
// If overwrites is enabled, any text you enter will type over any text after it.
// If the value of `overwrite` changes, this function also emits the `changeOverwrite` event.
func (edit Editor) SetOverwrite(overwrite bool) {
edit.Call("setOverwrite", overwrite)
}
// SetPrintMarginColumn sets the column defining where the print margin should be.
func (edit Editor) SetPrintMarginColumn(showPrintMargin int) {
edit.Call("setPrintMarginColumn", showPrintMargin)
}
// SetReadOnly - If `readOnly` is true, then the editor is set to read-only mode,
// and none of the content can change.
func (edit Editor) SetReadOnly(readOnly bool) {
edit.Call("setReadOnly", readOnly)
}
// SetScrollSpeed sets how fast the mouse scrolling should do.
func (edit Editor) SetScrollSpeed(speed int) {
edit.Call("setScrollSpeed", speed)
}
// SetSelectionStyle indicates how selections should occur.
func (edit Editor) SetSelectionStyle(style string) {
edit.Call("setSelectionStyle", style)
}
// SetSession sets a new editsession to use. This method also emits the `changeSession` event.
func (edit Editor) SetSession(session EditSession) {
edit.Call("setSession", session)
}
// SetShowFoldWidgets indicates whether the fold widgets are shown or not.
func (edit Editor) SetShowFoldWidgets(show bool) {
edit.Call("setShowFoldWidgets", show)
}
// SetShowInvisibles - If `showInvisibles` is set to `true`, invisible characters—like spaces or
// new lines—are show in the editor.
func (edit Editor) SetShowInvisibles(showInvisibles bool) {
edit.Call("setShowInvisibles", showInvisibles)
}
// SetShowPrintMargin - If `showPrintMargin` is set to `true`, the print margin is shown in the editor.
func (edit Editor) SetShowPrintMargin(showPrintMargin bool) {
edit.Call("setShowPrintMargin", showPrintMargin)
}
// SetStyle adds a new class, `style`, to the editor.
func (edit Editor) SetStyle(style string) {
edit.Call("setStyle", style)
}
// SetTheme sets a new theme for the editor. `theme` should exist, and be a directory path,
// like `ace/theme/textmate`.
func (edit Editor) SetTheme(theme string) {
edit.Call("setTheme", theme)
}
// SetValue sets the current document to `val`.
func (edit Editor) SetValue(val string) string {
return edit.Call("setValue", val).String()
}
// SetValuePos sets the current document to `val`.
func (edit Editor) SetValuePos(val string, pos int) string {
return edit.Call("setValue", val, pos).String()
}
// SetWrapBehavioursEnabled specifies whether to use wrapping behaviors or not, i.e. automatically
// wrapping the selection with characters such as brackets when such a character is typed in.
func (edit Editor) SetWrapBehavioursEnabled(enabled bool) {
edit.Call("setWrapBehavioursEnabled", enabled)
}
// SortLines is an undocumented Ace function.
func (edit Editor) SortLines(args ...interface{}) *js.Object {
return edit.Call("sortLines", args...)
}
// SplitLine splits the line at the current selection (by inserting an `\n`).
func (edit Editor) SplitLine() {
edit.Call("splitLine")
}
// ToggleCommentLines either comments all the lines or uncomments all of them depending on the
// currently selected range.
func (edit Editor) ToggleCommentLines() {
edit.Call("toggleCommentLines")
}
// ToggleOverwrite sets the value of overwrite to the opposite of whatever it currently is.
func (edit Editor) ToggleOverwrite() {
edit.Call("toggleOverwrite")
}
// ToLowerCase converts the current selection entirely into lowercase.
func (edit Editor) ToLowerCase() {
edit.Call("toLowerCase")
}
// ToUpperCase converts the current selection entirely into uppercase.
func (edit Editor) ToUpperCase() {
edit.Call("toUpperCase")
}
// TransposeLetters transposes the current line.
func (edit Editor) TransposeLetters() {
edit.Call("transposeLetters")
}
// TransposeSelections transposes the selected ranges.
func (edit Editor) TransposeSelections(dir int) {
edit.Call("transposeSelections", dir)
}
// Undo performs an undo operation on the document, reverting the last change.
func (edit Editor) Undo() {
edit.Call("undo")
}
// UnsetStyle removes the class `style` from the editor.
func (edit Editor) UnsetStyle(style interface{}) {
edit.Call("unsetStyle", style)
}
// UpdateSelectionMarkers updates the cursor and marker layers.
func (edit Editor) UpdateSelectionMarkers() {
edit.Call("updateSelectionMarkers")
}
// SetOption sets an option.
func (edit Editor) SetOption(optionName string, optionValue interface{}) {
edit.Call("setOption", optionName, optionValue)
}
// SetOptions sets all options.
func (edit Editor) SetOptions(options map[string]interface{}) {
edit.Call("setOptions", options)
}
// GetOption gets the option with teh given name.
func (edit Editor) GetOption(optionName string) *js.Object {
return edit.Call("getOption", optionName)
}
// GetOptions gets all options
func (edit Editor) GetOptions() *js.Object {
return edit.Call("getOptions")
}