File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " omega"
3
- version = " 0.1.9 "
3
+ version = " 0.1.10 "
4
4
repository = " https://github.com/nwrenger/omega"
5
5
documentation = " https://github.com/nwrenger/omega"
6
6
readme = " README.md"
Original file line number Diff line number Diff line change @@ -321,7 +321,7 @@ pub fn copy(text_area: &mut TextArea) -> Result<()> {
321
321
}
322
322
323
323
/// Pasts the current clipboard
324
- pub fn paste ( text_area : & mut TextArea ) -> Result < ( ) > {
324
+ pub fn paste ( s : & mut Cursive , text_area : & mut TextArea ) -> Result < ( ) > {
325
325
let content = text_area. get_content ( ) . to_string ( ) ;
326
326
let cursor_pos = text_area. cursor ( ) ;
327
327
@@ -333,6 +333,13 @@ pub fn paste(text_area: &mut TextArea) -> Result<()> {
333
333
let inserted_line = split. 0 . to_string ( ) + text. as_str ( ) + split. 1 ;
334
334
lines[ current_line] = inserted_line. as_str ( ) ;
335
335
336
+ s. call_on_all_named (
337
+ "editor_scroll" ,
338
+ |view : & mut ScrollView < NamedView < TextArea > > | {
339
+ view. scroll_to_bottom ( ) ;
340
+ } ,
341
+ ) ;
342
+
336
343
let new_content: String = lines. join ( "\n " ) ;
337
344
text_area. set_content ( new_content) ;
338
345
Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ fn main() {
86
86
. with_name ( "editor" )
87
87
. scrollable ( )
88
88
. scroll_strategy ( ScrollStrategy :: StickToBottom )
89
+ . with_name ( "editor_scroll" )
89
90
. full_screen ( ) ;
90
91
91
92
let events = OnEventView :: new ( text_area)
@@ -96,7 +97,7 @@ fn main() {
96
97
} )
97
98
. on_pre_event ( Event :: CtrlChar ( 'v' ) , move |s| {
98
99
if let Some ( mut text_area) = s. find_name :: < TextArea > ( "editor" ) {
99
- events:: paste ( & mut text_area) . handle ( s) ;
100
+ events:: paste ( s , & mut text_area) . handle ( s) ;
100
101
}
101
102
} )
102
103
. on_pre_event ( Event :: CtrlChar ( 'x' ) , move |s| {
You can’t perform that action at this time.
0 commit comments