screen.TermMessage("Lua Error:", a, "does not exist")
continue
}
- names = append(names, "")
+ split := strings.SplitN(a, ".", 2)
+ if len(split) > 1 {
+ a = strings.Title(split[0]) + strings.Title(split[1])
+ } else {
+ a = strings.Title(a)
+ }
+
+ names = append(names, a)
} else if f, ok := BufKeyActions[a]; ok {
afn = f
names = append(names, a)
success := true
for i, a := range actionfns {
for j, c := range cursors {
+ if c == nil {
+ continue
+ }
h.Buf.SetCurCursor(c.Num)
h.Cursor = c
if i == 0 || (success && types[i-1] == '&') || (!success && types[i-1] == '|') || (types[i-1] == ',') {
multiWord bool
splitID uint64
+ tab *Tab
// remember original location of a search in case the search is canceled
searchOrig buffer.Loc
}
-func NewBufPane(buf *buffer.Buffer, win display.BWindow) *BufPane {
+func NewBufPane(buf *buffer.Buffer, win display.BWindow, tab *Tab) *BufPane {
h := new(BufPane)
h.Buf = buf
h.BWindow = win
+ h.tab = tab
h.Cursor = h.Buf.GetActiveCursor()
h.mouseReleased = true
return h
}
-func NewBufPaneFromBuf(buf *buffer.Buffer) *BufPane {
+func NewBufPaneFromBuf(buf *buffer.Buffer, tab *Tab) *BufPane {
w := display.NewBufWindow(0, 0, 0, 0, buf)
- return NewBufPane(buf, w)
+ return NewBufPane(buf, w, tab)
+}
+
+func (h *BufPane) SetTab(t *Tab) {
+ h.tab = t
+}
+
+func (h *BufPane) Tab() *Tab {
+ return h.tab
+}
+
+func (h *BufPane) ResizePane(size int) {
+ n := h.tab.GetNode(h.splitID)
+ n.ResizeSplit(size)
+ h.tab.Resize()
}
// PluginCB calls all plugin callbacks with a certain name and
h.BWindow.SetBuffer(b)
h.Cursor = b.GetActiveCursor()
h.Resize(h.GetView().Width, h.GetView().Height)
- v := new(display.View)
- h.SetView(v)
h.Relocate()
// Set mouseReleased to true because we assume the mouse is not being pressed when
// the editor is opened
// HandleEvent executes the tcell event properly
func (h *BufPane) HandleEvent(event tcell.Event) {
- if h.Buf.ExternallyModified() {
- InfoBar.YNPrompt("The file on disk has changed. Reload file? (y,n)", func(yes, canceled bool) {
+ if h.Buf.ExternallyModified() && !h.Buf.ReloadDisabled {
+ InfoBar.YNPrompt("The file on disk has changed. Reload file? (y,n,esc)", func(yes, canceled bool) {
+ if canceled {
+ h.Buf.DisableReload()
+ }
if !yes || canceled {
h.Buf.UpdateModTime()
} else {
}
func (h *BufPane) execAction(action func(*BufPane) bool, name string, cursor int) bool {
- if name != "Autocomplete" {
+ if name != "Autocomplete" && name != "CycleAutocompleteBack" {
h.Buf.HasSuggestions = false
}
if recording_macro {
curmacro = append(curmacro, r)
}
+ h.Relocate()
h.PluginCBRune("onRune", r)
}
}
-func (h *BufPane) VSplitBuf(buf *buffer.Buffer) *BufPane {
- e := NewBufPaneFromBuf(buf)
- e.splitID = MainTab().GetNode(h.splitID).VSplit(h.Buf.Settings["splitright"].(bool))
+func (h *BufPane) VSplitIndex(buf *buffer.Buffer, right bool) *BufPane {
+ e := NewBufPaneFromBuf(buf, h.tab)
+ e.splitID = MainTab().GetNode(h.splitID).VSplit(right)
MainTab().Panes = append(MainTab().Panes, e)
MainTab().Resize()
MainTab().SetActive(len(MainTab().Panes) - 1)
return e
}
-func (h *BufPane) HSplitBuf(buf *buffer.Buffer) *BufPane {
- e := NewBufPaneFromBuf(buf)
- e.splitID = MainTab().GetNode(h.splitID).HSplit(h.Buf.Settings["splitbottom"].(bool))
+func (h *BufPane) HSplitIndex(buf *buffer.Buffer, bottom bool) *BufPane {
+ e := NewBufPaneFromBuf(buf, h.tab)
+ e.splitID = MainTab().GetNode(h.splitID).HSplit(bottom)
MainTab().Panes = append(MainTab().Panes, e)
MainTab().Resize()
MainTab().SetActive(len(MainTab().Panes) - 1)
return e
}
+
+func (h *BufPane) VSplitBuf(buf *buffer.Buffer) *BufPane {
+ return h.VSplitIndex(buf, h.Buf.Settings["splitright"].(bool))
+}
+func (h *BufPane) HSplitBuf(buf *buffer.Buffer) *BufPane {
+ return h.HSplitIndex(buf, h.Buf.Settings["splitbottom"].(bool))
+}
func (h *BufPane) Close() {
h.Buf.Close()
}
"DeleteWordLeft": (*BufPane).DeleteWordLeft,
"SelectLine": (*BufPane).SelectLine,
"SelectToStartOfLine": (*BufPane).SelectToStartOfLine,
+ "SelectToStartOfText": (*BufPane).SelectToStartOfText,
"SelectToEndOfLine": (*BufPane).SelectToEndOfLine,
"ParagraphPrevious": (*BufPane).ParagraphPrevious,
"ParagraphNext": (*BufPane).ParagraphNext,
"IndentSelection": (*BufPane).IndentSelection,
"OutdentSelection": (*BufPane).OutdentSelection,
"Autocomplete": (*BufPane).Autocomplete,
+ "CycleAutocompleteBack": (*BufPane).CycleAutocompleteBack,
"OutdentLine": (*BufPane).OutdentLine,
+ "IndentLine": (*BufPane).IndentLine,
"Paste": (*BufPane).Paste,
"PastePrimary": (*BufPane).PastePrimary,
"SelectAll": (*BufPane).SelectAll,
"SelectPageDown": (*BufPane).SelectPageDown,
"HalfPageUp": (*BufPane).HalfPageUp,
"HalfPageDown": (*BufPane).HalfPageDown,
+ "StartOfText": (*BufPane).StartOfText,
"StartOfLine": (*BufPane).StartOfLine,
"EndOfLine": (*BufPane).EndOfLine,
"ToggleHelp": (*BufPane).ToggleHelp,
"ToggleKeyMenu": (*BufPane).ToggleKeyMenu,
+ "ToggleDiffGutter": (*BufPane).ToggleDiffGutter,
"ToggleRuler": (*BufPane).ToggleRuler,
"ClearStatus": (*BufPane).ClearStatus,
"ShellMode": (*BufPane).ShellMode,
"ScrollUp": (*BufPane).ScrollUpAction,
"ScrollDown": (*BufPane).ScrollDownAction,
"SpawnMultiCursor": (*BufPane).SpawnMultiCursor,
+ "SpawnMultiCursorUp": (*BufPane).SpawnMultiCursorUp,
+ "SpawnMultiCursorDown": (*BufPane).SpawnMultiCursorDown,
"SpawnMultiCursorSelect": (*BufPane).SpawnMultiCursorSelect,
"RemoveMultiCursor": (*BufPane).RemoveMultiCursor,
"RemoveAllMultiCursors": (*BufPane).RemoveAllMultiCursors,
"DeleteWordLeft": true,
"SelectLine": true,
"SelectToStartOfLine": true,
+ "SelectToStartOfText": true,
"SelectToEndOfLine": true,
"ParagraphPrevious": true,
"ParagraphNext": true,
"IndentSelection": true,
"OutdentSelection": true,
"OutdentLine": true,
+ "IndentLine": true,
"Paste": true,
"PastePrimary": true,
"SelectPageUp": true,
"SelectPageDown": true,
"StartOfLine": true,
+ "StartOfText": true,
"EndOfLine": true,
"JumpToMatchingBrace": true,
}