mirror of
https://github.com/zyedidia/micro
synced 2024-09-30 05:06:02 +00:00
Improve gutter messages
This commit is contained in:
parent
ccb5904591
commit
bc6dd990e5
|
@ -232,18 +232,16 @@ func main() {
|
|||
select {
|
||||
case f := <-shell.Jobs:
|
||||
// If a new job has finished while running in the background we should execute the callback
|
||||
log.Println("OUTPUT:", f.Output)
|
||||
f.Function(f.Output, f.Args...)
|
||||
case event = <-events:
|
||||
case <-screen.DrawChan:
|
||||
}
|
||||
|
||||
if event != nil {
|
||||
if action.InfoBar.HasPrompt {
|
||||
action.InfoBar.HandleEvent(event)
|
||||
} else {
|
||||
action.Tabs.HandleEvent(event)
|
||||
}
|
||||
if action.InfoBar.HasPrompt {
|
||||
action.InfoBar.HandleEvent(event)
|
||||
} else {
|
||||
action.Tabs.HandleEvent(event)
|
||||
}
|
||||
log.Println("Done event cycle")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -250,18 +250,20 @@ func (h *BufPane) HandleEvent(event tcell.Event) {
|
|||
}
|
||||
h.Buf.MergeCursors()
|
||||
|
||||
// Display any gutter messages for this line
|
||||
c := h.Buf.GetActiveCursor()
|
||||
none := true
|
||||
for _, m := range h.Buf.Messages {
|
||||
if c.Y == m.Start.Y || c.Y == m.End.Y {
|
||||
InfoBar.GutterMessage(m.Msg)
|
||||
none = false
|
||||
break
|
||||
if h.IsActive() {
|
||||
// Display any gutter messages for this line
|
||||
c := h.Buf.GetActiveCursor()
|
||||
none := true
|
||||
for _, m := range h.Buf.Messages {
|
||||
if c.Y == m.Start.Y || c.Y == m.End.Y {
|
||||
InfoBar.GutterMessage(m.Msg)
|
||||
none = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if none && InfoBar.HasGutter {
|
||||
InfoBar.ClearGutter()
|
||||
}
|
||||
}
|
||||
if none && InfoBar.HasGutter {
|
||||
InfoBar.ClearGutter()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -366,6 +368,26 @@ func (h *BufPane) Close() {
|
|||
h.Buf.Close()
|
||||
}
|
||||
|
||||
func (h *BufPane) SetActive(b bool) {
|
||||
h.BWindow.SetActive(b)
|
||||
if b {
|
||||
// Display any gutter messages for this line
|
||||
c := h.Buf.GetActiveCursor()
|
||||
none := true
|
||||
for _, m := range h.Buf.Messages {
|
||||
if c.Y == m.Start.Y || c.Y == m.End.Y {
|
||||
InfoBar.GutterMessage(m.Msg)
|
||||
none = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if none && InfoBar.HasGutter {
|
||||
InfoBar.ClearGutter()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// BufKeyActions contains the list of all possible key actions the bufhandler could execute
|
||||
var BufKeyActions = map[string]BufKeyAction{
|
||||
"CursorUp": (*BufPane).CursorUp,
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -67,6 +67,10 @@ func (w *BufWindow) SetActive(b bool) {
|
|||
w.active = b
|
||||
}
|
||||
|
||||
func (w *BufWindow) IsActive() bool {
|
||||
return w.active
|
||||
}
|
||||
|
||||
func (w *BufWindow) getStartInfo(n, lineN int) ([]byte, int, int, *tcell.Style) {
|
||||
tabsize := util.IntOpt(w.Buf.Settings["tabsize"])
|
||||
width := 0
|
||||
|
|
|
@ -63,6 +63,7 @@ func (i *InfoWindow) Relocate() bool { return false }
|
|||
func (i *InfoWindow) GetView() *View { return i.View }
|
||||
func (i *InfoWindow) SetView(v *View) {}
|
||||
func (i *InfoWindow) SetActive(b bool) {}
|
||||
func (i *InfoWindow) IsActive() bool { return true }
|
||||
|
||||
func (i *InfoWindow) GetMouseLoc(vloc buffer.Loc) buffer.Loc {
|
||||
c := i.Buffer.GetActiveCursor()
|
||||
|
|
|
@ -40,6 +40,10 @@ func (w *TermWindow) SetActive(b bool) {
|
|||
w.active = b
|
||||
}
|
||||
|
||||
func (w *TermWindow) IsActive() bool {
|
||||
return w.active
|
||||
}
|
||||
|
||||
func (w *TermWindow) GetMouseLoc(vloc buffer.Loc) buffer.Loc {
|
||||
return vloc
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ type Window interface {
|
|||
GetMouseLoc(vloc buffer.Loc) buffer.Loc
|
||||
Resize(w, h int)
|
||||
SetActive(b bool)
|
||||
IsActive() bool
|
||||
}
|
||||
|
||||
type BWindow interface {
|
||||
|
|
|
@ -103,12 +103,13 @@ function runLinter(buf)
|
|||
ftmatch = false
|
||||
end
|
||||
|
||||
local args = {}
|
||||
for k, arg in pairs(v.args) do
|
||||
v.args[k] = arg:gsub("%%f", file):gsub("%%d", dir)
|
||||
args[k] = arg:gsub("%%f", file):gsub("%%d", dir)
|
||||
end
|
||||
|
||||
if ftmatch then
|
||||
lint(buf, k, v.cmd, v.args, v.errorformat)
|
||||
lint(buf, k, v.cmd, args, v.errorformat)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue