XVim icon indicating copy to clipboard operation
XVim copied to clipboard

Marks get reset after a build/run.

Open chaekit opened this issue 12 years ago • 14 comments

I would like to give it a shot myself if its a real issue.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/900183-marks-get-reset-after-a-build-run?utm_campaign=plugin&utm_content=tracker%2F252770&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F252770&utm_medium=issues&utm_source=github).

chaekit avatar Jan 11 '13 04:01 chaekit

Where(which file) can I find the implementation for marks?

chaekit avatar Jan 22 '13 23:01 chaekit

Looks like marks are handled from xvimMotionEvaluator.m check the squote: and backquote: methods.

xvimwindow is the place that the marks are stored in a mutable dictionary called _localMarks.

Problem is that there is no way right now to persist across sessions. so you'd need to build in a persistence layer and map that to the session being edited and be able to load it again correctly.

weaksauce avatar Jan 23 '13 00:01 weaksauce

I am not familiar with Xcode/Xcode-plugins session lifecycles. When Xcode build/runs a project, does it reload the plugins? Is that why variables get reset?

chaekit avatar Jan 23 '13 03:01 chaekit

I think a new instance of the plugin will run every time you open a new executable. I don't think that it reloads the plugin every time a build happens. you might want to add some nslog statements inside xvim.m load() method, as that is the plugin's hook into xcode, to see how often and when it's called.

edit: looks like xvim loaded gets written to the console via the trace_log() command. just open up the console to see the debugging messages.

weaksauce avatar Jan 23 '13 03:01 weaksauce

I think xvim plugin is never reloaded while Xcode process is alive. I haven't looked into the problem well but it looks that the marks are saved into XVimWindow's _localMarks instance variable. Its NSDictionary. What I wonder is if it is cleared after build/run. They may be creating new XVimWindow object after build/run which does not have any marks in it.

Marks are not implemented by me so this may be totally wrong. Sorry that I can't take time to look into it...

JugglerShu avatar Jan 23 '13 03:01 JugglerShu

Oh to make it sure. @wayfare You are talking about after build/run some application which is being developed by Xcode with XVim right? or are you talking about before/after restarting Xcode?

JugglerShu avatar Jan 23 '13 04:01 JugglerShu

@JugglerShu Yes you are corrent, I was talking about building/running application. Could anyone please explain to me the general structure of XVim or maybe even Vim? Where does all the initialization happen? Sorry, this my first time dealing with editors :(.

chaekit avatar Jan 24 '13 19:01 chaekit

@wayfare General structure of XVim is documented here. https://github.com/JugglerShu/XVim/blob/master/Documents/Developers/index.html

One important thing you should know is that XVImWindow class is the main part of handling key event. All the key input in the source code editer is redirected to XVimWindow's "handleKeyEvent". What is hapenning in this method is that it passes the key input to evaluators. And evaluators parse the input and translate the input into Vim editing operaiton. So when you input 'j', "handleKeyEvent" is called with argument which has 'j' inside it and the evaluators translate it into "cursor move down" and invoke that operation. We have a lot of evaluators and they are switched according to its context. I think the evaluators related to this issue is XVimMarkSetEvaluator and XVimMarkMotionEvaluator

And XVimWindow class( XVimWindow.m or.h) looks managing the local marks. It has instance variable named "_localMarks". What I suggest is to make break point at the head of handleKeyEvent and find out the XVimWindow object which is handling the keyevent and if it has valid _localMarks variable. (You do this before/after runnning appliction)

Sorry for rough explanation...

JugglerShu avatar Jan 25 '13 01:01 JugglerShu

i downloaded the latest build but the build fails. Is this normal for building an xcplugin?

chaekit avatar Feb 02 '13 05:02 chaekit

@wayfare Are you using Xcode 4.5? I have merged a patch which is to compile XVim on Xcode 4.6 and it may break the compiling on Xcode 4.5. What's the errors you have?

JugglerShu avatar Feb 02 '13 07:02 JugglerShu

I just upgraded to 4.6 and I get errors from MacType.h CFURL.h CFFileSecurity.h CFXMLNode.h

Everything except CFXMLNode.h has 'Parse Issue' errors CFXMLNode.h has Clang LLVM 1.0 Error

chaekit avatar Feb 02 '13 08:02 chaekit

Sorry for late reply. Do you still have this problem?

JugglerShu avatar Jul 24 '13 08:07 JugglerShu

Yes i still have this problem.

chaekit avatar Aug 14 '13 03:08 chaekit

Try current master branch if you still have the errors on compiling and mark resetting problem.

JugglerShu avatar Sep 06 '13 04:09 JugglerShu