pharo icon indicating copy to clipboard operation
pharo copied to clipboard

Symbol selection: a proposal

Open Ducasse opened this issue 8 months ago • 13 comments

After working a lot with symbol and classes. Here is a proposal

  • simple click selects the text without the #
  • shift + simple click select the complete symbol

Ducasse avatar Oct 07 '23 14:10 Ducasse

@jecisc we should introduce this one for the selection symbol

Ducasse avatar Nov 12 '23 22:11 Ducasse

This is not so simple because Rubric is filtering the shift event to extend the selection so the event is not passed down to the click management

jecisc avatar Nov 24 '23 10:11 jecisc

what are the combinations that we have? shift command option we could have option shift click or option cmd click for the # + symbol

Ducasse avatar Dec 09 '23 21:12 Ducasse

After working a lot with symbol and classes. Here is a proposal

* simple click selects the text without the #

* shift + simple click select the complete symbol

I like the idea of Shift + Double click to select the complete symbol.

This is not so simple because Rubric is filtering the shift event to extend the selection so the event is not passed down to the click management

Indeed is not so simple, and it is in the world loop (meaning the WorldMorph loop is constantly checking closeTypeIn). One problem I've found is that there's no easy way to get the shift key state in selectWord (did you found one?).

On the other side it's strange that in performCmdActionsWith: aKeyboardEvent shifted: aBoolean return: return aBoolean is never used in the method. So one way is to set a new instance variable there to keep track of the shifted state.

Another thing which could be needed is to handle the command key:

defaultCommandKeymapping
	| cmdMap |

	cmdMap := Dictionary new.
	{(KeyboardKey home -> #cursorHome:).
	(KeyboardKey end -> #cursorEnd:).
	(KeyboardKey backspace -> #backspace:).
	(KeyboardKey pageUp -> #cursorPageUp:).
	(KeyboardKey pageDown -> #cursorPageDown:).
	(KeyboardKey enter -> #crWithIndent:).
	(KeyboardKey escape -> #escape:).
	(KeyboardKey left -> #cursorLeft:).
	(KeyboardKey right -> #cursorRight:).
	(KeyboardKey up -> #cursorUp:).
	(KeyboardKey down -> #cursorDown:).
	(KeyboardKey keypadLeft -> #cursorLeft:).
	(KeyboardKey keypadRight -> #cursorRight:).
	(KeyboardKey keypadUp -> #cursorUp:).
	(KeyboardKey keypadDown -> #cursorDown:).
	(KeyboardKey keypadEnter -> #crWithIndent:).
	(KeyboardKey tab -> #tab:).
	(KeyboardKey delete -> #forwardDelete:).
	(KeyboardKey shiftLeft -> #shiftSelect:) .            " <---------- ADD HERE "
	(KeyboardKey shiftRight -> #shiftSelect:) .          " <---------- ADD HERE "
	(KeyboardKey menu -> #menu:)} do: [ :assoc |
		cmdMap at: assoc key  put: assoc value ].
	^ cmdMap

But if there's a way to know the shift state in RubTextEditor please let me know :)

hernanmd avatar Mar 18 '24 14:03 hernanmd

Add an instance variable then.

Ducasse avatar Mar 18 '24 19:03 Ducasse

Now if option + click or command + shift is working then we can use them too.

Ducasse avatar Mar 18 '24 19:03 Ducasse

Now if option + click or command + shift is working then we can use them too.

I checked and it's taken by the halo thing

hernanmd avatar Mar 18 '24 19:03 hernanmd

should this really be fixed before release? I like the change, but I can hardly see it as a show stopper :P

estebanlm avatar Apr 05 '24 07:04 estebanlm

Esteban we should really at least remove the change I did because it breaks the flow of people. double click should select the full symbol

I checked in P10 and P11 clicking on foo in #foo select foo

in P12 it select #foo

S

Ducasse avatar Apr 06 '24 09:04 Ducasse

hm. Is it easy to disable it? or how easy would be to fix it? (trying to see what we should do for release, heh)

estebanlm avatar Apr 08 '24 07:04 estebanlm

From the Pharo meeting: The change on the symbol selection will be reverted for P12 (Impacted method: RubTextEditor >> #selectWord). And we can try to improve it for P13 if we find a way to know if shift is pressed.

jecisc avatar Apr 09 '24 09:04 jecisc

From the Pharo meeting: The change on the symbol selection will be reverted for P12 (Impacted method: RubTextEditor >> #selectWord). And we can try to improve it for P13 if we find a way to know if shift is pressed.

The changes to be reverted are in this commit: https://github.com/pharo-project/pharo/pull/14160/files

GitHub
For issue #14056. Change in RubTextEditor scan characters behavior (selectWord method ) to include the Character numeral (#) on double click selection on symbols. Add test.

hernanmd avatar Apr 11 '24 08:04 hernanmd

Pharo12 has the revert, adding the cmd-click is for Pharo 13 (I remove the "to fix before release" tag)

MarcusDenker avatar Apr 16 '24 14:04 MarcusDenker