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 11[package ]
22name = " omega"
3- version = " 0.1.9 "
3+ version = " 0.1.10 "
44repository = " https://github.com/nwrenger/omega"
55documentation = " https://github.com/nwrenger/omega"
66readme = " README.md"
Original file line number Diff line number Diff line change @@ -321,7 +321,7 @@ pub fn copy(text_area: &mut TextArea) -> Result<()> {
321321}
322322
323323/// 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 < ( ) > {
325325 let content = text_area. get_content ( ) . to_string ( ) ;
326326 let cursor_pos = text_area. cursor ( ) ;
327327
@@ -333,6 +333,13 @@ pub fn paste(text_area: &mut TextArea) -> Result<()> {
333333 let inserted_line = split. 0 . to_string ( ) + text. as_str ( ) + split. 1 ;
334334 lines[ current_line] = inserted_line. as_str ( ) ;
335335
336+ s. call_on_all_named (
337+ "editor_scroll" ,
338+ |view : & mut ScrollView < NamedView < TextArea > > | {
339+ view. scroll_to_bottom ( ) ;
340+ } ,
341+ ) ;
342+
336343 let new_content: String = lines. join ( "\n " ) ;
337344 text_area. set_content ( new_content) ;
338345
Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ fn main() {
8686 . with_name ( "editor" )
8787 . scrollable ( )
8888 . scroll_strategy ( ScrollStrategy :: StickToBottom )
89+ . with_name ( "editor_scroll" )
8990 . full_screen ( ) ;
9091
9192 let events = OnEventView :: new ( text_area)
@@ -96,7 +97,7 @@ fn main() {
9697 } )
9798 . on_pre_event ( Event :: CtrlChar ( 'v' ) , move |s| {
9899 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) ;
100101 }
101102 } )
102103 . on_pre_event ( Event :: CtrlChar ( 'x' ) , move |s| {
You can’t perform that action at this time.
0 commit comments