>>>>> "Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes:

>> This is not a bad idea indeed.

Abdelrazak> Translation for non-native French speakers: this is a
Abdelrazak> _good_ idea ;-)

Yes, but I think that it double with selHandle.

>> A question though: how does this relates to selHandle?

Abdelrazak> selHandle() is a member of Cursor and we need something
Abdelrazak> BufferView dependent.

Cursor has access to BufferView.

>> It looks like saveSelection could directly be called there, isn't
>> it?

Abdelrazak> No because we use a lot of local Cursor copies (which is
Abdelrazak> very bad IMO). I think we agree that it would be better
Abdelrazak> but we are not ready for that.

selHandle is not the same as clearing selection on a cursor. It is a
tool used in Text3.cpp for lfuns that may begin a selection or
terminate one (does that ring a bell?). 

Basically

LFUN_CHAR_FORWARD ==> selHandle(false)

  * if there is no selection, do nothing
  * if there is a selection, clear it

LFUN_CHAR_FORWARD_SELECT ==> selHandle(true)

  * if there is a selection, do nothing
  * if there is no selection, start one.

The patch below would call saveSelection only in the second case of
selHandle(false). What would be missing now with respect to the
ClearSelection flag approach? From what I see, only the lfuns that
delete something (and mouse press) would remain to be handled.

JMarc

PS: sorry if I explained things you already know.


Index: src/Cursor.cpp
===================================================================
--- src/Cursor.cpp	(révision 18996)
+++ src/Cursor.cpp	(copie de travail)
@@ -588,9 +588,10 @@ bool Cursor::selHandle(bool sel)
 	if (sel == selection())
 		return false;
 
+	if (!sel)
+		cap::saveSelection(*this);
 	resetAnchor();
 	selection() = sel;
-	cap::saveSelection(*this);
 	return true;
 }
 

Reply via email to