| 1 |
// Copyright 2016 The TCell Authors |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use file except in compliance with the License. |
| 5 |
// You may obtain a copy of the license at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
package tcell |
| 16 |
|
| 17 |
import "time" |
| 18 |
|
| 19 |
// EventPaste represents a bracketed paste event. |
| 20 |
type EventPaste struct { |
| 21 |
t time.Time |
| 22 |
text string |
| 23 |
esc string |
| 24 |
} |
| 25 |
|
| 26 |
// When returns the time when this Event was created, which should closely |
| 27 |
// match the time when the paste was made. |
| 28 |
func (e *EventPaste) When() time.Time { |
| 29 |
return e.t |
| 30 |
} |
| 31 |
|
| 32 |
// Text returns the text that was pasted |
| 33 |
func (e *EventPaste) Text() string { |
| 34 |
return e.text |
| 35 |
} |
| 36 |
|
| 37 |
func (e *EventPaste) EscSeq() string { |
| 38 |
return e.esc |
| 39 |
} |
| 40 |
|
| 41 |
// NewEventPaste creates a new paste event from the given text |
| 42 |
func NewEventPaste(text string, esc string) *EventPaste { |
| 43 |
return &EventPaste{ |
| 44 |
t: time.Now(), |
| 45 |
text: text, |
| 46 |
esc: esc, |
| 47 |
} |
| 48 |
} |