saitoha/mouseterm-plus

focus issue?

benoitc opened this issue · 14 comments

Using latest version of mouseterm on a freshly installed machine when I click at the end of the line the cursor is displayed on the previous character:

screen shot 2015-05-24 at 08 00 18

Not sure why right now, but any idea is welcome :)

i fixed the screenshot to show the issue.

@benoitc thanks for reporting it, can you attach a log file created by script command?

$ script log.txt
$ tmux

... launch vim and reproduce that problem ...

$ exit
choco commented

I don't think this is a mouseterm bug.
From the screenshot it seems you're using a steady vertical bar as cursor type and vim as editor.
When you select the last character in a line in vim you're in practice over that character, but since you're using the steady bar the cursor is shown before the character itself.
That's standard behavior in vim and that's why it is recommended to use the block as cursor type (at lest in normal/visual mode) since it makes this "visual representation" less confusing :)

@choco that is a possibility indeed... Any clue on how to tell vim to use a block as a cursor in visual mode? All the docs around are about iterm2 but not Terminal.app

choco commented

Unfortunately it's not supported by Terminal app but we're trying to implement exactly this functionality right now in MouseTerm! There's a pull request in progress that addresses this issue in the works.

If you wanna try it out here's a compiled bundle https://www.dropbox.com/s/0oxq170yqqr01ft/MouseTerm.bundle.zip?dl=0 (you must uninstall the old mouseterm bundle, install this one and restart terminal app)
and this is the code you must put in your .vimrc

" Use a blinking upright bar cursor in Insert mode, a solid block in normal
let &t_SI = "\<Esc>[5 q"
let &t_EI = "\<Esc>[2 q"

@choco thanks, is this what #6 is about? I will try the bundle now.

OK I tried the bundle with the settings. It works when you enter in the insert mode but when vim is just started the cursor is an I, the default for me in my term. Also when you quit vim; the cursor is now block. Is this something expected?

choco commented

Yeah this is expected (from vim), to behave better you should install my fork of the vim-tooglecursor plugin (https://github.com/cHoco/vim-togglecursor i will submit a pull request when this feature is stable) that enables it in Terminal.app. It's a simple plugin that adds some autocmds to perform cursor changes automatically.
Remove the snippet I posted before and add this configuration instead
Install my fork of the plugin (using Vundle or any plugin manager)

Bundle 'cHoco/vim-togglecursor'

Put in .vimrc

let g:togglecursor_insert = "blinking_line"
let g:togglecursor_leave = "blinking_line"

Obviously you can change these options to your liking :)

@benoitc This might solve your problem.

let &t_SI = "\<Esc>[5 q"
let &t_EI = "\<Esc>[2 q"
let &t_ti = &t_ti . "\<Esc>[2 q"
let &t_te = "\<Esc>[5 q" . &t_te

thanks! Seems like both solution are working. For now I settled on the plugin usage so I could eventually be multi platform

choco commented

@benoitc I suggest to use the release bundle since the pull request has just been merged and I fixed a small memory
@saitoha I think you forgot to update the Info.plist to reflect the release, it still reports 1.0a6

@choco 👍 thanks a lot, that works like a charm right now :)

Works for me. Thanks!