Skip to content

Commit

Permalink
Changed project layout and updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewilson2002 committed Apr 15, 2021
1 parent 27b2f56 commit fe69705
Show file tree
Hide file tree
Showing 25 changed files with 35 additions and 526 deletions.
41 changes: 29 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ MIT license, this is important.

- [Goals](#goals)
- [Screenshots](#screenshots)
- [Building](#building)
- [Development](#development)
+ [Building](#building)
+ [Layout](#layout)
- [Contributing](#contributing)
- [FAQ](#for-answers-and-questions-%28FAQ%29)

---

## Goals

* DOS-like user interface library for Go/tcell (diesel)
* An editor designed in the [KISS](https://en.wikipedia.org/wiki/KISS_principle) principle.
* DOS-like user interface library for Go/tcell (pkg/ui)
* Modern [rope](https://en.wikipedia.org/wiki/Rope_(data_structure)) buffer (used in emacs)
* Modern text editing, including: copy/paste, mouse support, selection, etc.
* Btree-based tiling and floating window management (panels)
Expand All @@ -32,30 +35,44 @@ MIT license, this is important.
![Showing the "Open files" dialog.](/screenshots/qedit-alpha-dev-open-files-dialog.png)
![Showing the "Edit" menu with selected text.](/screenshots/qedit-alpha-dev-copy-selection.png)

## Building
## Development

### Building

You will need:

* A clone or download of this repository
* A Go compiler version supporting Go 1.15+
* A Go compiler version supporting Go 1.16+
* A temporary internet connection

With Go successfully in your path variable, open a terminal and navigate to the
directory containing `main.go`, and execute the following command:
directory containing go.mod, and execute the following command:

```
go build
go build -o qedit ./cmd/qedit.go
```

That will download and install dependencies, and build the binary named `qedit`
or `qedit.exe`. If you would like Go to install and manage the binary for you,
which will add it to GOPATH/bin (and therefore your path variable):
But I prefer to use `go run ./cmd/qedit.go` while developing.

#### Profiling

Insert the `-cpuprofile` or `-memprofile` flags before the list of files when running qedit, like so:

```sh
go run ./cmd/qedit.go -cpuprofile cpu.prof [files]
# or
qedit -cpuprofile cpu.prof [files]
```
go install
```

You can now run `qedit` anywhere.
### Layout

This project follows the [project layout standard for Go projects](https://github.com/golang-standards/project-layout). At first glance it nearly makes no sense without the context, but here's the rundown for our project:

- **cmd/** ‒ Program entries.
- **internal/** ‒ Private code only meant to be used by qedit.
- **pkg/** ‒ Public code in packages we share with anyone who wants to use them.
+ **pkg/buffer/** ‒ Buffers for text editors and contains an optional syntax highlighting system.
+ **pkg/ui/** ‒ The custom DOS-like user interface library used in qedit.

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion clipboard.go → internal/clipboard/clipboard.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package clipboard

import "github.com/zyedidia/clipboard"

Expand Down
8 changes: 4 additions & 4 deletions gotolinedialog.go → internal/ui/gotolinedialog.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package main
package ui

import (
"strconv"
"strings"

"github.com/fivemoreminix/qedit/pkg/ui"
"github.com/gdamore/tcell/v2"
"github.com/fivemoreminix/qedit/ui"
)

type GotoLineDialog struct {
Expand All @@ -28,8 +28,8 @@ type GotoLineDialog struct {
func NewGotoLineDialog(s *tcell.Screen, theme *ui.Theme, lineChosenCallback func(int), cancelCallback func()) *GotoLineDialog {
dialog := &GotoLineDialog{
LineChosenCallback: lineChosenCallback,
screen: s,
theme: theme,
screen: s,
theme: theme,
}

dialog.inputField = ui.NewInputField(s, nil, theme.GetOrDefault("Window"))
Expand Down
Loading

0 comments on commit fe69705

Please sign in to comment.