Procrastinating….Don’t we all, alright it’s time to get back to work mode…hehe. Not that I was not doing any work but I was just so caught up and I forgot to blog…First let me get started on my updates regarding my Bug Fix? In case you forgot I was assigned to fix a highlighting bug in Bespin, where we only wanted the selected text to be highlighted but not any special characters around it. So before fixing this bug I actually tried to reproduce the issue and here is what I experimented so far…
Test 1

If there is a string at the beginning of the line then the editor highlights everything till the start including the special characters.
Test 2
![]()
Characters including “!~@#$%^&*?[]`” are considered part of ‘text’ and are highlighted as well!
Test 3
![]()
Clicking on “2009” should not highlight the “" and “/”.
Now What? Well before digging into the coding part, I would have to locate where the code resides and to do that I have to find out….somehow…. I went straight to the Bespin’s Developers Guide, which contained a “Code Tour” that contained a brief introduction to the file structure and what each folder is for…
So I knew my bug was related to “Editor” and it must be a JavaScript file, so I narrowed it down to that…Now I had two folders one was “bespinclient” and the other was “bespinserver”. According to the “Code Tour” bespinclient folder contains “The JavaScript code that makes up the Bespin user interface. This is considered to be the “main” repository and is all that is actually used for Bespin Embedded”
Scrolling a little down and looking at the description of each folder under bespinclient folder, the “plugin” folder caught my eye. It said “This is where most of Bespin lives”, so I got excited and ran a “tree” command in /plugins/supported/Editor(wait how did I get past all those folders, well I guess I cheated, I saw another Bespin bug related to an issue with editor and saw the directory and file where the fix was made so thats why I figured this might be the right location to look into)
linux-bmul:/home/harjinder/bespinclient/plugins/supported/Editor # tree
.
|— commands
| `— editor.js
|— controllers
| |— layoutmanager.js
| `— undo.js
|— mixins
| `— textbuffer.js
|— models
| `— textstorage.js
|— plugin.json
|— tests
| |— controllers
| | `— layoutmanager.js
| |— models
| | `— textstorage.js
| `— utils
| `— rect.js
|— utils
| `— rect.js
`— views
|— canvas.js
|— editor.js
|— gutter.js
|— scroll.js
|— scroller.js
`— text.js
I initially opened the file text.js file because of its name and began skimming through the file…Came across a function called “mouseDown” and for case 2 it was commented “// Select the word under the cursor” so I figured this might be the code that is called when the user double clicks a word in the editor…(“Mouse” “clickcount” + “Select the word” , My Guess?) I will discuss more about it later as I further look into the file and try to put some pieces of the puzzle in this file together:P meaning understand how the code works..and what other functions are called within this code..
For now I’m off to bed, well maybe if I can sleep after having a large Starbucks cappuccino…I will continue with my post tomorrow and get into the technical part and start fixing the bug!
Bye:)