A remake of the ed text editor in Go, because that seemed like an important thing to have.
Max Timkovich and Esgorhannoth
em is licensed under the Simplified BSD License.
A fan remake of the ed text editor in Go.
License: BSD 2-Clause "Simplified" License
A remake of the ed text editor in Go, because that seemed like an important thing to have.
Max Timkovich and Esgorhannoth
em is licensed under the Simplified BSD License.
g/re/p
/
command to go to the next result.In
func (e *Editor) Write(start, end int, cmd rune, text string) {
args := strings.Split(text, " ")
if len(args) > 1 {
e.filename = args[0]
}
it should be
e.filename = args[1]
Otherwise it saves to "w" file (command name)
Is it by design that isModified
sets e.modified
to false
after first warning?
func (e *Editor) isModified() bool {
if e.modified {
e.Error("warning: file modified")
e.modified = false
return true
} else {
return false
}
}
And I guess it should be "warning: buffer modified"
because file is not modified yet.
When starting ./em with no argument I get some strange errors:
i
?
h
?
q
?
The only way to execute a command on an empty file is to prefix it with 1,0
1,0q
bash> _
My guess is that NewEditor()
should initialize e.line
to 1
.
Original ed
has this useful feature. You just hit Enter
and it is assumed that you want +1,+1p
.
Replacing this snipper in Parse
:
if len(text) == 0 {
e.Error("invalid address")
return 0, 0, ""
}
with this:
if len(text) == 0 {
if (e.line + 1 >= e.buffer.Len()) {
e.Error("invalid address")
return 0, 0, ""
} else {
return e.line+1, e.line+1, "p"
}
}
creates just that effect.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.