PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Roger Garstang on December 14, 2009, 12:25:56 AM

Title: Editor Tweaks
Post by: Roger Garstang on December 14, 2009, 12:25:56 AM
I can't remember where we left off on the completion key for the autocomplete dropdown, but it may need further tweaking.  I think initially I was liking Enter completing it and making a newline, but it seems like lately I need to just complete the selection and not do that.  Perhaps Enter going back to just completing the selection.  Also, I think we could make it work better and faster if it were something like Any key not a valid Char for a variable/function (AlphaNumeric, _, etc) completes the selection, Esc Cancels, Space completes and adds a space.  Then it would be less to test for.

For some reason my confine caret to text option isn't remembering all the time either.  Seems to be set then not set.  Does it get saved on a per project option?  If so it may need something saying this clearer and a Set as Default option.  Sometimes it works different depending on the line too like it doesn't consider lines with inline comments to have an end and positions the cursor where you click on them but at end of line for others.

What happened to the dropdown to select how lines behave too where you can set the Indent to copy from previous line or use previous statement to autoindent, etc.  I must not have noticed it was gone before.  Will this work with the new Edit Control?
Title: Re: Editor Tweaks
Post by: Paul Squires on December 15, 2009, 09:01:03 AM
Quote from: Roger Garstang on December 14, 2009, 12:25:56 AM
Perhaps Enter going back to just completing the selection.  Also, I think we could make it work better and faster if it were something like Any key not a valid Char for a variable/function (AlphaNumeric, _, etc) completes the selection, Esc Cancels, Space completes and adds a space.

I doubt that there will be a concensus on this one. Currently, ENTER completes the selection and adds a new line (and indents to previous line position if needed). That is how VB seems to work. Likewise, hitting SPACE completes the selection and adds a space. ESC cancels the dialog. Characters like open parenthesis "(" also completes the selection and adds to the end of the completion. If you just want to select the currently hightlighted option in the list then I suggest hitting SPACE and using Backspace to delete the space if needed. The only other option that I can think of is to use your mouse to double-click on the selection... but that kind of defeats the purpose (ie. speed) of using autocomplete in the first place.

Quote
For some reason my confine caret to text option isn't remembering all the time either.  Seems to be set then not set.  Does it get saved on a per project option? 
It is not saved on a per project basis. It is a global setting for all projects. The setting is saved in the FireFly.ini file "ConfineCaret=".

Quote
Sometimes it works different depending on the line too like it doesn't consider lines with inline comments to have an end and positions the cursor where you click on them but at end of line for others.

Not sure that I understand. You should be able to click anywhere withn the comment and start editing. I don't use confine to caret very much but from what I've seen, it seems to be working as intended.

Quote
What happened to the dropdown to select how lines behave too where you can set the Indent to copy from previous line or use previous statement to autoindent, etc.  I must not have noticed it was gone before.  Will this work with the new Edit Control?

That was an option from the CodeMax/CodeSense control that was used in FF2. FF3 uses the "Indent to previous line" option. Why? Because I liked that option the best. :)
Title: Re: Editor Tweaks
Post by: Roger Garstang on December 15, 2009, 12:35:40 PM
Don't use VB much anymore, but VS 2008 C# when pressing Enter it does the same as Space.  Not a big deal, just I find myself using both and Enter behaved different.  If the Non-AlphaNumeric would end selection too I think would be the better of them to look at...usually I'm mid line when wanting to press enter and the next char would be a +,-,=, comma, etc and if those ended the selection too then it would work fine. On the Confine to Caret issue, about 7 out of 10 times it works fine for me too, but what I meant I'll illustrate below...|= where cursor goes when I click off to the right of each line:

Line of code ' Comment Here              | Cursor will go here
Line of code without comment| Cusror will go here

Just seemed like it saw comment lines as not confining caret there and lines without comments it worked.  Usually when I start seeing this behavior if I go look it has turned off the setting on me too.

The missing indent option is fine too and I liked the indent to previous too.  I was just trying to find it to change and improve the indenting when pasting...this may have been fixed with the other copy/paste error you fixed earlier, but indenting usually was wrong on the last line pasted, or if the block was bigger than one screen/page the text beyond the page is indented wrong when pasting.  I was thinking maybe the option would have made it intelligent indent like VS does where no matter what indent position you paste to or paste from contained it indents to the position needed for each line.  FF2 used to almost do this, but it just pasted everything to the level it was at and I'd just have to indent an If Block or Do Loop, etc.
Title: Re: Editor Tweaks
Post by: Roger Garstang on December 15, 2009, 12:47:32 PM
Perhaps on pasting to get the correct indent, look at the first line of the copied text and the Paste Position-

1. If it has spaces/tabs then however many it takes to get to the first char of the first line remove from every line so they are all even.  May need to look at the space count of all lines and if any have spaces less than that amount, only remove that many spaces from all (including the first...this will leave space there, but keep it all in a even block) if they started copying mid-indent.  Would probably need to copy whole lines to clipboard for this to work too even if they start the copy from the first char, so everything gets aligned right. (If Mid-Line, pad to left with spaces? So not to copy text they don't want.)  Holding Alt+Drag to select a column like many editors do would help too.

2. Then look at where it is pasting and paste the first line unchanged, but add the number of spaces equal to the starting paste position to the rest of the lines, that way it will always position them relative to both.  Possibly LTrim any spaces from first line that came from #1 above.