summary refs log tree commit diff stats
path: root/tests/objects
Commit message (Expand)AuthorAgeFilesLines
* fixes #22926; Different type inferred when setting a default value for an arr...ringabout2023-11-292-6/+30
* fixes #22613; Default value does not work with object's discriminator (#22614)ringabout2023-09-011-1/+16
* When in object handles procedure call again, fixes #22474 (#22480)Jason Beetham2023-08-151-0/+32
* fixes #22301; fixes #22324; rejects branch initialization with a runtime disc...ringabout2023-07-251-0/+17
* fixes #22123; Compiler bug with default initializer values and arrays (#22128)ringabout2023-06-201-0/+14
* fixes ilegal recursion (#22105)Juan M Gómez2023-06-162-0/+12
* Allows for arbitrary ordering of inheritance in type section #6259 (#22070)Juan M Gómez2023-06-151-1/+1
* fixes #21840; nested local template lookup regression (#21841)ringabout2023-05-121-0/+74
* fixes #21801; object field initialization with overloaded functions (#21805)ringabout2023-05-081-0/+23
* fix #20972 fixes invalid and UB codegen case object transitions for both refc...ringabout2023-04-041-0/+15
* fixes #21023; Segfault when mixing seqs, orc, variants and futures (#21497)ringabout2023-03-101-0/+32
* fixes #20695; fixes object with distinct defaults and tables (#21428)ringabout2023-02-241-1/+38
* unpublic `arrayWith` and rename it to `nimArrayWith` (#21006)ringabout2022-12-041-1/+1
* fixes #20856; store defaults directly (#20859)ringabout2022-11-171-0/+13
* add more test for #20836 (#20842)Derek 呆2022-11-141-0/+15
* fixes object default fields bugs and add tests (#20839)ringabout2022-11-151-3/+34
* fixes #20836; fixes #20833; fixes `unsafeNew` (#20841)ringabout2022-11-141-0/+10
* Revert "fixes #20699; generate an empty struct for void type" (#20806)Andreas Rumpf2022-11-121-14/+15
* fixes #20699; generate an empty struct for void type (#20790)Aditya Siram2022-11-091-0/+14
* fixes #20740; fixes pre-existing field visibility issues and removes `efSkipF...ringabout2022-11-031-1/+21
* fixes #20715; range[a..b] inside object variant fails (#20716)ringabout2022-10-311-0/+30
* fixes #20681; add efSkipFieldVisibilityCheck to skip check (#20639)ringabout2022-10-283-29/+28
* fixes type check of ranges for default fields (#20660)ringabout2022-10-271-0/+11
* add type check for default fields (#20652)ringabout2022-10-251-0/+22
* Automatic dereferencing is removed (#20531)ringabout2022-10-101-0/+15
* remove implicit let/var default initialization (#20508)ringabout2022-10-071-16/+16
* add default field support for object in ARC/ORC (#20480)ringabout2022-10-042-0/+444
* less test time costs (#20479)Bung2022-10-021-3/+2
* defaults to ORC (#19972)ringabout2022-09-233-20/+29
* remove deprecated type pragma syntax, fix bugs that required it (#20199)metagn2022-09-032-3/+3
* nvro don't touch cdecl types [backport: 1.6] (#19461)flywind2022-01-281-0/+18
* nrvo shouldn't touch bycopy object[backport:1.2] (#19385)flywind2022-01-142-0/+30
* fixes #17437 - crash where error reporting > 1 (#17547)Saem Ghani2021-03-291-0/+22
* remove some noises in tests (#16448)flywind2020-12-271-7/+3
* testament: error instead of silently ignore invalid targets; remove pointless...Timothee Cour2020-12-141-1/+1
* make megatest consistent with unjoined tests wrt newlines, honor newlines in ...Timothee Cour2020-11-281-1/+1
* close #4318(add testcase for #4318) (#15904)flywind2020-11-111-0/+12
* fix #14698 nkRecWhen caused internalAssert in semConstructFields when generic...Timothee Cour2020-07-271-0/+20
* Error -> Defect for defects (#13908)Jacek Sieka2020-04-281-1/+1
* implement (#14114)cooldome2020-04-251-0/+6
* Turn some of the errors back into warningsZahary Karadjov2020-04-011-1/+1
* fix when statements in inheritable generic objects (#13667) [backport]Jasper Jenkins2020-03-171-0/+11
* Revert "printing float values will have one more digit. (#13276) [backport]" ...Timothee Cour2020-02-081-3/+3
* printing float values will have one more digit. (#13276) [backport]Arne Döring2020-02-071-3/+3
* Fixed objects being erroneously zeroed out before object construction (#12814...Neelesh Chandola2019-12-051-0/+22
* Fix spellings (#12277) [backport]Federico Ceratto2019-09-271-1/+1
* Remove ENDB (#12095)Clyybber2019-08-311-1/+0
* Remove immediate pragma (#11308)Arne Döring2019-05-291-1/+1
* add tests, closes #3012, closes #7244narimiran2019-02-271-0/+21
* fixes #10195Araq2019-02-191-0/+5
ame/widgets/aerc.go?h=0.5.1&id=a073d7613fac7c79b7909d93a0dd7bfea05d5c9d'>^
b76deea ^


cab3771 ^









80e891a ^
c286d3d ^

cab3771 ^
8492a21 ^
b60999c ^

8492a21 ^
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



               
 
                                  
 
                                          
                                          



                                                
                                        
                                       

                            

 


                                                         
                               
 
                                                          

                                       
                                    

                                       

          

                                                                   
                                            
                                                          

                                                              
 

                                                        
                              


                                   
 
                                            
                                                                
                                               
                                         
         
 
                   

 
                                            


                                   
                                                                     


                                                       









                                            
                                                 

                                                                            
 
 

                                                                     
 
package widgets

import (
	"log"

	"github.com/gdamore/tcell"

	"git.sr.ht/~sircmpwn/aerc2/config"
	"git.sr.ht/~sircmpwn/aerc2/lib/ui"
	libui "git.sr.ht/~sircmpwn/aerc2/lib/ui"
)

type Aerc struct {
	accounts map[string]*AccountView
	cmd      func(cmd string) error
	grid     *libui.Grid
	tabs     *libui.Tabs
}

func NewAerc(conf *config.AercConfig, logger *log.Logger,
	cmd func(cmd string) error) *Aerc {

	tabs := libui.NewTabs()

	mainGrid := libui.NewGrid().Rows([]libui.GridSpec{
		{libui.SIZE_EXACT, 1},
		{libui.SIZE_WEIGHT, 1},
	}).Columns([]libui.GridSpec{
		{libui.SIZE_EXACT, 20},
		{libui.SIZE_WEIGHT, 1},
	})

	// TODO: Grab sidebar size from config and via :set command
	mainGrid.AddChild(libui.NewText("aerc").
		Strategy(libui.TEXT_CENTER).
		Color(tcell.ColorBlack, tcell.ColorWhite))
	mainGrid.AddChild(tabs.TabStrip).At(0, 1)
	mainGrid.AddChild(tabs.TabContent).At(1, 0).Span(1, 2)

	aerc := &Aerc{
		accounts: make(map[string]*AccountView),
		cmd:      cmd,
		grid:     mainGrid,
		tabs:     tabs,
	}

	for _, acct := range conf.Accounts {
		view := NewAccountView(conf, &acct, logger, cmd)
		aerc.accounts[acct.Name] = view
		tabs.Add(view, acct.Name)
	}

	return aerc
}

func (aerc *Aerc) Children() []ui.Drawable {
	return aerc.grid.Children()
}

func (aerc *Aerc) OnInvalidate(onInvalidate func(d libui.Drawable)) {
	aerc.grid.OnInvalidate(func(_ libui.Drawable) {
		onInvalidate(aerc)
	})
}

func (aerc *Aerc) Invalidate() {
	aerc.grid.Invalidate()
}

func (aerc *Aerc) Draw(ctx *libui.Context) {
	aerc.grid.Draw(ctx)
}

func (aerc *Aerc) Event(event tcell.Event) bool {
	acct, _ := aerc.tabs.Tabs[aerc.tabs.Selected].Content.(*AccountView)
	return acct.Event(event)
}

func (aerc *Aerc) SelectedAccount() *AccountView {
	return aerc.accounts[aerc.tabs.Tabs[aerc.tabs.Selected].Name]
}