Sublime Forum

Andy Edits

#3

Mmm it creates spurious edits towards the top of the page. Teething problems! I’ll shall investigate (got an idea what’s wrong…).

Added: I may have corrected this but I’ll have to keep an eye on it and try to notice when it happens.

0 Likes

#4

With apologies :blush: , but better hold off on this for a while! It’s carrying edit information across the views.

**self **for on_modified and on_selection_modified is a single instance - I was under the impression that these were per view. Shouldn’t be too tricky to fix though.

Soz again, Andy (I was too keen!).

0 Likes

#5

I believe the previous issue is now fixed.

It would be great if someone might give this a trial and offer some feedback :smile:

0 Likes

#6

This is working quite well for me now :smile: .

It doesn’t include automatically inserted tabs, matched brackets or quotes within the current edit region. Therefore, the edit-region may be split into several edits, and/or the region may end before it should. What I’m doing is pressing Ctrl-Alt-H (or using my shortcut menu) to toggle highlighting of the edits. Regardless of this highlighting step, I can select the whole area and use Ctrl-Alt-C to define it as a single edit-region. I can do this at any time and it has the advantage that I can explicitly define the start and end points of the edit region.

It would be possible to create code to handle these automatic insertions (and other factors) but it would be quite detailed and never 100% foolproof. I think it is best with this kind of feature that you/I have some control over how it works. That is, let the feature create the edit regions as you code, then review and correct them to what you decide should be considered as edit regions.

Again, I encourage feedback :wink:.

0 Likes

#7

Will this be put on Package Control’s repository?

0 Likes

#8

Hello. Yes, I have requested this. Andy.

0 Likes

#9

I believe I have resolved any Undo/Redo discrepancies :wink: but I need some feedback to confirm this. Added: Resolved, “to an acceptable degree”!

0 Likes

#10

Sorry about all the updates - I’m almost done :smile:

If there are only spaces and/or tabs between two edit regions then they will be treated as one region. I believe this is reasonable? This will save having to Create areas as a single edit-region manually. Andy.


0 Likes

#11

[quote=“agibsonsw”]

Hello. Yes, I have requested this. Andy.[/quote]

thx. :smiley:

0 Likes

#12

Can the gutter icon just use yellow and green dot?

0 Likes

#13

Do you not like my pencil? :wink:

Just for the moment you could comment out the following two lines in AndyEdits.py and add the third line:

[code]#ICON = path.pardir + ‘/AndyEdits/icon’ if \

sublime.load_settings(PACKAGE_SETTINGS).get(“use_icon”, True) else “”

ICON = “dot”[/code]
[Valid icon names are dot, circle, bookmark and cross.]

Open AndyEdits.sublime-settings and change these two lines:

"icon_scope": "class", "icon_current": "comment"
Change “class” and/or “comment” to different scope names, such as keyword, string, variable, etc. until you get the colours you like. (The colours are determined by your theme, so it requires a little experimenting.) You should probably close and re-open ST each time, after making these changes.

I shall add another setting to make it easier to do this in the future. Andy.

0 Likes

#14

Using a “dot” can now be achieved from the settings alone:

"use_icon" : true, "ST_icon" : "dot"
[On my computer it doesn’t like “circle” for some reason :confused: ]

"use_icon" : true, "ST_icon" : false // will continue to use my pencil.

0 Likes

#15

The latest (and hopefully last!) update handles automatic-insertions better. That is, automatically inserted brackets and quotes will often be included in the edit region.

It achieves this because, if you are starting a new-line or adding content to the end of an existing line, the edit-region will always extend to the end of this line. Automatic insertions will not, however, be accounted for if you begin editing in the middle of an existing line.


Multiple-line snippets are not treated as a single edit region, although the fields that you Tab to and complete will be. Use the Create command if you wish the snippet to be treated as a single edit-region. Andy.

0 Likes

#16

[quote=“agibsonsw”]

Do you not like my pencil? :wink:

Just for the moment you could comment out the following two lines in AndyEdits.py and add the third line:

[code]#ICON = path.pardir + ‘/AndyEdits/icon’ if \

sublime.load_settings(PACKAGE_SETTINGS).get(“use_icon”, True) else “”

ICON = “dot”[/code]
[Valid icon names are dot, circle, bookmark and cross.]

Open AndyEdits.sublime-settings and change these two lines:

"icon_scope": "class", "icon_current": "comment"
Change “class” and/or “comment” to different scope names, such as keyword, string, variable, etc. until you get the colours you like. (The colours are determined by your theme, so it requires a little experimenting.) You should probably close and re-open ST each time, after making these changes.

I shall add another setting to make it easier to do this in the future. Andy.[/quote]

The pencil is too distractive for me. Thank you very much!

0 Likes

#17

I’ve removed my request to place this on **PackageControl **pro-tem. I don’t think there is anything wrong with my code; I’m having rendering issues in ST which I think are related to my running an incorrect Ruby build-file. But until I’m certain I shouldn’t add it to PackageControl.

It would help if anyone using this could report any issues, or confirm that it is working fine? Andy.

0 Likes

#18

Apparently this issue has been encountered before when using add_regions(), and remains an unsolved issue with the ST-API - related to colour-themes.

It can be *fixed *though (apparently) by changing your theme to another (standard) theme, closing and re-starting ST. (If you are already using a standard theme then the issue may not arise.) I presume I can switch back to my custom theme once I’ve restarted ST.

At least it’s nothing to do with my code :smile:. I shall continue to keep an eye on this behaviour. Andy.

0 Likes

#19

would be nice if you could add these to command list (just tooo many key combo to remember :B)

0 Likes

#20

It is available via **PackageControl **now and includes context-menu (right-click) entries.

Just a reminder that in **Windows **there may be a rendering issue (with the scrollbar and ruler). This is due to ST behaviour :blush: , not my code :sunglasses: !

0 Likes

#21

Currently, “icon_current” is just for the modifying line.
Is it possible to make the “icon_current” for the changes that is not saved (and the “icon_scope” is for saved changes)?

0 Likes

#22

[quote=“singw”]Currently, “icon_current” is just for the modifying line.
Is it possible to make the “icon_current” for the changes that is not saved (and the “icon_scope” is for saved changes)?[/quote]

Hello. Are you referring to saving of the file? That is, you would like two sets of colour - one colour for saved changes?

If so, it would be possible - although I would prefer to use three colours (scopes). I would still want the current edit-region to be differently-coloured, as it is *central *to the whole algorithm.

I’ll await your clarification. Andy.

0 Likes