Bad input logic in Spacing between lines combo box

Bug #966979 reported by Yevgeny Lezhnin on 2012-03-28
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Yevgeny Lezhnin

Bug Description

There are 2 combo box for setting text spacing between lines: one in toolbox and one in the Text and Font dialog.
The one in toolbox works fine, but it ignores '%' symbol.
The one in the dialog has a problem: then trying to set a real number text, text spacing becomes normal, but combo box contents becomes a garbage. For example: if I set 1.5 spacing, combo box contents becomes "4%".

Changed in inkscape:
assignee: nobody → Yevgeny Lezhnin (z-lezhnin)
Changed in inkscape:
status: New → In Progress
Yevgeny Lezhnin (z-lezhnin) wrote :

I replace text, then there is no '%' symbol to "{number*100}%"

Changed in inkscape:
status: In Progress → Fix Committed
su_v (suv-lp) wrote :

Reverting bug status to 'In Progress': 'Fix committed' in the bug tracker refers to changes actually committed to current trunk (or the stable branch), not to patches attached to bug reports.

See also

Changed in inkscape:
status: Fix Committed → In Progress
Changed in inkscape:
status: In Progress → New
jazzynico (jazzynico) wrote :

Thanks for your patch, Yevgeny.

Tested on Windows XP, Inkscape revision 11141.
Works almost as expected. Two issues regarding the T&F dialog:
1. Rounding errors (2.1 gives 209%).
2. The box doesn't convert the point decimal mark to a localized decimal separator. If the local separator is a coma and I use a point, the right part is not taken into account (1.96 gives 100%).

Maybe point 2 is out of the scope of your patch, but since the toolbox entries correctly convert to localized values, it would be great to have it here too.

Changed in inkscape:
importance: Undecided → Low
milestone: none → 0.49
status: New → In Progress
Yevgeny Lezhnin (z-lezhnin) wrote :

I make some universal solution for second issue using strtod() function, also I use floor() function to fix rounding errors. Maybe it is better to use some round function, but I don't know is there any crossplatform variant. Also I folowed Tav advice about c++ strings, now I use c++ string's find() function.

jazzynico (jazzynico) wrote :

The rounding fix looks good.

As for the localization issue, I'd rather fix it by reusing a widget that supports it, instead of adding specific code here. UI::Widget::Scalar and UI::Widget::ScalarUnit may be good candidates (usage example in ui/dialog/transformation.cpp).

su_v (suv-lp) on 2014-11-06
Changed in inkscape:
milestone: 0.91 → 0.92
jazzynico (jazzynico) on 2017-01-09
Changed in inkscape:
milestone: 0.92 → 0.93
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers