Introduction
NoteCalc is a useful little calculator that combines text notes and the calculations within them, thus providing context to the numbers.
This guide walks you through its usage and showcases its features, or you can jump straight to the homepage to start using it immediately.
On the left side, there is a text editor where you can freely edit your notes. On the right side, the results of each line appear.
The small separator gutter found between them can be moved with the mouse.
On the Home page, text is automatically saved in your local browser, nothing is sent to the server.
Some examples. Feel free to change them and play around, changes are automatically reflected in the result pane.
12 dollar bed * 3 beds people = 3 price is people * {1} # Variables Bank of America = $50 000/year + 5.25% Citibank = $50 000/year + 6% the difference in 3 years is (Citibank - Bank of America) * 3years a = -9.8m/s^2 v0 = 100 m/s x0 = 490 m t = 1 s x = 1/2*a*t^2 + v0*t + x0
Headers
Headers appear in an emphasized font style in both panels of the editor, thus they can be used to visually distinguish them from the rest of the document and organize content into a single paragraph.
Headers can be created by placing the '#' character at the beginning of a line.
# Banking Costs Bank of America = $50 000/year + 5.25% Citibank = $50 000/year + 6% the difference in 3 years is (Citibank - Bank of America) * 3years # Math lesson a = -9.8m/s^2 v0 = 100 m/s x0 = 490 m t = 1 s x = 1/2*a*t^2 + v0*t + x0
The line of a header is not evaluated; calculations cannot be performed within it.
The /sum
attribute can be placed in the header, which changes its value and displays the total value of the lines found beneath the header.
#Budget /sum food $500 mortgage $2000 bills $1500
As can be seen, in this case, the text found in the header does not appear at all (this is to ensure that the summarized value aligns nicely with the results below it, enhancing readability).
This can currently be compensated for by writing an additional header above it with the desired title text, e.g.
#Budget #Budget /sum food $500 mortgage $2000 bills $1500
Comments
Every text that follows the //
characters will be commented out, their content will not be evaluated.
Additionally, individual items can be excluded from the expression by placing a '
character in front of them.
# Math lesson a = -9.8m/s^2 v0 = 100 m/s x0 = 490 m t = 1 s x = 1/2*a*t^2 + // v0*t + x0 v1 = 150 m/s // Notice that below, v0 is ignored x = 1/2*a*t^2 +'v0 v1*t + x0
Variables
Declaring a variable
A variable is a named value that you can refer to in your calculations.
You can create a variable by specifying the variable's name followed by an =
sign, and then the value of the variable can follow after the equals sign.
Variable names can contain spaces.
people = 3 price per day = $26 days = 4 cost is people * price per day * days
As can be seen, standing with the cursor in the fourth line, the individual variables have been underlined with different colors, and the color corresponding to each variable appeared on the left side of the lines they have been defined at.
These colors help to identify and find where the variables used in an expression are defined.
It works the other way around too: by placing the cursor on a line of a variable declaration (e.g., the second line),
that particular variable starts to flash in every expression where it is used, thereby helping the reader to see where exactly a variable is used in a note.
In this short document, of course, it's not a big help, but it is mostly useful in more complex notes.
By pressing CTRL B while standing on a variable with the cursor, you can jump to its declaration line.
Reassigning variables
New values can be freely reassigned to variables, in the following expressions, the last assigned value will be used.
# 2022 people = 3 price per day = $26 days = 4 cost is people * price per day * days # 2024 In '2024 Jane and Robert joined to the vacation people = people + 2 cost is people * price per day * days
Value of subexpressions
If you are curious about the value of a subexpression within a more complex expression, simply select the particular subexpression with the mouse or keyboard SHIFT+cursor.
If the selected subexpression is valid, its value will appear above the selection.
Total value of selected lines
If you are interested in the sum of only a selected few lines from several, simply highlight them and similarly, their summed value will appear.
Select only the '(2 + 3) part 1 + 2 + 3 + 4 + 5 Now select the lines that contain '2 and '3 1 2 3 4 5
Inserting a variable with line selection
Instead of typing the name of the variable you want to reference, you can navigate to the line of the variable declaration holding down ALT, then pressing up/down arrows.
Upon releasing the ALT key, the name of the variable will be automatically inserted.
Insurance price A = $250/year Insurance price B = $300/year Insurance price C = $375/year It will cost 3year *
With the cursor positioned behind the 3year *
expression in the fourth line, press the ALT ↑ arrow and keep the ALT key down.
Then, using the ↑/↓ arrows, select the price that you prefer, and once you have made your selection, release the ALT key.
Implicit sum
variable
A variable named sum
is implicitly defined for you, and within each header, it automatically contains the total of the lines from the header to the use of the sum
variable, provided the results of the lines are addable.
# Trip 2021 accomodation $20 gas $35 food $16 sum # Trip 2023 accomodation $40 gas $75 food $100 sum
The value of sum
can be reset.
For Jane accomodation $20 gas $35 food $16 sum sum = $0 // Reset sum For Jack accomodation $20 gas $35 food $16 sum
Autocompletion
price per day = $16/day price per week = price per day * 7days price per year = price per day * 365days
Autocompletion means that by pressing CTRL Space on a piece of text, a list of variable names starting with that text will appear, from which we can select the desired variable name with the help of arrows and the enter key, and it will be automatically inserted.
For example, type price
in line 4 then press CTRL Space.
Autocompletion as qualitty of life tool
Invoking autocompletion without the cursor standing on a prefix string we can see that the menu lists not only possible variables but also constants constants (π), hard-to-type things like vector/matrix creation (see later), or easily forgettable operators such as the percentage calculation operators (I can never remember them).
Line references
Just as with a variable, if you go back and modify the value of the variable, every expression in which the variable appears will automatically update with the new value.
A similar effect is achieved with line references but without using variables.
Simply reference a line, and the result of that line will be inserted at the cursor's position.
From that point on, any modification to the referenced line will be reflected in the lines that contain it.
You can reference a line using the already familiar ALT ↑ or ALT ↓ buttons, with the difference being that if the selected line does not contain a variable declaration, then the line itself will be referenced.
$16/day {1} * 7days {1} * 365days
The background of the inserted line references is blue, and they contain the result of the referenced line.
Similarly to variables, line references are also marked with colors to help indicate where they are used, or which line they refer to.
In the note above, both the second and third lines contain a reference to the first line. Try modifying the first line and observe how the second and third lines change accordingly.
Additionally, try referencing lines yourself using the ALT ↑↓ buttons, as you have already learned with variables.
Similarly to jumping to variables, by pressing CTRL B while standing on a reference, you can jump to the referenced line.
Actions with selections
As we saw earlier, CTRL Space can be used to invoke autocompletion, but if multiple entire lines are selected while pressing it, then other functionalities appear in the popup list.
Alignment to '='
# 2022 people = 3 price per day = $26 days = 4 cost is people * price per day * days
Select the 2nd, 3rd, and 4th lines, and press Ctrl space. From the popping-up options, choose Align to =
.
This aligns the equal signs under each other in the selected lines, thereby increasing readability.
The result should look like this:
# 2022
people = 3
price per day = $26
days = 4
cost is people * price per day * days
Copy as plain text
As discussed in the copy section, copying selected text with CTRL C places a format on the clipboard that is designed to be inserted into a NoteCalc note,
not for sharing the note in a readable form (as a traditional editor would behave in this situation).
Therefore, if you need the latter, select the lines you wish to copy and after pressing CTRL Space, choose the Copy as plain text
option.
Copying with simple CTRL C would result in the following:
{[#2,d]} people = 3
{[#3,d]} price per day = $26
{[#4,d]} days = 4
While using Copy as plain text
, results in:
people = 3
price per day = $26
days = 4
Conditional expressions
The result of a conditional expression can be one value or another, depending on a condition.
gross revenue = $10k tax = if gross revenue > $5k then 10% else 5% net income = gross revenue - tax
A conditional expression can also appear as an operand; in this case, it should be placed in parentheses.
gross revenue = $10k net income = gross revenue - (if gross revenue > $5k then 10% else 5%)
Vectors
There is the possibility to represent vectors or matrices and perform operations on them. A vector is described by separating its elements with commas and enclosing them in brackets.
pos = [1, 2, 3] dir = [3, 2, 1] new pos = pos + dir
To edit a vector, you need to navigate into it with the cursor, and then each element can be edited individually.
Upon leaving the vector, its elements are automatically saved, and its representation reverts back to vector form.
During editing, it's also possible to add elements simply by writing the new element's value into one of the boxes, separated by a comma.
Matrix
Matrices are essentially lists containing vectors, separated by semicolons.
So, for example, the matrix below is defined with the following string idetnity = [1, 0, 0; 0, 1, 0; 0, 0, 1]
identity = [1, 0, 0; 0, 1, 0; 0, 0, 1] dir = [3, 2, 1] same dir = dir * identity
The elements of vectors/matrices are evaluated in the same way as any other line in the note, meaning they can contain variables, line references, values with units, more complex expressions, etc.
daily rate = [$90, $100, $120] annual gross = (daily rate * 20) * 12 tax free = $10k tax base = annual gross - tax free tax = tax base * 40% net = annual gross - tax monthly net = net / 12 current monthly salary = $1000 # Comparison daily rate monthly net monthly net is what % on current monthly salary
Shortcuts
When standing with the cursor in a matrix, we can easily change the dimensions of the matrix with the CTRL ALT →, CTRL ALT ←, CTRL ALT ↑ or CTRL ALT ↓ buttons.
Usually, when creating a matrix, I simply type a [
character, which automatically places the cursor into the editing mode of a 1x1 matrix, and from there, I just adjust the size with the aforementioned buttons, and then edit the individual elements.
Another method is using autocompletion: type a v
or m
letter and press CTRL Space; different size matrices names will appear in the popup panel, and by pressing enter, they will be inserted.
Functions
User-defined functions
For performing repetitive calculations, functions can be defined. A function definition:
- starts right at the beginning of the line,
- its name can contain spaces,
- followed by the parameters listed in parentheses, separated by commas,
- then a closing parenthesis is followed by a
:
, - the body of the function starts with at least one space from the beginning of the line.
A function can be called by its name, followed by listing the parameters in parentheses, separated by commas.
The function name and its body appear with a gray background.
vacation cost(people count, accomodation per day): tax = if people count <= 3 then 0% else 10% (people count * accomodation per day) + tax vacation cost(3, $30) vacation cost(6, $25) vacation cost(9, $20)
Builtin Functions
pi()
e()
abs(num)
ln(num)
lg(num)
log(num, num)
ceil(num)
floor(num)
round(num)
round_dp(num, decimal places)
sin(angle) -> num
cos(angle) -> num
tan(angle) -> num
asin(num) -> angle
acos(num) -> angle
atan(num) -> angle
nth(Matrix, index)
transpose(Matrix)
sum(Matrix)
sum([1, 2, 3]) transpose([1, 2, 3]) * [1, 2, 3] pi() e() abs(-3) ln(2) lg(2) log(2, 10) ceil(12.3) floor(12.3) round(12.51) round_dp(12.549, 2) sin(90degree) cos(90degree) nth([1, 2, 3], 2)
Numbers
Numbers can be specified in decimal, hexadecimal(0x
), binary(0b
), and scientific notation forms.
4e12 3.14e-2 0xc0e0_0000 0b1111 0000 1111 0000
Spaces can be freely inserted between the digits, thereby increasing readability.
The k
suffix can be used to express multiples of 1000, and M
for millions.
1 000 000 or 1M $253k
Decimal places
The number of decimal places can be increased by pressing CTRL ALT →, and decreased with the CTRL ALT ← key.
It's important to note, however, that NoteCalc trims off decimal places with a value of 0 from the end of numbers.
G = 6.67384e-11 m^3/kg/s^2 earth gravity = G*(5.972e24 kg)/(6 378 100 m)^2
Specifiers with 'as
'
50 km as number 0.2 as percent
Copying and Exporting
CTRL C without selection
By pressing CTRL C without any active selection, the result of the line where the cursor is located is copied to the clipboard.
CTRL C with selection
If text is selected, that text is copied to the clipboard.
Be careful, as this copies the raw content, so if, for example, the selection contains a line reference, it will copy the string describing the reference, not its value, to the clipboard.
$16/day {1} * 7days {1} * 365days
For example, by selecting the entire text above and copying it, this is what gets copied to the clipboard:
{[#1,d]} $16/day
{[#2,d]} {1} * 7days
{[#3,d]} {1} * 365days
The advantage of this is that you can save or send this to a friend, and then by pasting it back into NoteCalc, you will get the same result, with the line references pointing to the correct places in the new note as well.
WYSWYG export
If you only want to copy the final result, you can do this by clicking the print button located in the upper right corner, which copies the entire note to the clipboard in the format as you see it.
For example clicking on the print button on this page will copy the following text to the clipboard:
$16/day █ 16 $ / day
16 $ / day * 7days █ 112 $
16 $ / day * 365days █ 5 840 $
URL
Only on the Home page, the content of the note is automatically saved, compressed, and encoded into the URL. By copying this, you can share or save your work. When you paste the URL into your browser, you will see the same content again.
Working with binary numbers
Numbers can also be provided in binary and hexadecimal formats, using the 0x
and 0b
prefixes respectively.
input = 0xc0e0_0000 input = 0b1111 0000 1111
Results also can be displayed in hexadecimal and binary forms as well.
To switch between them, stand on the given line and press ALT ← or ALT →.
# Write your input here input = 0xc0e00000 // use ALT+(Left|Right) while // the cursor is on the above line // to change to hex or binary representation # interpreting input as... ## ...several unsigned data types input & 0xFF // u8 input & 0xFFFF // u16 input & 0xFFFFFFFF // u32 input & 0xFFFFFFFFFFFFFFFF // u64 ## ...file sizes / number of bytes input = input bytes input in kilobytes input in MB input in GB // ... *ibi-bytes input in KiB input in MiB input in GiB
Developers can use their loved operators as well
bit shifting 0b0001 << 4 (0b1100 & 0b0011) | 0x08 & ~1
Percentages
-
Finding a percentage of a number
200 * 5%
-
Adding/subtracting percentages from a base number
100 + 10% 200 - 20%
-
Asking for the percentage of 60 that 20 represents
20 is what % of 60
-
Searching for the base value from which 25% equals 5
5 is 25% of what
-
Looking for the original amount before an increase of 25% was added to make it 5
5 is 25% on what or in other forms: 25% on what is 5 what plus 25% is 5
-
Looking for the original amount before a decrease of 25% was subtracted to make it 5
5 is 25% off what or in other forms: what minus 25% is 5 25% off what is 5
-
Looking for the percentage increase or decrease
44 is what % on 40 24 is what % off 300
Autocompletion
You don't need to memorize these percentage expressions; generally,
if I need any percentage-related expression, I type a %
sign and invoke autocompletion with CTRL Space, which lists the operations.
Units & Conversions
You can convert from one unit of measurement to another using the in
operator.
3m in cm 1024kB in megabytes 3 years in months [1, 1000, 10000]cm in m 101325 kg/(m*s^2) 8.314 m^3*Pa/mol/K
Units
Base | Unit |
---|---|
Length | meter (m), inch (in), foot (ft), yard (yd), mile (mi), link (li), rod (rd), chain (ch), angstrom, mil |
Surface | area m2, sqin, sqft, sqyd, sqmi, sqrd, sqch, sqmil, acre, hectare |
Volume | m3, litre (l, L, lt, liter), cc, cuin, cuft, cuyd, teaspoon, tablespoon |
Liquid | volume minim, fluiddram (fldr), fluidounce (floz), gill (gi), cup (cp), pint (pt), quart (qt), gallon (gal), beerbarrel (bbl), oilbarrel (obl), hogshead, drop (gtt) |
Angles | rad (radian), deg (degree), grad (gradian), cycle, arcsec (arcsecond), arcmin (arcminute) |
Time | second (s, secs, seconds), minute (min, mins, minutes), hour (h, hr, hrs, hours), day (days), week (weeks), month (months), year (years), decade (decades), century (centuries), millennium (millennia) |
Frequency | hertz (Hz) |
Mass | gram(g), tonne, ton, grain (gr), dram (dr), ounce (oz), poundmass (lbm, lb, lbs), hundredweight (cwt), stick, stone |
Electric | current ampere (A) |
Temperature | kelvin (K), celsius (degC), fahrenheit (degF), rankine (degR) |
Amount | of substance mole (mol) |
Luminous | intensity candela (cd) |
Force | newton (N), dyne (dyn), poundforce (lbf), kip |
Energy | joule (J), erg, Wh, BTU, electronvolt (eV) |
Power | watt (W), hp |
Pressure | Pa, psi, atm, torr, bar, mmHg, mmH2O, cmH2O |
Electricity | and magnetism ampere (A), coulomb (C), watt (W), volt (V), ohm, farad (F), weber (Wb), tesla (T), henry (H), siemens (S), electronvolt (eV) |
Binary | bits (b), bytes (B) |
Prefixes
Name | Abbreviation | Value |
---|---|---|
deca | da | 1e1 |
hecto | h | 1e2 |
kilo | k | 1e3 |
mega | M | 1e6 |
giga | G | 1e9 |
tera | T | 1e12 |
peta | P | 1e15 |
exa | E | 1e18 |
zetta | Z | 1e21 |
yotta | Y | 1e24 |
ronna | R | 1e27 |
quetta | Q | 1e30 |
Name | Abbreviation | Value |
---|---|---|
deci | d | 1e-1 |
centi | c | 1e-2 |
milli | m | 1e-3 |
micro | u | 1e-6 |
nano | n | 1e-9 |
pico | p | 1e-12 |
femto | f | 1e-15 |
atto | a | 1e-18 |
zepto | z | 1e-21 |
yocto | y | 1e-24 |
ronto | r | 1e-27 |
quecto | q | 1e-30 |
The following binary prefixes are available. They can be used with units bits (b) and bytes (B).
Name | Abbreviation | Value |
---|---|---|
kibi | Ki | 1024 |
mebi | Mi | 1024^2 |
gibi | Gi | 1024^3 |
tebi | Ti | 1024^4 |
pebi | Pi | 1024^5 |
exi | Ei | 1024^6 |
zebi | Zi | 1024^7 |
yobi | Yi | 1024^8 |
Name | Abbreviation | Value |
---|---|---|
kilo | k | 1e3 |
mega | M | 1e6 |
giga | G | 1e9 |
tera | T | 1e12 |
peta | P | 1e15 |
exa | E | 1e18 |
zetta | Z | 1e21 |
yotta | Y | 1e24 |
0.4.0 - 2024-03-07
Breaking Changes
- Empty matrices or matrices with invalid content are now considered as a valid matrix instead of plain text, so the matrix editor can be used on them
- Syntax of Line References has been changed to
{3}
instead of {&[3]
} (the previous syntax caused ambiguity during matrix parsing) This change should not affect users, since they use ALT+up/down to select and insert Line References - Matrix resizing now requires
alt+ctrl
keys instead of justalt
- Autocompletion (ctrl space instead of tabs).
- Regions (paragraphs under different #Headers) are now have the same alignments across all the document
sum
variable is not set to zero anymore at headers. You can do that explicitly by writingsum = 0
$
is now a prefix operator, so the expression12$
is now invalid and should be written as$12
Features
- #Headers appears in the Result area as well
- Name of the navigation tabs are now can be set: It gets the value of the first line if it is a
#Header
- Word selection by double click
- When it comes to binary operations, single row matrices now work as arrays, meaning that the operation is applied
to all of their elements.
[2 3 4] + 1 ---> [3 4 5]
Usecase
Let's say you want to compare job offers, so you make an array of offers (daily rate
).
You calculate what those offers mean as a monthly income, including taxes etc.
In theComparison
part you can see the summary of your calculations, what offer would end up in what monthly salary, and how they compare to your current salary.
Now if you got a new offer, it is enough just to add that offer to thedaily rate
array, and all the information (monthly profit after taxes and comparison to your current salary) will appear to this new offer.
All operators now work on Matrices when it makes sense.daily rate = [$90 $100 $120] █ [ 90 $ 100 $ 120 $] annual gross = (daily rate * 20) * 12 █ [21 600 $ 24 000 $ 28 800 $] tax free = $10k █ 10 000 $ tax base = annual gross - tax free █ [11 600 $ 14 000 $ 18 800 $] tax = tax base * 40% █ [ 4 640 $ 5 600 $ 7 520 $] net = annual gross - tax █ [16 960 $ 18 400 $ 21 280 $] monthly net = net / 12 █ [ 1 413 $ 1 533 $ 1 773 $] current monthly salary = $1000 █ 1 000 $ █ # Comparison █ daily rate █ [ 90 $ 100 $ 120 $] monthly net █ [1 413 $ 1 533 $ 1 773 $] monthly net is what % on current monthly salary █ [ 41 % 53 % 77 %]
- Percentage operators work on quantities now:
5m is 25% of what ==> 20 m
- Pasting back Exported text to the editor chops down the Result part
- User defined functions
- Pressing
ctrl-b
on a funtion invocation jumps to its definition (same as for Line References and variables)
- Pressing
- Indent and Unindent lines (tab/shift+tab)
- Better editor handling, which paves the road for multiple cursors
- Better handling of period of times in calculations
So far every quantity was stored in the base unit (e.g. 10 years was stored as 315 576 000 seconds).
It caused precision problems in expressions like(10k/year cost + 3k/month tax) * 10 years
,
resulting in a wrong output (459 999.9
instead of460 000
) &
,|
and~
can be used as bitwise operators- Smart output units e.g.: By default the result was in seconds for
500$ / 20$/hour
, now it is hours. - Only the changed digits are pulsed when a result had changed (it helps to identify changes in a number when the user explores different scenarios, or helps to compare binary results )
- Performance impr: Result calculation occurs only when the user stops typing for 150 ms
- If there is not enough space for the editor content + its results, the user is allowed to move the right gutter wherever she wants (if there is enough space, NoteCalc will automatically align it to show both the editor and result contents)
- Typing closing parenthesis works similar to IntelliJ, if a closing Parentheses is already there, it will be overwritten.
- Settings modal window
- Smart indentation when typing Enter (it preserves the actual line's indentation)
- It is now possible to insert Line References inside matrices, however its rendering is still not supported (so e.g.
{23}
will appear instead of the value of LineRef 23). - Function parameter hints
- If fractional decimals are missing due to low precision set by the user, trailing zeroes are not trimmed, which hopefully rings some bells to the user
- Added remainder operator (both
rem
andmod
work) - Line References can be copied and pasted
- Bool type (true, false)
- Conditional Expressions (
if <expr> then <expr> else <expr>
, e.g.(if true then 2 else 3) + (if false then 4 else 5)
== 7) - Comparison operators (
<
,>
,<=
,>=
,==
,!=
) - If multiple Assignments are selected, then pressing ctrl-space (autocompletion) brings up an action "Align", which aligns the lines on the '=' char
- Specifiers: 50km as number = 50, 0.2 as percent = 20%
- Headers
/sum
, show result, bold, sum etc Sum Headers create a variable implicitly - "Copy as plain text" action in autocompletion
- If a line result is copied (by pressing ctrl-c without having a selection), the copied result is flashing to highligh what was copied
Changed
- Beside
//
, the ` character behaves as a comment as well (explain that ' is used for ignoring single numbers, e.g. 12+3 '4, here the 4 is ignored) - Clicking on a result on the Result Panel does not insert a reference to the result any more (it was easy to misclick and as not that useful feature)
ctrl-b
(jumping to the definition line of the variable the cursor is standing on) now scrolls a little bit above the target line if it is out of the visible area
Fixed
- Thousand grouping was affected by the minus sign which resulted
in wrong grouping when having multiple results, e.g.:
fuel -40k █ -40 000 vacation -100k █ - 100 000 // there is an extra space after '-' clothing -10k █ -10 000
- Fix selecting complex expressions when stepped into matrix
When the user stepped into a matrix, the selected cell's content was determined by a primitive algorithm which did not take into account the AST, but naively parsed the string and looked for commas or semi colons for cell separators. Obviously this solution did not work when the cell content was a complex expressions with function calls etc inside. The new solution uses the AST to determine what is inside a matrix cell. - Clicking into the result area did nothing so far, now it put the cursos into the clicked line
- Bin or Hex representation of a float is now an Error
- Referenced matrices were not visible due to the reference-highlighting covered them
- Referenced matrices were rendered outside the editor
- Empty matrices (
[]
) inside parenthesis were not evaluated correctly - Added new rendering layers so rendered rectangles can be positioned better (e.g. where to put matrix editor background to not be hidden by cursor highlighter nor function bg color etc)
- Builtin variable
sum
was not parsed correctly if it was followed by some special chars - Saving the content into the #hash of the URL does not create browser history entries anymore (does not work under chrome)
- Units can be applied to function results (e.g.
sin(pi() rad)
now works) - Operator precedence were calculated wrongly when a quantity was involved in the expression (e.g.
2*3 + (4/g)*5g*6
was calculated as((2*3) + (4/g)*5g)*6
) - Line numbers were rendered even below the last physical line
- Variables did not require full name match (e.g. if variable
a
existed, the stringa_b
would have matched it) - If value of a LineRef was 'Err' (aka the result of a referenced line was 'Err'), it was rendered even when was covered by the result panel
- Changing the vlaue of a LineRef caused pulsing even when the LineRef was not visible due to the result panel
- Line Reference pulsing was not moved when scrolling
- Line reference pulsing command was duplicated in the RenderBucket when cursor movement occurred due to mouse clicking
- If Line Reference Selector (alt + up/down) went out of screen, it did not move the scrollbar
- Modifying a LineReference source result by pasting (ctrl-v), it did not refresh the line reference pulsings' attributes
- Already rendered scrollbar were not cleared when a a text was inserted which had enough vertical space
- LineReferences were rendered without vertical alignment
- Fix an error when unit conversion happens between the same units but in different representation (ml*m ==> m^4)
- Fraction numbers were not pulsed when changed
- Fix parsing expressions like '12 km is x% of...'
[0.3.0] - 2020-12-21
Breaking Changes
- Spaces are not allowed in hex numbers anymore but undorscores are. It caused problems since 0xAA B could not be unambiguously parsed (e.g. it can be 0xAAB or 0xAA B, where 'B' is a unit for 'bytes', so make it explicit by writing 0xAA_B).
Features
-
Dark Theme
-
Render command optimizations, reducing render command count by around 40% (gutters, line number- and result backround are now rendered only once as a big rectangle and not line by line).
-
Active references (variables and line refs in the cursor's row) are now just underlined and the referenced lines are not highlighted fully only their left and right gutter. (Look at the image below)
-
Results where a denominator is a unit (e.g. 5 / year) are now rendered in a more user-friendly way (e.g. instead of
5 year^-1
it is5 / year
) -
Automatic closing parenthesis/braces insertion when the opening one is typed
-
Automatic closing parenthesis/braces deletion when the opening one is deleted
-
Automatic parenthesis/braces wrapping around selected text if opening one is typed while a text is selected
-
Matching parenthesis are highlighted if the cursor is inside them
-
The note can be saved with
ctrl-s
(Though it is still saved automatically when there is no user interaction) -
It is possible to apply units directly on Line References or Variables, e.g.
var = 12 var km
The result of the second line will be
12 km
-
Parsing improvement: Now the parser are smarter in deciding what is an operator (e.g. 'in' in
12 m in cm
), a unit (12 in
which is 12 inch), or a simple string (I downloaded 12 GB in 3 seconds
). Now it is even possible to evaluate this string12 in in in
, which is equivalent of12 inch in inch
-
Percentage calculations
-
Max row count was increased from 128 to 256
-
e (Euler's Number) was added, currently as a function (
e()
) -
Invalid argument types for functions are highlighted as errors (See image below)
-
new functions:
- abs(num)
- ln(num)
- lg(num)
- log(num, num)
- sin(angle) -> num
- cos(angle) -> num
- tan(angle) -> num
- asin(num) -> angle
- acos(num) -> angle
- atan(num) -> angle
Changed
- When opening a not empty note, the result panel now tries to be as close to the editor as possible to have a better overview about calculations and their results.
- GitHub and website links were added to the NoteCalc page
- Strings at the frontend are now rendered char by char. It is necessary to be able to place the cursor at the right place, since the text rendering does not guarantee that a single char takes exactly 'char-width' pixels.
- Overlay canvas (the canvas above the app canvas) was removed. It was used to draw overlay effects (e.g. pulsing), but it was problematic since it needed alpha blending, which wasn't always nice and console frontend support is limited. Now pulses are rendered above "BelowText" layer and below the "Text" layer.
- underscore is allowed in binary numbers (e.g.
0b11_00
) - Parenthesis have different color than operators.
- Remove
Vec
and dynamic allocation from unit parsing and operations. - Replaced all unit
RefCells
toRc
, it was a mistake to useRefCells
in the first place. - Matrices cannot be deleted anymore by
DEL
orBACKSPACE
, ctrl is needed
Fixed
- Dead characters (e.g. '^' on a hungarian keyboard) were not possible to type
- Longest visible result length was calculated wrongly when there were multiple headers in a note, which affected the result panel size.
sum
variable get emptied at #Headers- Char width at the fonrend is now integer, ceiling upward. It caused issues with rendering (widths of recatngles were float as well and did not always fill up the required space)
- Underlines and line reference background rectangles were rendered even if they were outside of the editor area
ctrl-x
did not copy the selected text- Units in the denominator behaved buggy. now expressions like this works well
tax A = 50 000/month tax B = 50 000/year (tax A + tax B) * (1 year)
- u64 values can be parsed correctly (e.g. 0xFFFFFFFFFFFFFFFF)
- Bitwise operations now work on u64 values
- Negative numbers can be presented in binary and hex form
- Line reference pulsing was called each time a cursor was pressed on the line ref's line, causing flickering
- 'Line normalization' (the process where the referenced lines' id is normalized to the referenced line actual line number) could be undo with ctrl-z
- Bitwise shifting operators (
<<
and>>
) used wrapping, resulted in unwanted situations. Now it is an error to use larger shift operands than the underlying integer representation (u64 currently)
[0.2.0] - 2020-12-03
Breaking Changes
--
does not set the sum
variable to zero, but every header does
Features
- Mobile support for index.html and notecalc itself
- typing using the native virtual keyboard
- scrolling
- High DPI rendering
- Headers (
# Header
) and region-specific alignments (different regions under different headers can have different alignments, making the result output more ergonomic). - Comments are supported (e.g.
12 + 3 // it should be 15
) - Hovering effect for the scrollbar
- Cursor changes to 'w-resize' when above the right gutter to highlight that it is draggable
- Line count limitation was increased from 64 to 128
- Default precision limitation both from the result panel and from the inserted line references was removed. It caused problems since very small numbers could appear as "0" due to roundings. It might be inconvenient in some situations but will be fixed when rounding specifiers will be implemented. Though, NoteCalc tries its best to render a compact form (e.g. removes repetends etc)
Changed
- Tutorial is updated with the new features and now stored in GIT
- Leangains demo is updated
Fixes
- In case a line reference was rendered outside of the editor area, '...' did not appear at the edge of the editor
- Firefox tracking protection issue for webfont.js
- Variable-reference pulsing pulsed continously when the right gutter was dragged
- The result panel is automatically resizing now with respect to browser width, required space for results and required space for the editor panel's content
- The binary and hex representation gives Err for quantities and percentages
- Lines that are too long and are covered by the result panel renders dots ('...') on the panel.
- The dots for matrices are now rendered for all the matrix's rows
- '…' was not rendered correctly for Matrices
- Ctrl-t is not absorbed by the frontend anymore
- Undoing (Ctrl-z) a selection removal with DEL button was buggy and only the first line of the selection was reparsed
- Pulses (which highlights the usage places of variable/lineref under the cursor) appeared too slowly when navigating with cursor or mouse, making it more difficult for the user to notice it immediately.
- Space is automatically inserted in front of a just-inserted line reference
- Right gutter alignment was a render pass late to the input which caused it
- Cursor was not visible at the right edge of the editor
- Global static RESULT_BUFFER is now part of the lib and not of the frontend (introduces some unsafe code but less trouble with the borrow checker)
- Fixed error when variable name is empty
Removed
- local.html was removed, you can access now the debug functionality and local wasm file
via
host/notecalc?debug