Notes on how to do selection like Microsoft Internet Explorer [Assume LTR for the moment] For the purposes of this algorithm, spaces are separate words Two flags: greedy_start_word greedy_end_word - Init: greedy_start_word = TRUE; greedy_end_word = FALSE On mouse movement: - if new position is within anchor word, begin_select = exact anchor point end_select = exact position if we are in different word than before (ie., we just entered the anchor word for the second time), greedy_start_word = FALSE else if movement was away from anchor point if we are in a different word than before greedy_end_word = TRUE else greedy_end_word = FALSE begin_select = exact anchor; end_select = exact position; if (greedy_start_word) if (position > anchor) /* FIXME RTL? */ begin_select = beginning of anchor_word else begin_select = end of anchor_word if (greedy_end_word) if (position > anchor) /* FIXME RTL? */ end_select = end of current word else end_select = beginning of current word