Skip to content

Commit

Permalink
Fix cursor position
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Jan 20, 2014
1 parent 5b75016 commit 43d81a9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
5 changes: 3 additions & 2 deletions autoload/vimshell/commands/less.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: less.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" 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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions autoload/vimshell/int_mappings.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: int_mappings.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" 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
Expand Down Expand Up @@ -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)

Expand All @@ -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
Expand Down
11 changes: 6 additions & 5 deletions autoload/vimshell/interactive.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: interactive.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" 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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -385,7 +386,7 @@ function! vimshell#interactive#exit() "{{{
setlocal modifiable
call append('$', '*Exit*')

call cursor(line('$'), col('$'))
call cursor(line('$'), 0)
endif
endif
endfunction"}}}
Expand All @@ -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"}}}
Expand Down Expand Up @@ -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"}}}
Expand Down
11 changes: 7 additions & 4 deletions autoload/vimshell/view.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: view.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" 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
Expand Down Expand Up @@ -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() "{{{
Expand All @@ -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(...) "{{{
Expand All @@ -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.
Expand Down

0 comments on commit 43d81a9

Please sign in to comment.