case correction inside quotes

Working on new editor enhancements?
rory-games
User
User
Posts: 31
Joined: Sun Feb 02, 2020 9:14 am
Contact:

case correction inside quotes

Post by rory-games »

This has been a pressing concern for a while now, and it's getting really annoying, so I figured I may as well post about it here.
Let's say I have a string for a button that is called "back to main screen"
Well, pure basic randomly capitalized the To, but sometimes it did and sometimes not, causing identification of the used thing via if expressions to become extremely tedious
For a more accurate representation of what has been happening:
listviewgadget
in listviewgadget, 3 items, view intentory, item shop and back to main screen.
If user selected back to main screen, go back to main screen
But one of them were capitalized and the other not.
Could this please be fixed?

// Not a bug. Moved "The PureBasic Editor" (Kiffi)
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: [urgent] case correction inside quotes

Post by Caronte3D »

Post a working code so we can test it.
User avatar
oreopa
Enthusiast
Enthusiast
Posts: 281
Joined: Sat Jun 24, 2006 3:29 am
Location: Edinburgh, Scotland.

Re: [urgent] case correction inside quotes

Post by oreopa »

I have never found that the IDE does this "randomly". It happens when you delete a quote mark and move away from that line. Which *is* kinda annoying, but I accept it.

Alternatively, you could turn off case correction in the options, which is not ideal imo, but PB is case-insensitive after all.
Proud supporter of PB! * Musician * C64/6502 Freak
Olli
Addict
Addict
Posts: 1071
Joined: Wed May 27, 2020 12:26 pm

Re: case correction inside quotes

Post by Olli »

Personnally, all options are shut down for me : auto-indent, auto-completion, case correction, debugger etc...

It just stays the highlighting system, and the [Control]+ options : this modifies the source exactly when I want.
There is the whole syntax command too, in the bar system.

Finally... I keep 2 or 3 options, but all that modifies automatically the code has been removed. I think these options are good when we want to discover a new version, new features, or when we are beginners. But, once we know the basis, it could be more useless than useful.

I see what rory-games is talking about : a "multi-concatenated" string source code line.

Code: Select all

A$ = "Name : " + Name$ + Chr(9) + "Hobby : " + Hobby$ + Chr(9) + "Etc..."
I suggest, that,

this system, this automatic one, should execute this source code modifying, only if assertions.

I suggest, that,

these assertions, should be as booleannally true, if

Code: Select all

CountString(SourceCodeLine$, Chr(34) ) <= 2
I have a question :

How could I know, howmany bytes must be allocated to load file datas of the IDE source code ?


Thank you
User avatar
oreopa
Enthusiast
Enthusiast
Posts: 281
Joined: Sat Jun 24, 2006 3:29 am
Location: Edinburgh, Scotland.

Re: case correction inside quotes

Post by oreopa »

I don't know why you are overcomplicating it. It is simply a quote pair "problem", which exists in other editors and is not specific to PureBasic. A similar type of thing happens on Commodore 64 even :)

To overcome the "problem" one would need to introduce stupid logic to the case correction, and IMO is simply not worth it.
Proud supporter of PB! * Musician * C64/6502 Freak
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: case correction inside quotes

Post by IdeasVacuum »

exists in other editors
Absolutely true. UltraEdit, for all it's whistles and bells, is the same. The trick is to place opening and closing quotes first, then insert your text.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: case correction inside quotes

Post by BarryG »

oreopa wrote:A similar type of thing happens on Commodore 64 even
Example? I've never seen this on C64 (case-changing when editing a line).
User avatar
oreopa
Enthusiast
Enthusiast
Posts: 281
Joined: Sat Jun 24, 2006 3:29 am
Location: Edinburgh, Scotland.

Re: case correction inside quotes

Post by oreopa »

BarryG wrote:
oreopa wrote:A similar type of thing happens on Commodore 64 even
Example? I've never seen this on C64 (case-changing when editing a line).
Sorry. I wasn't clear. I was just referring to the fact the C64 also has *a* double quotes "problem". An entirely different one, albeit.
Proud supporter of PB! * Musician * C64/6502 Freak
User avatar
Demivec
Addict
Addict
Posts: 4086
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: case correction inside quotes

Post by Demivec »

The PureBasic IDE has several situations where problematic case correction occurs. I encounter them often. The ones I list deal with quotes and comments.

Here are the ones I encounter:
  • When the initial ';' is deleted accidentally from the start of a comment. This sometimes happens if pressing [Ctrl+Shift+B] while being anywhere within the line.

    Code: Select all

    ;select csv data file or files to add to database.
    ;Select csv Data file Or files To add To database. ;deleted ';' from previous line and then undid the action
    Only solution to this is to simply be careful.
  • When pasting multiple lines of text that would become a comment but this has since been fixed by adding options to paste multi-lined text as comments where a ';' is added automatically at the beginning of each line.

    Code: Select all

    ;This is the original quote and for this example it is already broken up into separate lines.
    A database is an organized collection of data, generally stored and accessed
    electronically from a computer system. Where databases are more complex they
    are often developed using formal design and modeling techniques.
    
    ;The three line quote is pasted by pasting [Ctrl+Shift+V]
    ;A database is an organized collection of data, generally stored and accessed
    ;electronically from a computer system. Where databases are more complex they
    ;are often developed using formal design and modeling techniques.
    
    ;The three line quote is pasted first and then ';' is added at the front of each line manually.
    ;A database is an organized collection of Data, generally stored And accessed
    ;electronically from a computer system. Where databases are more complex they
    ;are often developed using formal design And modeling techniques.
    
    ;There is one more possible problem situation where a commented quote is longer than desired
    ;and is broken up by pressing return and then adding the ';' to the new line.  This is solved by typing the ';' first and then pressing return in front of that new ';' so that the new line is treated as a comment right from the start.  The portion of the line that will become a new comment line can also be highlighted, cut [Ctrl+X], and pasted as a comment on the next line by using [Ctrl+Shift+V].
  • When breaking up an already quoted string into smaller parts to make use of concatenation.

    Code: Select all

    shape$ = "Box"
    ;edit the following line by modifying it to adding the concatenation of shape$ and remove the word 'point'.
    a$ = "Draw a line or point while holding the right button and stop only if needed."
    a$ = "Draw a line or " + shape$ + "While holding the right button And stop only If needed."
    

    The only solutions to this are to retype the whole line after the first character that differs or perhaps to paste in two quotes first '""' into the middle of the string. Both of these choices leave something to be desired. A good solution might be if the case correction can be turned off until the cursor moves to a different line.
User avatar
oreopa
Enthusiast
Enthusiast
Posts: 281
Joined: Sat Jun 24, 2006 3:29 am
Location: Edinburgh, Scotland.

Re: case correction inside quotes

Post by oreopa »

Demivec wrote:A good solution might be if the case correction can be turned off until the cursor moves to a different line.
I thought of this myself, then I realized that it's more often than not that I actually press cursor up/down by accident whilst editing a string - triggering this situation in the first place :D So it really wouldn't fix anything for me.

I think I will use your earlier mentioned solution...
Demivec wrote:Only solution to this is to simply be careful
:D
Proud supporter of PB! * Musician * C64/6502 Freak
User avatar
Demivec
Addict
Addict
Posts: 4086
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: case correction inside quotes

Post by Demivec »

I've given this some thought and made the realization that we don't need to implement additional logic In the IDE's case correction. Since the situations where problems occur are identifiable from a user's perspective perhaps some keypresses could be implemented to turn the case correction on/off or simply to toggle it. An indicator can also be added that shows whether case correction is active or not.
Post Reply