Duplicate (symbol) hotkey not working

Bug #1835083 reported by Art
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Committed
Medium
jean-pierre charras

Bug Description

Previously the workflow for the duplicating a symbol was to place the cursor over the symbol, press keyboard shortcut to duplicate it and then move the symbol's copy to the desired location. Now the symbol needs to be highlighted first, which not only creates many unnecessary mouse clicks but also is not consistent with functionality of other similar tools (i.e. Move, Drag etc) where no previous highlighting of the symbol is required.

Application: KiCad
Version: (5.1.0-1148-g42e14b5a4), release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.61.1 OpenSSL/1.1.1 (WinSSL) zlib/1.2.11 brotli/1.0.6 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) nghttp2/1.34.0
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
    Boost: 1.68.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.61.1
    Compiler: GCC 8.2.0 with C++ ABI 1013

Build settings:
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Revision history for this message
Jeff Young (jeyjey) wrote :

Duplicate will duplicate the selection. However, if there's no selection, then it works like it used (duplicates the symbol under the cursor). Is this not working for you? (It works for me on OSX.)

Revision history for this message
Jeff Young (jeyjey) wrote :

^used^used to^

tags: added: eeschema
Revision history for this message
jean-pierre charras (jp-charras) wrote :

On Windows (W7 32 bits), duplicate (CTRL+D) does not work if the item is not previously selected.

Changed in kicad:
status: New → Confirmed
Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

This should work in hover (immediate) mode.

Changed in kicad:
importance: Undecided → Medium
milestone: none → 6.0.0-rc1
Revision history for this message
Jeff Young (jeyjey) wrote :

The first thing SCH_EDITOR_CONTROL::Duplicate() does is call RequestSelection() (which should return an existing selection or do a SelectPoint() if there is no selection. That's probably what's failing.

The next thing is it checks to see if the returned object (either the previously-existing selection or the new selection) has its IS_NEW flag set (indicating it hasn't been added to the schematic yet). It's also possible that's failing for some reason, but it's harder to see how that would be platform-specific.

Can someone with a MSW box put a breakpoint in Duplicate() and trace down into RequestSelection() to see what's going wrong? Thanks.

Revision history for this message
Jeff Young (jeyjey) wrote :

Ping.

Revision history for this message
jean-pierre charras (jp-charras) wrote :

Hi Jeff,

I made some tests:
The answer is: SCH_EDIT_TOOL::Duplicate() is not called.
(I am guessing it is SCH_EDIT_TOOL::Duplicate, not SCH_EDITOR_CONTROL::Duplicate that does not exist.)

2 other commands do not work in immediate move: Cut and Copy (to the clipboard).

I also noticed the 3 commands not working in immediate mode are ACTIONS, not EE_ACTIONS.

Revision history for this message
Jeff Young (jeyjey) wrote :

Sorry, yes, it's SCH_EDIT_TOOL.

I wonder if another tool is somehow stealing the event? Could you put breakpoints in:

1) sch_move_tool.cpp:360
            else if( evt->IsAction( &ACTIONS::duplicate ) )

2) lib_move_tool.cpp:222
            else if( evt->IsAction( &ACTIONS::duplicate ) )

3) inside LIB_EDIT_TOOL::Duplicate()

and see if any of them fire? (I suppose if Cut/Copy don't work either then only (3) would have a corollary for them.)

I suppose we could also check that EE_SELECTION_TOOL isn't eating it. A breakpoint at ee_selection_tool.cpp:414 (PassEvent()) /should/ fire.

Revision history for this message
jean-pierre charras (jp-charras) wrote :

None of them are fired.

Revision history for this message
Jeff Young (jeyjey) wrote :

Well, that's annoying because it gets more difficult now.

In TOOL_MANAGER::dispatchInternal() the first loop goes through currently-active tools to see if they want to handle the event. None of them should, so we should end up in the second loop, which looks for a transition.

That should find the Go() method that sends us to SCH_EDIT_TOOL::Duplicate(). One way it could fail would be if the transition table has been cleared but not set up again. I'm afraid I don't know much about this part; just that I ran into another bug where this was the issue.

When stepping through the second loop, when you get to the SCH_EDIT_TOOL, there should be about 19 transitions defined (corresponding to SCH_EDIT_TOOL::setTransitions()).

If we're not even getting to TOOL_MANAGER::dispatchInternal() then it's something in the hotkey processing.

Revision history for this message
Jeff Young (jeyjey) wrote :
Changed in kicad:
status: Confirmed → Fix Committed
assignee: nobody → jean-pierre charras (jp-charras)
Art (diametrix)
Changed in kicad:
status: Fix Committed → New
Revision history for this message
Art (diametrix) wrote :

It should be, but it's not.

If I hover a mouse pointer above the symbol and I use the keyboard shortcut to duplicate it - the symbol becomes highlighted and nothing else happens. If I right click on the symbol and then select "Duplicate" from the contextual menu, everything seems to work fine

Application: KiCad
Version: (5.1.0-1275-gdad8c9821), release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.61.1 OpenSSL/1.1.1 (WinSSL) zlib/1.2.11 brotli/1.0.6 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) nghttp2/1.34.0
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
    Boost: 1.68.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.61.1
    Compiler: GCC 8.2.0 with C++ ABI 1013

Build settings:
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Revision history for this message
jean-pierre charras (jp-charras) wrote :

I cannot recreate this issue (W7 32 bits)

Revision history for this message
Art (diametrix) wrote :

I'm not one of the them computery guys, so I might be wrong here, but can it be something to do with the fact that by default "Ctrl-D" was assigned to two functions: Duplicate in Common and "Show Datasheet" in Eeschema and nothing was assigned in Duplicate Symbol in Eeschema. That's a clean install without changing anything.

Revision history for this message
Jeff Young (jeyjey) wrote :

@Art, a clean install won't reset your hotkeys (most people wouldn't like that), so you aren't seeing a "clean" set of hotkey definitions. You could try going in to Preferences > Hotkeys and click the "Restore All to Defaults" button and see if that changes the duplicate behaviour any.

summary: - EEschema - copy symbol work flow is no longer consistent with other
- functions
+ Duplicate (symbol) hotkey not working
Revision history for this message
Art (diametrix) wrote :

@Jeff
That resolved the problem, however it revealed an installation algorithm problem. I never customized any of the keys (always had default ones) and Ctrl-D was listed as a key combination for Duplicate. So something got stuck sideways.

Revision history for this message
Jeff Young (jeyjey) wrote :

@Art, yes, that's a result of us changing some key definitions between 5.1 and 6.0. We should probably only load the 5.1 definitions if they're different than the 5.1 defaults.

Changed in kicad:
status: New → Fix Committed
tags: added: hotkeys
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.