Monday, April 12, 2010

Fixing Bespin Bug 558783 - Release 0.2

Yesterday I decided to put the Java-EE and the accompanying tribulations to rest for the night and
work on OSD. I had previously spoken to jviereck about a bug involving implementing TM's SmartMove. I was able to accomplish this last night. Much to my advantage, Harjinder had just worked on bug 557135 involving implementing the indent feature, and since TM's SmartMove is basically a fancy way of saying, 'make the cursor jump over a tab where tab was pressed', he had the foundation by knowing that 'tabstop' in the JavaScript files were the default size of a tab. Combined with Skype and TeamViewer (using TeamViewer because Harjinder could not run Skype on Linux and could not run Bespin on Windows), we banded together to work on bug 558783 and successfully completed it before the sun came up. We finished our work at 3:30 am, at which point I was still at the school because my DSL modem at my apartment appears to have broken down and needs to be replaced (at probably one of the worst possible times...).

I encountered a few issues while working on the patch, but for the most part they were mistakes caused by it being a late night and having worked on other things all day. These problems included, but were not limited to:

var line = lines[range.start.end];

instead of

var line = lines[range.start.row];

or little algorithm issues such as:

if(((count * 1) * -1) >= tabstop){
count = tabstop;
count = count * -1;
}
else{
count = -1;
}

in the moveLeft function instead of

if((count * -1) >= tabstop){
count = tabstop;
count = count * -1;
}
else{
count = -1;
}

which would end up making the if statement evaluate count as a negative instead of a positive which would end up having the cursor's behaviour unpredictable and incorrect once the left cursor was pressed. A lot of the time, however, when different changes were made, it would just break the function altogether and when left was pressed, the cursor would be at a standstill.

You can find the bug page here and the source code that was required to implement this smart-move behaviour in Bespin here

No comments:

Post a Comment