Bug? B4A Editor - Unusual behaviour

leongcc

Member
Licensed User
Longtime User
1) Occasionally it is impossible to edit variable names.
Happens more often in Version 3.82 then 2.5
Please see video: https://sites.google.com/site/seewaterdesign/Home/b4a_editor.mp4
Please note that this video will be deleted from the host in a few days from today.
In the video, I was trying very hard to change 'STATE_DATA3' to 'STATE_DATA1'.
Both these variables are defined as integer.
Also notice that there is a non-editable space character in front of the cursor and characters overlapped.
Changing font type did not help.

2) When File>Save is selected, current module on display is automatically replaced with another module.
When item 1 above happens and I select File>Save, the module being edited is no longer on the display. Another module now appears on display and this module was on the display when I last did a File>Save.
It is difficult to record this on video because it happens very fast.
I will attempt to record it if this is required.
 

leongcc

Member
Licensed User
Longtime User
This happens when editing a fully released project or a project under development.
For a fully released project, no references are missing and no build errors.
It also happens when typing in a yet-to-be defined variable name or typing in an already defined name.
Does not happen when typing on a comment line.

In version 2.5, selecting File>Save usually reset the problem and I would be able to type normally.
In version 3.82, selecting File>Save does not help but gives another problem (item 2) above.
Closing and opening B4A editor always correct the problem but then it may re-surface.
 

leongcc

Member
Licensed User
Longtime User
2 more screeshots where the text are corrupted:
https://sites.google.com/site/seewaterdesign/Home/b4aEditor1.jpg
https://sites.google.com/site/seewaterdesign/Home/b4aEditor2.jpg

Some more details:

1) My PC is Win7 64bits, 2560x1440pixel display (not sure if this is a cause).
2) Problems happen regardless editor font (current font is Tahoma 9).
2) Problems happen regardless jdk1.6 or jdk1.7.
3) Problems happen regardless project can be compiled correctly or not.
4) Problem1 does NOT happen if the variable is defined in another module.
5) Problem1 does NOT happen if the variable name starts with lowercase letters
Dim state_DATA1 As Int =6 'Does not happen
Dim statedata1 As Int=6 'Does not happen
Dim STATE_data1 As Int =6 'Tends to happen
Dim STATE_DATA1 As Int=6 'Tends to happen
 

leongcc

Member
Licensed User
Longtime User
Nothing wrong with my keyboard.
I have also re-installed B4A, ADK, etc.. several times.
The symptoms of the 2 problems I have described (together with pictures and video) are very easy to reproduce.

For problem1, I am guessing there might be a fault in a background task in B4A Editor, the task could be the one that does dynamic reference look-up, syntax checking, etc. It doesn't like uppercase variable names. As I type, it could be trying to visually alert me around the cursor. Much like multiplexing LEDs to trick our eyes' persistent of vision, the display shows a composite of all the quick changes. So a text-based Editor can show graphic corruption like what I am seeing.

A clue:
Please look at the source codes
B4X:
Sub Process_Globals
Dim Quantity as Int
End Sub

Sub abc (quantity as Int)
...
End Sub

As we go about editing our other parts of the source codes, we will notice that B4A Editor will eventually and autonomously change all occurrances of 'Quantity' to 'quantity'. B4A Editor does not like uppercase variable names.


For problem2, likely a bug in B4A Editor.
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
Strange... Fyi - I use UPPER_CASE variable names all the time for constants (old habit) & I don't ever see this issue.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I also use upper case variables and never encountered this issue.

The IDE should change the case of quantity. The code you posted is not valid code so which one of the cases (quantity of Quantity) will be selected is unpredictable.

The strange character issue will be tracked. If you are able to reproduce it in a simple way then please post the steps.
 

Kevin

Well-Known Member
Licensed User
Longtime User
This only happens when typing or editing variable names? My initial impression is that it is a graphical glitch related to your video card, but it is a bit strange that you don't see it more often then. Having used PCs for a long time, I have seen occasionally strange glitches like you show in your video but never in B4A.

Out of curiosity, when this glitch occurs, if you move the B4A IDE window off-screen enough to hide the glitch then move the window back, does the glitch remain or does it fix itself? This could also be tested by moving another window over the B4A IDE window to temporarily cover the glitch. These two things will force a redraw of that part of the window.

What I am getting at is that if these two things fix the glitch then I would be more inclined to point towards the video card in which case you could try updating the driver for it to see if it helps at all. In my experience these types of glitches tend to happen more when the system is being taxed at the moment or hasn't seen a reboot in days.
 

leongcc

Member
Licensed User
Longtime User
I re-boot daily and just updated the video driver.
I tried those steps you suggested but the corruption is still there but they look different. For instance when 'D' is overlapping 'A' and I move another window over it, 'A' is now overlapping 'D'.

I do not experience display corruption like this in the other editors and IDEs, including Ecilpse, MPLAB, MT4, Notepad2, OpenOfffice, etc, etc..

This might not be related but I mention here in case other members can share similar experiences:
I am using a 2560x1440pixel monitor with DisplayPort and the system font size is set at 125% (my preferred setting).
The Log window in B4A Editor cannot show underscore-characters because text is enlarged but inter-line spacing remains the same.
eg. Log("abc_def") => the text appears in the log as 'abc def' without the underscore.
If I change system font size to 100% (the default), the underscores can be seen but the text corruption problem is still there but less messy.

If AnyWhere Software allows, I would like to install B4A in another PC just to investigate further.
 

leongcc

Member
Licensed User
Longtime User
I think I found the cause, now I do not have corrupted variable names in my Editor, I will monitor for a few days.

What I did was I changed to each and every font in B4A Editor and found some fonts do not cause problems.
Those fonts that cause problem are those produced by Microsoft and MonoType, eg. Arial, Times New Roman, Contantia, etc..
I have been using TimesNewRoman for B4A Editor (I had mistaken said I use Tahoma for B4A in my previous post).

So now I use Gentium which is close to TimeNewRoman, no strange text appearing so far.
My Problem1 is taken care of, although I don't know why.
Now I still have to live with Problem2 and the disappearing underscore-characters.

Thanks for your assistance.
 

leongcc

Member
Licensed User
Longtime User
Just read from somewhere that win7 has a bug relating to font size 125%.

Hopefully the followings can reproduce the problem.
- Use a high res monitor.
- At ControlPanel, set font to 125% and then Restore default fonts. Set system font to Tahoma.
- At B4A, select TimesNewRoman.
- Dim some variables in uppercase and then try to edit them.

One reason I use high res displayport monitor is iOS development. Its more convenient to work on graphics with a montor that has more pixels than retina ipad.
 
Top