Sublime Forum

Andy Edits

#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

#23

[quote=ā€œagibsonswā€]

[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.[/quote]

Yes I am referring saving of the file. 1 color for saved changes, 1 color for edited but not saved changes.
For more clear, please have a look on my previous post on other thread https://forum.sublimetext.com/t/highlighting-lines-changed-from-the-last-commit/5867/1#p31999 . After looking the attached screenshot inside that post, you may more clear on what I mean.

Currently the ā€œicon_currentā€ setting is for the last edited line, and ā€œicon_scopeā€ is for changed line (no matter saved or not).

For what you said ā€œthree coloursā€, you mean 1 color for saved lines, 1 color for edited but not saved lines, and 1 color for last edited lines? Thatā€™s also great. :smile:
But the last edited lines also got the state of (saved) or (edited but not saved), so, it should be 4 colors. But seems like to muchā€¦right? :open_mouth:
So, I hope the 2 colors set and 3 colors set can be an option. :smiley:

0 Likes