Re: Key bindings and subclasssing



Owen Taylor wrote:

IMO, there is no API in GtkTextView for customizing the cursor
navigation; anything you do ... whether overriding move-cursor,
connecting to key press events, etc, is a hack.
Now, these hacks are
"ABI supported", in that we are very unlikely to remove the signal
or modify it, but they are inherently fragile and are not really
supportable at the level of behavioral details. If some new feature
is added to GtkTextView it may have strange and unpleasant interactions
with your hack.
Sure, I do realize that the safest would be not to do anything. But what if I do want to achieve certain goals? Should I write a new text widget, or copy/paste GtkTextView sources
and modify them? First is plain impossible, second is stupid, isn't it?
'Forward compatibility' is impossible anyway; say, I have undo/redo here, and it will likely
break when stock GtkTextView and GtkEntry finally get it.

In my further opinion, the right sort of API for customization here is
likely not at the level of user actions, but at the level of how
GtkTextView understands its contents.
Well, this is what I am trying to do in the subclass. But, when user presses ctrl-left, the widget
must do the right thing, regardless of the philosophy/design behind.

After all, if you customize
word navigation by overriding move-cursor, you've created a disconnect
between the word boundaries for keynav and the word boundaries the
users sees when they double-click to select words with the mouse.
Right, I have to override mouse stuff too. Come on, changing something doesn't necessarily imply
creating broken inconsistent mess.

Best regards,
Yevgen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]