[eeschema] Inconsistent reference field parsing during edit and copy

Bug #1748789 reported by Robert Baruch
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Low
Unassigned

Bug Description

Application: kicad
Version: (2018-02-10 revision a04965c36)-makepkg, release build
Libraries:
    wxWidgets 3.0.3
    libcurl/7.54.1 OpenSSL/1.0.2l zlib/1.2.11 libssh2/1.8.0 nghttp2/1.23.1 librtmp/2.3
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
    wxWidgets: 3.0.3 (wchar_t,wx containers,compatible with 2.8)
    Boost: 1.60.0
    Curl: 7.54.1
    Compiler: GCC 7.1.0 with C++ ABI 1011

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_SPICE=ON

To reproduce:

1. In Eeschema, place a component (for example, a resistor).
2. Change its reference to R1.1 (hotkey: U).
3. Copy the component (hotkey: C).
4. Note that its reference is now (correctly) R1.?
5. Edit the copied component's reference (hotkey: U).
6. Note that the selection is (correctly) automatically on the "?" part of the reference.
7. Edit the original component's reference (hotkey: U).
8. Note that the selection is (inconsistently, incorrectly) on the "1.1" part of the reference.

What is expected:

In step 8, the selection should only be on the last 1.

What actually happens:

In step 8, the selection is on 1.1.

Comments

Copy seems to parse the reference such that the prefix is treated as everything up to and including the last non-numeric character. This was a pleasant surprise after the behaviour of KiCAD 4, and should be kept. However, edit seems to parse the reference differently such that the prefix is treated as everything up to but not including the first non-numeric character. These are inconsistent. I would like to have the prefix for both operations being everything up to and including the last non-numeric character.

tags: added: starter
Jeff Young (jeyjey)
Changed in kicad:
importance: Undecided → Low
status: New → Triaged
Changed in kicad:
status: Triaged → In Progress
Revision history for this message
Ashutosh Gangwar (ashutoshgngwr) wrote :

Text selection now defaults to last numeric value in reference field.

Jeff Young (jeyjey)
Changed in kicad:
milestone: none → 5.1.0
Revision history for this message
Seth Hillbrand (sethh) wrote :

@Ashutosh-

Thank you for the patch. I'm not comfortable with removing the sanity checks for whether m_text is correctly formatted. This introduces a segfault when the reference value for a symbol contains only numbers. While this is not correct formatting, we allow opening of the file, we shouldn't crash when editing.

Revision history for this message
Seth Hillbrand (sethh) wrote :

Looks like this is fixed except for GTK3 at the moment. GTK3 happily selects everything regardless of the SetSelection calls.

Changed in kicad:
status: In Progress → Triaged
Revision history for this message
Seth Hillbrand (sethh) wrote :

We can't help GTK3 here. Will need to wait for wxWidgets 3.2.

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

Other bug subscribers

Remote bug watches

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