Skip to content

Commit 3d27cc4

Browse files
author
Robert Akhmerov
committed
[master] Refactor structure
1 parent 2b8a644 commit 3d27cc4

File tree

15 files changed

+342
-326
lines changed

15 files changed

+342
-326
lines changed

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ package main
33
import "github.com/zored/edit/src/cmd"
44

55
func main() {
6-
cmd.Execute()
6+
cmd.Execute()
77
}

src/service/navigation/position.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package navigation
2+
3+
import (
4+
"fmt"
5+
)
6+
7+
type Position struct{ Column, Line int }
8+
9+
func NewPosition(line int, column int) *Position { return &Position{Column: column, Line: line} }
10+
11+
func (p Position) String() string { return fmt.Sprintf("%d:%d", p.Line, p.Column) }
12+
func (p *Position) Wrong() bool { return p.Column == 0 }
13+
func (p *Position) LineIndex() int { return p.Line - 1 }
14+
func (p *Position) ColumnIndex() int { return p.Column - 1 }
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package navigation
2+
3+
type Interval struct {
4+
Start, Stop *Position
5+
}

0 commit comments

Comments
 (0)