Git Product home page Git Product logo

kalc's People

Contributors

aztro-dev avatar bgkillas avatar lowlevelloser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

kalc's Issues

Parenthesis not working as expected

I was using the choose function today when I got an unreachable error, with math I could do by hand.

image

I was wondering if there was a fix for this, or what I could do to help fix this.

AUR build failure

error[E0658]: use of unstable library feature 'is_terminal'
  --> src/main.rs:12:35
   |
12 | use std::io::{BufRead, BufReader, IsTerminal, stdout, Write};
   |                                   ^^^^^^^^^^
   |
   = note: see issue #98070 <https://github.com/rust-lang/rust/issues/98070> for more information

error[E0658]: use of unstable library feature 'is_terminal'
   --> src/main.rs:214:17
    |
214 |     if !stdin().is_terminal()
    |                 ^^^^^^^^^^^
    |
    = note: see issue #98070 <https://github.com/rust-lang/rust/issues/98070> for more information

For more information about this error, try `rustc --explain E0658`.
error: could not compile `kalc` due to 2 previous errors
==> ERROR: A failure occurred in build().

Seems like the use of is_terminal is unstable and as such it does not build anymore when is_terminal() started getting used

0.01 is 1e-2, not 1e-3

.01
1/100
1e-3

Also, if I type 1e-2 kalc gives me back 1e-3:

1e-2
1/100
1e-3

In both cases kalc should give me back 1e-2

[Improvement] Make it more clear that you are at an input field

Currently, when you launch kalc, you get a blinking cursor waiting for input. I think that this is unintuitive since it is hard to know if the program has started and is working, rather than being hung.

I suggest then when waiting for input, there is a symbol like > that suggests that the program is waiting for an input.

Upon startup, I think there should be some banner or something similar to Python so that it is clear that the program has started. This also makes the cli more in line with other clis with a repl and the cli will feel more "complete".

~ ❯ python3                                                                                          18:24:47 took 6s 
Python 3.11.3 (main, Apr  5 2023, 15:52:25) [GCC 12.2.1 20230201] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

Another example (albeit a lot longer):

~ ❯ gdb                                                                                                      18:28:31 
GNU gdb (GDB) 13.1
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb)

I would do a PR for it, but I don't know what message you would upon startup and what character(s) you'd want to use for the prompt.

Crash when trying to delete with cursor at the end of the line

When some text is in the input line and the cursor is at the end of the text, after pressing 'delete' the program crashes.

Steps to reproduce:

  1. Start kalc
  2. Enter some text or numbers
  3. Press 'delete'

Result:

>>> kalc
> asdfthread 'main' panicked at kalc-1.1.0/src/main.rs:885:35:
removal index (is 4) should be < len (is 4)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
zsh: IOT instruction (core dumped)  kalc

Implement readline functionality for line editing

Great work on the kalc terminal calculator application. I am thoroughly enjoying it.

However, one dampener on the user experience is that there is no support for readline motions on the command line. This makes it really tedious to edit and move around to edit the expression to be calculated. Nearly every reasonable CLI program has a readline-like feature (it is almost a given), and I hope that kalc also implements this feature soon.

Once again, congrats on making this impressive and useful application.

pressing 'enter' causes a panic

Steps to reproduce:

  1. start kalc
  2. press the 'enter' key

$ kalc

thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 1', src/parse.rs:23:12
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

10e6 / 60e3

10e6 / 60e3
500000000/3
1.66666666667e8

It should be:

10000000 / 60000
500/3
1.66666666667e2

addition does not work

I'm getting some weird results when adding 2 numbers together.

47 + 42
1.974e3

47 + 42 + 5.51
543837/50
1.087674e4

$ cat -p ~/.config/kalc.config
sci=true
deg or grad or rad
base=10
tau=false
polar=false
frac=true
rt=false
deci=12
color=true
prompt=true
comma=false
prec=512
frac_iter=50
xr=-10,10
yr=-10,10
zr=-10,10
2d=20000
3d=400
point=.
line=false
multi=false
tabbed=false
vars=true
debug=false
small_e=true

Panic in MSYS

I tried to run this in MSYS and it panicked with

thread 'main' panicked at 'called 'Result::unwrap()' on an 'Err' value: Os { code: 1, kind: Uncategorized, message: "Função incorreta." }', src/main.rs:692:31

macOS support

It would be awesome to have kalc on macOS! I can help with testing on Apple silicon versions (and older Intel versions if neccessary).

When setting variable a second time, the previous variable set is multiplied

Whenever you set a variable a second time, it seems like the program is trying to execute a multiply operation on the previous set value.

~ ➜ kalc                                                                                                     08:23:45 
> 2*8
16
> x=2
> 16*x
32
> x=4
8 <-- preview result, goes away when I press enter
> x=6
24 <-- preview result, goes away when I press enter

If you press enter after x=4, the "8" preview disappears so I don't think this is what is expected. It seems like it is executing 2*4 or whatever I put for the line x=4.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.