Bugs item #1560892, was opened at 2006-09-18 13:07
Message generated for change (Comment added) made by rrpollack
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=111005&aid=1560892&group_id=11005

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Tony Balinski (ajbj)
Assigned to: Nobody/Anonymous (nobody)
Summary: wrong value for inactive $em_tab_dist

Initial Comment:
The help information says:

===
  $em_tab_dist
  If tab emulation is turned on in the Tabs... dialog
of the Preferences menu, value is the distance between
emulated tab stops. If tab emulation is turned off,
value is -1.
===

This "turned off" value is very badly chosen.
Internally, the "turned off" value is 0, and if you
give a value of zero to set_em_tab_dist(), you "turn
off" emulated tab stops. So why jump through hoops to
make the "turned off" value -1? It also makes macro
programming clumsy, forcing comparisons against -1, eg

  if (0 >= $em_tab_dist)

rather than allowing the more succinct boolean
equivalence of integers, eg

  if (!$em_tab_dist)

(One may or may not like this coding style, but forcing
someone into a situation where he can't use it is
pedantic bigotry).

I propose this "turned off" value should be changed to
zero. Since zero is not a valid tab distance, the
intention is clear. (This is not the case with things
like search(), where zero is a valid return result, so
a value like -1 for a failure condition becomes necessary.)

I don't know how many people out there use $em_tab_disp
in their macros, but I think this change should have
little impact.

Unless there is a valid objection, I think this
particular "feature" should be changed. In general, if
zero can be used as a "Failed", "False" or "Inactive"
value, it should be (as is the case for rangeset ids
and rangeset range indices).

cf the thread where I raised this issue:
http://www.nedit.org/pipermail/develop/2006-September/012299.html

----------------------------------------------------------------------

Comment By: Reece Pollack (rrpollack)
Date: 2011-04-20 18:48

Message:
This commit broke Smart Indent for the 'C' language, and probably others.
See tracker #3290514.

Using -1 to mean "turned off" is no more "wrong" than using 0. Changing
something like this for aesthetic reasons rather than to correct a bug is
usually a bad idea, as it tends to break things that didn't need to be
broken.

----------------------------------------------------------------------

Comment By: Tony Balinski (ajbj)
Date: 2007-10-04 12:04

Message:
Logged In: YES 
user_id=618141
Originator: YES

Committed this (finally).

----------------------------------------------------------------------

Comment By: Tony Balinski (ajbj)
Date: 2007-03-01 19:45

Message:
Logged In: YES 
user_id=618141
Originator: YES

If no one objects, I'll make this change.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=111005&aid=1560892&group_id=11005
-- 
NEdit Develop mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/develop

Reply via email to