On Tue, Sep 09, 2008 at 11:33:08PM +0200, Abdelrazak Younes wrote: > Vincent van Ravesteijn - TNW wrote: >> For the moment, forget this cur.setSelection() part. It is still not >> correct probably. Although I don't encounter the problem anymore, it >> might not be correct to call it in cur.setSelection(...). Maybe it >> breaks down something else. >> >> cs 26146 did solve a same problem, but then the selection is removed >> when the mouse is released. Iin this case however, the mouse isn't >> released yet, so the empty selections still exist. Maybe we should add >> it to line 1234 in Text3.cpp ? >> > > I am not sure I understand. I'll let JMarc handle this part. > >> Consider it work in progress.. >> > Still some comments: > > is_beg_pit and is_end_pit: please rename those to something more > meaningful related to the selection state. IIUC, maybe 'is_sel_begin' > and 'is_sel_end'? > > + char_type const bb[] = { row.sel_beg == 0 && is_beg_pit ? 1 : 0 + > + row.sel_end == par_->size() && is_end_pit ? 2 : 0 + > + row.sel_end == row.endpos() && sel_end_pos == row.endpos() ? 4 > : 0 }; >
Incitentalluy, since this is only a single char this might as well look like char_type const bb = row.sel_beg == 0 && is_beg_pit ? 1 : 0 + row.sel_end == par_->size() && is_end_pit ? 2 : 0 + row.sel_end == row.endpos() && sel_end_pos == row.endpos() ? 4 : 0; .... foo(&bb, 1); Look already a bot less convoluted. char_type bb = (row.sel_beg == 0 && is_beg_pit); bb |= (row.sel_end == par_->size() && is_end_pit) << 1; bb |= (row.sel_end == row.endpos() && sel_end_pos == row.endpos()) << 2; Hm. Not much difference. char_type bb = 0; if (row.sel_beg == 0 && is_beg_pit) bb += 1; if (row.sel_end == par_->size() && is_end_pit) bb += 2; if (row.sel_end == row.endpos() && sel_end_pos == row.endpos()) bb += 4; might make the intention mor obvious, even if it's a bit longer. Andre'