Skip to content

Commit b4b1cda

Browse files
committed
move around cursor
1 parent b2a781a commit b4b1cda

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

pkg/cmd/project/project.go

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,17 @@ func projectRun(opts *ProjectOptions) error {
9898

9999
s.SetStyle(style)
100100

101-
// some kind of controller struct to track modal state?
101+
// TODO some kind of controller struct to track modal state?
102+
colWidth := 30
103+
colHeight := 40
104+
colsToShow := 7
105+
106+
cardWidth := colWidth - 2
107+
cardHeight := 5
108+
cardsToShow := 7
109+
110+
selectedColumn := 0
111+
selectedCard := 0
102112

103113
quit := make(chan struct{})
104114
go func() {
@@ -110,6 +120,22 @@ func projectRun(opts *ProjectOptions) error {
110120
case 'q':
111121
close(quit)
112122
return
123+
case 'w':
124+
if selectedCard > 0 {
125+
selectedCard--
126+
}
127+
case 's':
128+
if selectedCard < cardsToShow {
129+
selectedCard++
130+
}
131+
case 'a':
132+
if selectedColumn > 0 {
133+
selectedColumn--
134+
}
135+
case 'd':
136+
if selectedColumn < colsToShow {
137+
selectedColumn++
138+
}
113139
}
114140
switch ev.Key() {
115141
case tcell.KeyEscape:
@@ -124,17 +150,6 @@ func projectRun(opts *ProjectOptions) error {
124150
}
125151
}()
126152

127-
colWidth := 30
128-
colHeight := 40
129-
colsToShow := 7
130-
131-
cardWidth := colWidth - 2
132-
cardHeight := 5
133-
cardsToShow := 7
134-
135-
selectedColumn := 0
136-
selectedCard := 0
137-
138153
loop:
139154
for {
140155
select {

0 commit comments

Comments
 (0)