Skip to content

Commit 38391d5

Browse files
Merge branch 'micro-editor:master' into master
2 parents fc7cfeb + 1c88f24 commit 38391d5

3 files changed

Lines changed: 80 additions & 13 deletions

File tree

internal/action/actions_posix.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ import (
1414
func (*BufPane) Suspend() bool {
1515
screenb := screen.TempFini()
1616

17-
// suspend the process
18-
pid := syscall.Getpid()
19-
err := syscall.Kill(pid, syscall.SIGSTOP)
17+
// suspend the process group
18+
err := syscall.Kill(0, syscall.SIGSTOP)
2019
if err != nil {
2120
screen.TermMessage(err)
2221
}

internal/buffer/loc.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ type Loc struct {
99
X, Y int
1010
}
1111

12-
// LessThan returns true if b is smaller
12+
// LessThan returns true if l is smaller than b
1313
func (l Loc) LessThan(b Loc) bool {
1414
if l.Y < b.Y {
1515
return true
1616
}
1717
return l.Y == b.Y && l.X < b.X
1818
}
1919

20-
// GreaterThan returns true if b is bigger
20+
// GreaterThan returns true if l is bigger than b
2121
func (l Loc) GreaterThan(b Loc) bool {
2222
if l.Y > b.Y {
2323
return true
2424
}
2525
return l.Y == b.Y && l.X > b.X
2626
}
2727

28-
// GreaterEqual returns true if b is greater than or equal to b
28+
// GreaterEqual returns true if l is greater than or equal to b
2929
func (l Loc) GreaterEqual(b Loc) bool {
3030
if l.Y > b.Y {
3131
return true
@@ -36,7 +36,7 @@ func (l Loc) GreaterEqual(b Loc) bool {
3636
return l == b
3737
}
3838

39-
// LessEqual returns true if b is less than or equal to b
39+
// LessEqual returns true if l is less than or equal to b
4040
func (l Loc) LessEqual(b Loc) bool {
4141
if l.Y < b.Y {
4242
return true
@@ -113,14 +113,13 @@ func (l Loc) left(buf *LineArray) Loc {
113113
// MoveLA moves the cursor n characters to the left or right
114114
// It moves the cursor left if n is negative
115115
func (l Loc) MoveLA(n int, buf *LineArray) Loc {
116-
if n > 0 {
117-
for i := 0; i < n; i++ {
118-
l = l.right(buf)
119-
}
120-
return l
116+
for n > 0 {
117+
l = l.right(buf)
118+
n--
121119
}
122-
for i := 0; i < util.Abs(n); i++ {
120+
for n < 0 {
123121
l = l.left(buf)
122+
n++
124123
}
125124
return l
126125
}

runtime/syntax/gleam.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
filetype: gleam
2+
3+
detect:
4+
filename: "\\.gleam$"
5+
6+
rules:
7+
- identifier: "\\b[a-z][a-z0-9_]*\\b"
8+
9+
- statement: "\\b(as|assert|auto|case|const|delegate|derive|echo|else|fn|if|implement|import|let|macro|opaque|panic|pub|test|todo|type|use)\\b"
10+
11+
- type: "\\b[A-Z][a-zA-Z0-9_]*\\b"
12+
13+
- type: "\\b(Int|Float|String|Bool|List|Option|Result|BitArray)\\b"
14+
15+
- constant: "\\b(True|False|Nil)\\b"
16+
17+
- preproc: "@[a-z][a-z_]*"
18+
19+
- statement: "(\\|>|->|<-)"
20+
- statement: "(\\.\\.|<>)"
21+
- statement: "(==|!=|<=\\.|>=\\.|<\\.|>\\.|<=|>=)"
22+
- statement: "(&&|\\|\\|)"
23+
- statement: "(\\+\\.|-\\.|\\*\\.|/\\.|\\+|-|\\*|/|%)"
24+
- statement: "(=|<|>|!|<<|>>)"
25+
26+
- constant.number: "\\b0b[01](_?[01])*\\b"
27+
- constant.number: "\\b0o[0-7](_?[0-7])*\\b"
28+
- constant.number: "\\b0x[0-9a-fA-F](_?[0-9a-fA-F])*\\b"
29+
- constant.number: "\\b[0-9](_?[0-9])*(\\.[0-9](_?[0-9])*)?([eE][+-]?[0-9](_?[0-9])*)?\\b"
30+
31+
- default:
32+
start: "#\\("
33+
end: "\\)"
34+
limit-group: special
35+
rules:
36+
- identifier: "\\b[a-z][a-z0-9_]*\\b"
37+
- statement: "\\b(as|assert|auto|case|const|delegate|derive|echo|else|fn|if|implement|import|let|macro|opaque|panic|pub|test|todo|type|use)\\b"
38+
- type: "\\b[A-Z][a-zA-Z0-9_]*\\b"
39+
- type: "\\b(Int|Float|String|Bool|List|Option|Result|BitArray)\\b"
40+
- constant: "\\b(True|False|Nil)\\b"
41+
- statement: "(\\|>|->|<-)"
42+
- statement: "(\\.\\.|<>)"
43+
- statement: "(==|!=|<=\\.|>=\\.|<\\.|>\\.|<=|>=)"
44+
- statement: "(&&|\\|\\|)"
45+
- statement: "(\\+\\.|-\\.|\\*\\.|/\\.|\\+|-|\\*|/|%)"
46+
- statement: "(=|<|>|!|<<|>>)"
47+
- constant.number: "\\b0b[01](_?[01])*\\b"
48+
- constant.number: "\\b0o[0-7](_?[0-7])*\\b"
49+
- constant.number: "\\b0x[0-9a-fA-F](_?[0-9a-fA-F])*\\b"
50+
- constant.number: "\\b[0-9](_?[0-9])*(\\.[0-9](_?[0-9])*)?([eE][+-]?[0-9](_?[0-9])*)?\\b"
51+
- constant.string:
52+
start: '"'
53+
end: '"'
54+
skip: "\\\\."
55+
rules:
56+
- constant.specialChar: "\\\\."
57+
58+
- constant.string:
59+
start: '"'
60+
end: '"'
61+
skip: "\\\\."
62+
rules:
63+
- constant.specialChar: "\\\\."
64+
65+
- comment:
66+
start: "//"
67+
end: "$"
68+
rules:
69+
- todo: "(TODO|FIXME|XXX):?"

0 commit comments

Comments
 (0)