Giter VIP home page Giter VIP logo

Comments (5)

keforbes avatar keforbes commented on June 1, 2024

That's actually been a long-standing defect and it used to be worse:
http://sourceforge.net/apps/trac/vrapper/ticket/71
Just be thankful it only moves the cursor to the top of the file now rather than leaving Vrapper in a bad state like it used to.

I understand this defect is extremely annoying. Unfortunately, as the earlier defect states, it's an issue within the bowels of Eclipse. We ask Eclipse where the cursor should go and it responds with '-1'. There probably is a way to fix this, but I haven't stumbled upon it yet. Eclipse doesn't do a very good job of telling us where a fold is. I'll try spending some more time with this defect to see if I have any epiphanies, but I'm not too optimistic.

from vrapper.

elaforge avatar elaforge commented on June 1, 2024

It may be naive can you not ask eclipse at all? If the cursor is on line 40 and you say 'O' then you can insert a \n at the beginning of 40, and the cursor can remain on line 40. I chased it down into InsertLineCommand.PRE_CURSOR and I guess it's the p.getLineInformation stuff. Instead of -1 and getEndOffset(), can you do -0 and getStartOffset()?

from vrapper.

keforbes avatar keforbes commented on June 1, 2024

The only thing that's naive is my own understanding of the code. I'm not the original author, just the current maintainer. Your idea seems valid and it almost works. The only issue I see so far is the interaction with the SmartIndent feature. When you hit 'enter' in Eclipse, it will auto-indent if you're within an indented block. It will also add a * at the beginning of the line if you're within a multi-line /** **/ comment. When I change Vrapper to insert a newline at the beginning of the current line it indents the line below the new line that is created. This means it modifies the line you used to be on. If I can figure out how to perform the auto-indent and then the newline rather than the newline and then the auto-indent, this fix looks like it should work. Again, it's all due to my own ignorance; this solution may end up working.

I guess I should also note that if you disable SmartIndent (:set nosmartindent) then the feature works fine. Of course, when you do that you don't get to utilize Eclipse's nifty features so it all depends on how much this defect bothers you.

from vrapper.

keforbes avatar keforbes commented on June 1, 2024

I might as well continue jotting down my notes. I have a little better understanding of how the feature works now. When performing a POST_CURSOR insert, it inserts a newline, then an indent, then moves the cursor to the end of that new line. When performing a PRE_CURSOR insert, it basically moves to the previous line and then performs a POST_CURSOR insert as normal. So it always inserts the newline first and then performs the indent.

I'm no closer to finding a solution though. I tried creating a newline at the beginning of the current line, then performing the old PRE_CURSOR operation (which moves up to the new line I just created) but no luck. I tried inserting a newline myself then performing the smart indent with an empty string but no luck. Everything I try either results in no indenting, jumps me to the top of the file, or indents the line I was previously on.

from vrapper.

albertdev avatar albertdev commented on June 1, 2024

For anyone following this old issue, I provided a fix which will be included in the next release.
Turns out inserting on a folded line is impossible, but we can open the fold.

from vrapper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.