Skip to content

Commit

Permalink
Change name of main struct
Browse files Browse the repository at this point in the history
  • Loading branch information
josephspurrier committed Jan 13, 2019
1 parent 32ce039 commit ce47ccd
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions texman.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"os"
)

// Simply represents a simple lanaguage to modify text files.
type Simply struct {
// TM represents a text file.
type TM struct {
filename string
content [][]rune

Expand All @@ -19,16 +19,16 @@ type Simply struct {
}

// NewFile returns an object of a file.
func NewFile(filename string) *Simply {
return &Simply{
func NewFile(filename string) *TM {
return &TM{
filename: filename,
content: make([][]rune, 0),
LineEnding: "\n",
}
}

// Load will read a file into memory
func (s *Simply) Load() error {
func (s *TM) Load() error {
s.content = make([][]rune, 0)

f, err := os.Open(s.filename)
Expand All @@ -55,7 +55,7 @@ func (s *Simply) Load() error {
}

// String will return a string representation of the text.
func (s *Simply) String() string {
func (s *TM) String() string {
out := ""
for r := 0; r < len(s.content); r++ {
row := s.content[r]
Expand All @@ -71,7 +71,7 @@ func (s *Simply) String() string {
}

// Byte will return a byte array representation of the text.
func (s *Simply) Byte() []byte {
func (s *TM) Byte() []byte {
return []byte(s.String())
}

Expand All @@ -86,7 +86,7 @@ func validate(row int, col int) error {
}

// Overwrite will overwrite content at a specific location.
func (s *Simply) Overwrite(row int, col int, content string) error {
func (s *TM) Overwrite(row int, col int, content string) error {
err := validate(row, col)
if err != nil {
return err
Expand Down Expand Up @@ -117,7 +117,7 @@ func (s *Simply) Overwrite(row int, col int, content string) error {
}

// Insert will insert content at a specific location.
func (s *Simply) Insert(row int, col int, content string) error {
func (s *TM) Insert(row int, col int, content string) error {
err := validate(row, col)
if err != nil {
return err
Expand Down Expand Up @@ -159,12 +159,12 @@ func (s *Simply) Insert(row int, col int, content string) error {
}

// InsertLine will insert a new line.
func (s *Simply) InsertLine(row int, col int) error {
func (s *TM) InsertLine(row int, col int) error {
return s.Insert(row, col, s.LineEnding)
}

// Delete a character at the specified location.
func (s *Simply) Delete(row int, col int) error {
func (s *TM) Delete(row int, col int) error {
err := validate(row, col)
if err != nil {
return err
Expand Down Expand Up @@ -192,7 +192,7 @@ func (s *Simply) Delete(row int, col int) error {
}

// DeleteLine will delete a line.
func (s *Simply) DeleteLine(row int) error {
func (s *TM) DeleteLine(row int) error {
err := validate(row, 1)
if err != nil {
return err
Expand Down

0 comments on commit ce47ccd

Please sign in to comment.