It is currently Wed Jul 08, 2020 12:09 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Bug in IDE - double click to select problem
PostPosted: Fri Feb 28, 2020 3:05 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu May 30, 2013 4:39 pm
Posts: 507
If I double click on a binary value only the digits, without the % will be selected.
On a hex value it works as expected.

%10000001 ; double click will select 1 to 1 only
$0F ; double click will select $ to F, as expected.

OSX 10.13.6 PB 5.62


Top
 Profile  
Reply with quote  
 Post subject: Re: Bug in IDE - double click to select problem
PostPosted: Sun Mar 01, 2020 12:40 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Jun 25, 2014 5:25 pm
Posts: 415
Location: Germany
The responsible code part:
Code:
; add *@$# to the word characters, so they get included in the selection
; when you double-click a word (to so select constants/variables easily)

WordChars$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_$@#*"
For k = 192 To 255
  WordChars$+Chr(k) ; For ASCII mode, to have "é, à" etc. (https://www.purebasic.fr/english/viewtopic.php?f=4&t=57421)
Next
SendEditorMessage(#SCI_SETWORDCHARS, 0, ToAscii(WordChars$))
(https://github.com/fantaisie-software/p ... 3349-L3356)

As can be seen, it is only possible to specify here which characters a word may have. This is problematic because the character % is not only the prefix for a binary number, but also the character for the modulo operator.

When the % character is added to the WordChars$ string variable, then double-clicking words will mark too much if there is no space or other separator before the % character:
Quote:
a = %1010101 ; Okay

b = 15%10 ; Not okay. The 15 or the 10 can no longer be marked separately.

c = value%10 ; Not okay. The value or the 10 can no longer be marked separately.

d = $F%10 ; Not okay. The $F or the 10 can no longer be marked separately.

But this problematic effect has also an advantage, because it forces a better programming style — space before and after the %-operator (and all other operators to stay consistent).

_________________
Image
Why OpenSource should have a license
PureBasic-CodeArchiv-Rebirth: Git-Repository / Download – Any help is welcome!
Manjaro Xfce x64 (Main system) :: WindowsXP/Xubuntu x86 (VirtualBox) :: PureBasic (Linux: x86/x64, Windows: x86) :: All are up to date


Top
 Profile  
Reply with quote  
 Post subject: Re: Bug in IDE - double click to select problem
PostPosted: Sun Mar 01, 2020 1:28 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu May 30, 2013 4:39 pm
Posts: 507
Sicro wrote:
Quote:
a = %1010101 ; Okay

b = 15%10 ; Not okay. The 15 or the 10 can no longer be marked separately.

c = value%10 ; Not okay. The value or the 10 can no longer be marked separately.

d = $F%10 ; Not okay. The $F or the 10 can no longer be marked separately.


These seams to me ok. To me the the logic is variable SPACE operation SPACE value.

c = value % 10 ;
d = $F % 10 ;
This makes to me more sense because in these case % is a operation. If I do a double click I aspect to select the whole value and in case of a binary value the % is apart of it.


Top
 Profile  
Reply with quote  
 Post subject: Re: Bug in IDE - double click to select problem
PostPosted: Tue Mar 03, 2020 8:06 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Jun 25, 2014 5:25 pm
Posts: 415
Location: Germany
Wolfram wrote:
These seams to me ok. To me the the logic is variable SPACE operation SPACE value.
I was just trying to illustrate the problem with adapting this behavior. I support your change request. As I wrote above: It enforces a better programming style. :wink:

_________________
Image
Why OpenSource should have a license
PureBasic-CodeArchiv-Rebirth: Git-Repository / Download – Any help is welcome!
Manjaro Xfce x64 (Main system) :: WindowsXP/Xubuntu x86 (VirtualBox) :: PureBasic (Linux: x86/x64, Windows: x86) :: All are up to date


Top
 Profile  
Reply with quote  
 Post subject: Re: Bug in IDE - double click to select problem
PostPosted: Tue Mar 03, 2020 9:29 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 13, 2010 3:45 pm
Posts: 1116
Wolfram wrote:
If I double click on a binary value only the digits, without the % will be selected.

There you have exactly the opposite of what happens with the @address operator :) When you double-click on the variable name, the @ is taken along, although this should not be.

https://www.purebasic.fr/english/viewtopic.php?f=4&t=69291

_________________
sorry for my bad english


Top
 Profile  
Reply with quote  
 Post subject: Re: Bug in IDE - double click to select problem
PostPosted: Tue Mar 03, 2020 11:21 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Jun 25, 2014 5:25 pm
Posts: 415
Location: Germany
PR on GitHub: https://github.com/fantaisie-software/purebasic/pull/66

_________________
Image
Why OpenSource should have a license
PureBasic-CodeArchiv-Rebirth: Git-Repository / Download – Any help is welcome!
Manjaro Xfce x64 (Main system) :: WindowsXP/Xubuntu x86 (VirtualBox) :: PureBasic (Linux: x86/x64, Windows: x86) :: All are up to date


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye