From 43d81a96174d588fb6e1d520b1761cdb676f1c25 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Tue, 21 Jan 2014 07:39:32 +0900 Subject: [PATCH] Fix cursor position --- autoload/vimshell/commands/less.vim | 5 +++-- autoload/vimshell/int_mappings.vim | 8 +++++--- autoload/vimshell/interactive.vim | 11 ++++++----- autoload/vimshell/view.vim | 11 +++++++---- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/autoload/vimshell/commands/less.vim b/autoload/vimshell/commands/less.vim index 389e97ba..798b17e5 100644 --- a/autoload/vimshell/commands/less.vim +++ b/autoload/vimshell/commands/less.vim @@ -1,7 +1,7 @@ "============================================================================= " FILE: less.vim " AUTHOR: Shougo Matsushita -" Last Modified: 20 Jan 2014. +" Last Modified: 21 Jan 2014. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the @@ -252,7 +252,8 @@ endfunction "}}} function! s:print_output(line_num) "{{{ setlocal modifiable - call cursor(line('$'), col('$')) + call cursor(line('$'), 0) + call cursor(0, col('$')) if b:interactive.stdout_cache == '' if b:interactive.process.stdout.eof diff --git a/autoload/vimshell/int_mappings.vim b/autoload/vimshell/int_mappings.vim index 47b35346..cdb66585 100644 --- a/autoload/vimshell/int_mappings.vim +++ b/autoload/vimshell/int_mappings.vim @@ -1,7 +1,7 @@ "============================================================================= " FILE: int_mappings.vim " AUTHOR: Shougo Matsushita -" Last Modified: 20 Jan 2014. +" Last Modified: 21 Jan 2014. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the @@ -198,7 +198,8 @@ function! vimshell#int_mappings#execute_line(is_insert) "{{{ endif endif - call cursor(line('$'), col('$')) + call cursor(line('$'), 0) + call cursor(0, col('$')) call vimshell#interactive#execute_pty_inout(a:is_insert) @@ -212,7 +213,8 @@ function! s:paste_prompt() "{{{ " Set prompt line. let cur_text = vimshell#interactive#get_cur_line(line('.')) call setline(line('$'), vimshell#interactive#get_prompt(line('$')) . cur_text) - call cursor(line('$'), col('$')) + call cursor(line('$'), 0) + call cursor(0, col('$')) endfunction"}}} function! s:restart_command() "{{{ if exists('b:interactive') && !empty(b:interactive.process) && b:interactive.process.is_valid diff --git a/autoload/vimshell/interactive.vim b/autoload/vimshell/interactive.vim index 6af347da..add23fac 100644 --- a/autoload/vimshell/interactive.vim +++ b/autoload/vimshell/interactive.vim @@ -1,7 +1,7 @@ "============================================================================= " FILE: interactive.vim " AUTHOR: Shougo Matsushita -" Last Modified: 20 Jan 2014. +" Last Modified: 21 Jan 2014. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the @@ -178,7 +178,8 @@ function! vimshell#interactive#send(expr) "{{{ return endif - call cursor(line('$'), col('$')) + call cursor(line('$'), 0) + call cursor(0, col('$')) let list = type(a:expr) == type('') ? \ [a:expr] : a:expr @@ -385,7 +386,7 @@ function! vimshell#interactive#exit() "{{{ setlocal modifiable call append('$', '*Exit*') - call cursor(line('$'), col('$')) + call cursor(line('$'), 0) endif endif endfunction"}}} @@ -404,7 +405,7 @@ function! vimshell#interactive#force_exit() "{{{ setlocal modifiable call append('$', '*Killed*') - call cursor(line('$'), col('$')) + call cursor(line('$'), 0) stopinsert endif endfunction"}}} @@ -432,7 +433,7 @@ function! vimshell#interactive#hang_up(afile) "{{{ setlocal modifiable call append('$', '*Killed*') - call cursor(line('$'), col('$')) + call cursor(line('$'), 0) stopinsert endif endfunction"}}} diff --git a/autoload/vimshell/view.vim b/autoload/vimshell/view.vim index dd6bba96..d52f4e00 100644 --- a/autoload/vimshell/view.vim +++ b/autoload/vimshell/view.vim @@ -1,7 +1,7 @@ "============================================================================= " FILE: view.vim " AUTHOR: Shougo Matsushita -" Last Modified: 20 Jan 2014. +" Last Modified: 21 Jan 2014. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the @@ -165,7 +165,8 @@ function! vimshell#view#_print_prompt(...) "{{{ call append('$', new_prompt) endif - call cursor(line('$'), col('$')) + call cursor(line('$'), 0) + call cursor(0, col('$')) let &modified = 0 endfunction"}}} function! vimshell#view#_print_secondary_prompt() "{{{ @@ -175,7 +176,8 @@ function! vimshell#view#_print_secondary_prompt() "{{{ " Insert secondary prompt line. call append('$', vimshell#get_secondary_prompt()) - call cursor(line('$'), col('$')) + call cursor(line('$'), 0) + call cursor(0, col('$')) let &modified = 0 endfunction"}}} function! vimshell#view#_start_insert(...) "{{{ @@ -185,7 +187,8 @@ function! vimshell#view#_start_insert(...) "{{{ let is_insert = (a:0 == 0)? 1 : a:1 - call cursor(line('$'), col('$')) + call cursor(line('$'), 0) + call cursor(0, col('$')) if is_insert " Enter insert mode.