Sync editing - the current plugin is unsatisfactory
I tried the Sync Editing plugin in CudaText, and in spite of it is colorful and recognizes identifiers, it is IMHO useless.
I would welcome the old good Synwrite sync editing, which I frequently used and which was a big advantage of Synwrite.
What is useless and why, in that plugin? plugin must be improved, no way to have built-in SyncEditing.
@Alexey-T:
- Mainly because after the 1st change, the sync edit is deactivated (in Synwrite I may perform many changes),
- I recognize identifiers (at least in my own code), so no need from plugin to help me,
- I want synchronously edit no only identifiers,
- sometimes this plugin remains colorful after the 1st (synchronous) change, but sync edit is deactivated.
after me and @badrelmers finish the work on Spell Checker, I will try to work on this (or maybe Badr can help).
sometimes this plugin remains colorful
if you have fixed steps how to repeat it: please tell them.
@Alexey-T:
I opened directly the readme.txt file of that plugin. Then do this:
- Select rows 6 to 11 (inclusive).
- Plugins > Sync Editing > Activate
- Plugins > Sync Editing > Emulate mouse click
- By arrow keys in keyboard, insert text cursor into the colored word "sync" near the beginning of the row 11, and write something, then, leave it by "up" arrow key.
Note: I used the Highlight Occurrences plugin, too, I don't know if it is important.
@Alexey-T i never used syncwrite or this plugin and he did not describe what he needs exactly from syncwrite so i do not know what needs to be fixed i downloaded syncwrite but could not find how to enable sync edit in it to see how it worked
@MarianD
-
do you mean you want the sync edit to allow you to edit any word inside the selected text?
-
and you want it to remain enabled until you disable it so you can do multiple edits on different words ?
-
and you do not want colorized keywords?
-
so you simply want the plugin to be able to edit all the similar words inside the selected text continuously until you disable it?
once i finish with Spell Checker i may work on this if i understand the problem if God wills
SynWrite can be downloaded here: https://sourceforge.net/projects/synwrite/files/Release/
when you install it (or only unpack the .zip file) go into "Help / Help topics" and see the topic "Coding Helpers / SyncEditing". it gives the animation:
@badrelmers:
- do you mean you want the sync edit to allow you to edit any word inside the selected text?
- and you want it to remain enabled until you disable it so you can do multiple edits on different words ?
- and you do not want colorized keywords?
- so you simply want the plugin to be able to edit all the similar words inside the selected text continuously until you disable it?
Yes, exactly. In point 3, colorized keywords may be an option with choice to disable it.
@badrelmers
SynWrite Sync editing may be starting / ending not only from the Edit menu, but with a single click in the gutter just near the last selected line , too:
yes, now i see the difference, it is more easier to work with this in syncwrite. i will attempt to make it work similar in this plugin in next few days if God wills
maybe wrong, maybe good suggestions… but share it here…
• use syncedit_naive_mode as true as default for txt, mkd, todo…
• use message center if missing regext settings, or missing naive mode searching… or…
• if possible add activate/cancel at folding bar…
some hints about API, to make it possible to 'emulate' SynWrite's gutter icon for SyncEditing.
- API allows to add via
Editor.bookmark()bookmarks with COLOR_NONE backgnd color and with custom icon. this way plugin can add (and later change line-index) the gutter icon. Editor.bookmark()has actions beginning withBOOKMARK2_. none plugins did use them yet. maybe can help here? plugin can add this non-colored bookmark to 'bookmarks2' list preventing conflicts with usual user's bookmarks.- API allows to handle click on the gutter:
on_click_gutter(self, ed_self, state, nline, nband): Called on mouse click on gutter area. Param "state": same as in on_key. Param "nline": index of editor line. Param "nband": index of gutter band. Method can return False to disable default processing.
this way plugin can handle click on gutter's SyncEditing icon.
and:
- plugin can show gutter's icon not via bookmark (without backgnd) but via 'decor' on gutter. API is
Editor.decor(). decor-items can have short text or icon.
This comes in handy
@MiroslavMatas your suggestions are welcome.
• use syncedit_naive_mode as true as default for txt, mkd, todo…
syncedit_naive_mode is already true for txt, mkd by default. for todo i m not sure if i should change the defaults without a reason. do you have a good reason?
• use message center if missing regext settings, or missing naive mode searching… or…
- can you explain what do you mean?
- which regex settings do you mean?
- what is naive mode searching? do you mean syncedit_naive_mode? how can it be missing? it is optional!
you should explain in detail, because i never used this plugin or similar thing, so i need full details of the wanted features to implement it correctly
• if possible add activate/cancel at folding bar…
yes i will add it if God wills
@MarianD half of what you want can already be done in the current version! did you read the plugin readme documentation?
I recognize identifiers (at least in my own code), so no need from plugin to help me,
you can already disable identifiers colors by setting "syncedit_mark_words": false, in user.json:
I want synchronously edit no only identifiers,
you can already achieve this by setting "syncedit_naive_mode": true, in lexer-specific config in CudaText "Options / Settings lexer specific"
but you have to do it for every lexer, so maybe i need to add a global config setting that allows this for all lexers at once
the rest of your points are valid, i m working on them.
but you have to do it for every lexer, so maybe i need to add a global config setting that allows this for all lexers at once
I agree.
the rest of your points are valid, i m working on them.
It's nice from you. I am looking forward to your improvements.
but you have to do it for every lexer, so maybe i need to add a global config setting that allows this for all lexers at once
it is already supported. if a setting is in the 'user.json', it is global for all lexers, the next 'layer' is lexer-specific config 'lexer Nnn.json' which may have the same option, but for only single lexer.
python module cudax_lib gives func get_opt which supports this layered system.
@Alexey-T thank you, your comments are very helpful.
i was going to change the config settings to use a separated file (ex: cuda_sync_editing.ini/json) because the readme currently is over-complicated so i wanted to simplify it by creating a simple usage at the beginning for normal users and put the advanced things in another section called advanced for more advanced users, and gave only one config setting file instead of talking of two different config files (user.json and lexers configs), this will simplify the user experience and make the plugin config similar to the other plugins. is this correct? or should i stick with the current config model?
current config model is good becauze:
user can put options "case_sens" and others to per lexer configs, e.g. "case_sens" for Pascal will be in "lexer Pascal.json" and be false ; "case_sens" for C++ will be in "lexer C++.json" and be true.
same for other options, e.g. "id_regex" is different for different lexers!
@Alexey-T yes, the per lexer configs will not be removed, it will be moved to the advanced section
i was talking about the user.json, should i replace its usage by a separated config file (ex: cuda_sync_editing.ini/json) ? this is because all the plugins i saw use a separated config file, it is more intuitive and easier to manage, users have only to click the config menu then the config file is opened , currently with this plugin it is over-complicated: when the user clicks the config menu it opens a window telling him this:
then the help opens and between those multiple lines we tell him to do:
Also you can write to CudaText's user.json these options:
and also this:
To configure Sync Editing, open lexer-specific config in CudaText "Options / Settings lexer specific", and write there options:
....
this is just confusing and only an experienced Cudatext user will understand from the first time
what i plan to do is to put a simple section that talks about the config settings for general usage which can be put in cuda_sync_editing.ini/json and when the user click the config menu he will get the config file opened with the default settings already autogenerated, so he can simply change the settings values like any other plugin without needing to copy paste the settings. then in the advanced section we talk about specific lexer config which can be done with "Options / Settings lexer specific"
is this fine or should i stick with the user.json file?
it is OK.
do the separate config-file with .ini format.
i suggest to allow sections there:
[lexer_Pascal]
[lexer_Bash script]
to replace options in the lexer-spec-configs.
perfect.
i suggest to allow sections there: [lexer_Pascal] [lexer_Bash script] to replace options in the lexer-spec-configs.
great idea this will simplify things more and more. but do you mean to offer two ways to config the per-lexer configs:
- sections in cuda_sync_editing.ini
- "Options / Settings lexer specific"
or do you mean to remove the "Options / Settings lexer specific" and keep only the new sections in cuda_sync_editing.ini?
to remove the "Options / Settings lexer specific"
this Cud menu item will be kept of course. but SyncEditing plugin won't use lexer-specific configs. is this your idea? to replace lexer-specific configs with one cuda_sync_editing.ini ?
and keep only the new sections in cuda_sync_editing.ini?
i guess this is your suggestion and it is OK, because simpler for users.
i guess this is your suggestion and it is OK, because simpler for users.
good. yes, this is what i meant.
thank you
@MiroslavMatas i just found that TODO lexer have no ID's similar to text files, so it need naive mode as you requested. i added also json. if you know other lexers that needs naive mode please tell me about them.
@MiroslavMatas i just found that TODO lexer have no ID's similar to text files, so it need naive mode as you requested. i added also json. if you know other lexers that needs naive mode please tell me about them.
my usage for that on "non-dev-code files" - is on txt/mkd/todo/cfg… I do not expect to look for ID's on these files… so, in short - not usage on source code…
@MiroslavMatas
i could not find cfg in Cudatext lexers, when i open a cfg file cudatext open it as "Ini files", so i added ini to the naive mode. if you mean with cfg other thing then tell me which lexer is.
'cfg' is not a standard (like INI on Windows). many apps write different things to 'cfg' files. some apps write 'almost INI' to 'cfg' files (e.g. val=true instead of val=1).
@MarianD @MiroslavMatas Plugin was changed very much. now it is better. please try from Git:
- Plugins / Addons Manager / Install from Git
- enter URL: https://github.com/CudaText-addons/cuda_sync_editing
few issues are waiting for the fix, https://github.com/CudaText-addons/cuda_sync_editing/issues . if you see bugs, make an 'issue' at that page.