opening two nregions from the same buffer blocks widening #3

Closed
kolyuchiy opened this Issue Jul 13, 2011 · 12 comments

Projects

None yet

2 participants

@kolyuchiy

I tried to diff two regions of the same file using this plugin. Diffing works, but you can't save any changes back to original file. When I enter :w in NR buffer, it says "NarrowRegion: Original buffer protected. Can't write changes!"
Is it possible to open two different NR buffers from the same file and save changes made to them?

@chrisbra
Owner

Thanks for reporting. Please try the updated version and make sure to set the g:nrrw_rgn_protect variable to 'n'

@kolyuchiy

Thanks! It works now as I wanted.
I noticed one more issue. When you close these multiple NR buffers, highlighting of NR regions in the original buffer won't restore to its original state (before opening NR buffers).

@chrisbra
Owner

Hm, this works for me.

@chrisbra
Owner

Can you give me the exact steps, how the syntax highlighting is wrong?

@kolyuchiy

http://dl.dropbox.com/u/4932631/out.ogv
I uploaded a video where this bug can be seen. First time it works OK, but second time the highlighting won't go away. Maybe it depends on what region you close first, I'm not sure.
I hope it helps.

@chrisbra
Owner

Okay, there was something seriously wrong with Narrowing regions of the same buffer at the same time, which could mess up your data and the highlighting. This should be fixed now.

Please try again and be sure to set the g:nrrw_rgn_protect='n'

@chrisbra
Owner

Could you please check again?

@kolyuchiy

I tried the updated version and it didn't fix the issue. The highlighting still persists after closing narrow regions.

@kolyuchiy kolyuchiy closed this Jul 20, 2011
@kolyuchiy kolyuchiy reopened this Jul 20, 2011
@chrisbra
Owner

I think I got it. Deleting the highlighting regions was wrong. I pushed an update

@kolyuchiy

Nope. Highlighting is still there after closing narrow regions.
Here is what I did:
vim 1.txt
open first nregion, open second nregion
delete some words from the first one, write and close it
now I have only one nregion open, but both regions in the original file are highlighted.
close the second one
now I have no nregions open and one region in the original file highlighted

@chrisbra
Owner

On Thu, July 21, 2011 10:18 pm, kolyuchiy wrote:

Nope. Highlighting is still there after closing narrow regions.
Here is what I did:
vim 1.txt
open first nregion, open second nregion
delete some words from the first one, write and close it
now I have only one nregion open, but both regions in the original file
are highlighted.
close the second one
now I have no nregions open and one region in the original file
highlighted

I am afraid, I can't reproduce it.

Here is what I did:
vim -u NONE -U NONE -N -i NONE -c 'ru! plugin/NrrwRgn.vim' file.txt

That starts vim, bypassing loading any plugin or you personal settings,
just nocompatible set and only load's the NrrwRgn plugin. That should
make sure, no personal setting or other plugin is messing with it.

  1. :let g:nrrw_rgn_protect='n'
  2. Narrow a first region :1,10NR
  3. Narrow a second region :11NR
  4. Changing a word in the first region, :wq
    The plugin put the changes back and removed the highlighting
    of the first region
  5. Changing a word in the second region, :wq
    The plugin put the changes back and removed the highlighting.

Looks good for me. Now there is another problem I just noticed (that is,
after step 5 and you make a new Narrowed Region, the plugin will happily
overwrite your second Narrowed Window and put in there the stuff
you selected this time. This needs to be changed, but other than that,
I don't see a problem)

Are your sure you updated your version?

regards,
Christian

@kolyuchiy

I pulled the latest commits from 22 of July and now everything works as expected.

@kolyuchiy kolyuchiy closed this Jul 24, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment