t-rex 2.1 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/t-rex +10 -6
  3. metadata +7 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e26ed814ef64c7de43f05514e3a9fad738f94b43279d134e021539ed2dc4a996
4
- data.tar.gz: 11f7f34f9ec6822c8520f9a9ea8b422cecf7518172fc9c02a3ec1dce8a745c24
3
+ metadata.gz: 8bb66e44a6d6ca2542d5b57317928a405cd354ec66907a7d2cec7b54364b50cf
4
+ data.tar.gz: 2caa942557bd74fdd067fb1e59f771aac855fea587ffa0ad10633a9d09aaffa5
5
5
  SHA512:
6
- metadata.gz: 54dde9c96ddb5b10b324d0c3bb2b459960a7e395550d2f1a04a0774cba06da7e404df495bd5392555c588f3aaaaf25f23a4337a9d0eeb6aa3dcebb1bc2adb98b
7
- data.tar.gz: 23cc5bad45026e181f5d95990d10bf308f029cbfec9c01fed87f95dca277dba785560d3828f5af77e7173427a6783f3547de6d6f28797925c24f3f1ab2301ccd
6
+ metadata.gz: 32f4dcebc2cac923aee7bc0d9bd21dc0f84b8ad89d37684dec77af21d452e0b06692d474eef590de553410cd69d82a5bba41de400beb9b107d8846d9e84db941
7
+ data.tar.gz: d39f5b2dfc0852179038b8a27cf7fad12942bc19c60bbecae52babd8a8b30a7f65b50e57b9c111da9841d74dd8f9241fab11bc091c992ebfe6e5e93114e39611
data/bin/t-rex CHANGED
@@ -12,7 +12,7 @@
12
12
  # for any damages resulting from its use. Further, I am under no
13
13
  # obligation to maintain or extend this software. It is provided
14
14
  # on an 'as is' basis without any expressed or implied warranty.
15
- @version = "2.0" # Full rewrite with rcurses, face lift, new functionality, bug fixes
15
+ @version = "2.2.1" # Clear screen upon exit
16
16
 
17
17
  require 'rcurses'
18
18
  include Rcurses::Input
@@ -29,7 +29,8 @@ help = <<HELPTEXT
29
29
  Toggle US and European number formats by pressing '.
30
30
 
31
31
  When entering a number into X, use 'h' to change the sign and 'e' to write an
32
- exponent (10^x). Entering "123e4" becomes "1230000".
32
+ exponent (10^x). Entering "123e4" becomes "1230000". Use 'H' to enter a minus sign
33
+ after an 'e' to get a negative exponent. Entering "123e-4" becomes "0.0123".
33
34
 
34
35
  Functions available are shown under the stack registers. The orange symbol
35
36
  corresponds to the key to be pressed. For functions above each label (grey
@@ -612,6 +613,7 @@ def main_getkey(c) # GET KEY FROM USER
612
613
  getchr
613
614
  @hlp ? help : @p_hlp.puts("")
614
615
  when 'Q' # QUIT
616
+ Rcurses.clear_screen
615
617
  exit 0
616
618
  when /[0-9.,]/ # Go to entry mode for x
617
619
  @stk.lift
@@ -635,7 +637,7 @@ def entry(chr) # X REGISTER ENTRY
635
637
  pos = 1
636
638
  Rcurses::Cursor.set(7,33)
637
639
  Rcurses::Cursor.show
638
- while %w[0 1 2 3 4 5 6 7 8 9 . , h e RIGHT LEFT HOME END DEL BACK WBACK LDEL].include?(chr)
640
+ while %w[0 1 2 3 4 5 6 7 8 9 . , h H e RIGHT LEFT HOME END DEL BACK WBACK LDEL].include?(chr)
639
641
  @p_x.puts(num)
640
642
  chr = getchr
641
643
  case chr
@@ -679,6 +681,9 @@ def entry(chr) # X REGISTER ENTRY
679
681
  num.insert(0, "-")
680
682
  pos += 1
681
683
  end
684
+ when 'H'
685
+ num.insert(pos,"-")
686
+ pos += 1
682
687
  when 'e'
683
688
  num.insert(pos,chr)
684
689
  pos += 1
@@ -691,9 +696,8 @@ def entry(chr) # X REGISTER ENTRY
691
696
  num = "" if %w[DOWN UP].include?(chr)
692
697
  num.gsub!(/,/, '.')
693
698
  if num.include?("e")
694
- n = num.split("e").first(2)
695
- n[1] = (10 ** n[1].to_i)
696
- num = n.join
699
+ base, exp_str = num.split("e")
700
+ num = (base.to_f * (10 ** exp_str.to_i)).to_s
697
701
  end
698
702
  num != "" ? number = num.to_f : number = ""
699
703
  Rcurses::Cursor.hide
metadata CHANGED
@@ -1,33 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: t-rex
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.1'
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-27 00:00:00.000000000 Z
11
+ date: 2025-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rcurses
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.4'
19
+ version: '2.9'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.4'
26
+ version: '2.9'
27
27
  description: 'This is a terminal curses RPN calculator similar to the traditional
28
28
  calculators from Hewlett Packard. See https://www.hpmuseum.org/rpn.htm for info
29
- on RPN (Reverse Polish Notation). New in 2.1: Added ''e'' for entering exponents
30
- directly into X.'
29
+ on RPN (Reverse Polish Notation). New in 2.2.1: Clear screen upon exit.'
31
30
  email: g@isene.com
32
31
  executables:
33
32
  - t-rex