Remove unused files

This commit is contained in:
c-bata 2017-07-16 16:21:19 +09:00
parent 27710ec554
commit bfa943e55b
5 changed files with 2 additions and 66 deletions

View File

@ -9,7 +9,6 @@ type Buffer struct {
workingLines []string // The working lines. Similar to history
workingIndex int
CursorPosition int
selectionState *SelectionState
cacheDocument *Document // TODO: More effective cache using Queue or map. See https://github.com/jonathanslenders/python-prompt-toolkit/blob/master/prompt_toolkit/cache.py#L55-L93
preferredColumn int // Remember the original column for the next up/down movement.
}
@ -19,17 +18,14 @@ func (b *Buffer) Text() string {
return b.workingLines[b.workingIndex]
}
// Document method to return document instance from the current text,
// cursor position and selection state.
// Document method to return document instance from the current text and cursor position.
func (b *Buffer) Document() (d *Document) {
if b.cacheDocument == nil ||
b.cacheDocument.Text != b.Text() ||
b.cacheDocument.CursorPosition != b.CursorPosition ||
b.cacheDocument.selectionState != b.cacheDocument.selectionState {
b.cacheDocument.CursorPosition != b.CursorPosition {
b.cacheDocument = &Document{
Text: b.Text(),
CursorPosition: b.CursorPosition,
selectionState: b.selectionState,
}
}
return b.cacheDocument

View File

@ -1,24 +0,0 @@
package prompt
type Completion struct {
// The new string that will be inserted into document.
text string
// Position relative to the cursor position where the new text will start.
startPosition int
}
func (c *Completion) NewCompletionFromPosition(position int) *Completion {
if position < c.startPosition {
panic("position argument must be smaller than start position.")
}
return &Completion{
text: c.text[position-c.startPosition:],
}
}
func NewCompletion(text string) *Completion {
return &Completion{
text: text,
}
}

View File

@ -9,7 +9,6 @@ import (
type Document struct {
Text string
CursorPosition int
selectionState *SelectionState
}
// GetCharRelativeToCursor return character relative to cursor position, or empty string

View File

@ -1,19 +0,0 @@
package prompt
// SelectionType expresses how characters selected.
type SelectionType int
const (
// CHARACTERS selected freely.
CHARACTERS SelectionType = iota
// LINES selected current line.
LINES
// BLOCK selected the word block.
BLOCK
)
// SelectionState holds cursor position and selected characters.
type SelectionState struct {
OriginalCursorPosition int
Type SelectionType
}

View File

@ -1,16 +0,0 @@
// Code generated by "stringer -type SelectionType selection.go"; DO NOT EDIT
package prompt
import "fmt"
const _SelectionType_name = "CHARACTERSLINESBLOCK"
var _SelectionType_index = [...]uint8{0, 10, 15, 20}
func (i SelectionType) String() string {
if i < 0 || i >= SelectionType(len(_SelectionType_index)-1) {
return fmt.Sprintf("SelectionType(%d)", i)
}
return _SelectionType_name[_SelectionType_index[i]:_SelectionType_index[i+1]]
}