Commit Graph
12 Commits
Author SHA1 Message Date
Mats Jun Larsen 03546bc4ef Conditionally render img tags for language logos (#7873) 2025-06-28 16:33:07 +02:00
Mats Jun Larsen 5eea63328f Migrate to Biome for linting and formatting (#7033) 2025-02-02 17:54:31 +00:00
Ofek c1985d64a1 Tsification binge #7 (#6974) 2024-10-25 12:19:04 +03:00
Ofek 4cdef67bba fix Alert (#6771)
All `Alert` modal windows reuse the same yesButton/noButton.
The callback are setup in the Alert ctor -
```
        const yesNoModal = $('#yes-no');
        yesNoModal.find('button.yes').on('click', () => {
            this.yesHandler?.();
        });
        yesNoModal.find('button.no').on('click', () => {
            this.noHandler?.();
        });
    }
```
On every yes/no click, *All* callbacks of *All* alert instances are
called.
So each `Alert` instance needs to cleanup its callbacks after usage, and
it tries to - via the weirdly named `toggleEventListener`.
`toggleEventListener` only did

```
element.off(eventName);
```
Some of the renaming problems were caused by persistance of [this
callback](https://github.com/compiler-explorer/compiler-explorer/blob/00648a7e1c38c9172c5226d1f64511b8bebfe1c9/static/widgets/pane-renaming.ts#L68-L72).
Extending the cleanup to -
```
        element.off(eventName);
        this.yesHandler = null;
        this.noHandler = null;
```
seems to solve it this particular problem - not even sure `element.off`
is even needed.
2024-08-17 22:50:46 +03:00
narpfelandPatrick Quist 077f9c99cf Decode UTF-8 encoded strings in numeric tooltip (#6234)
Compilers like to encode short-ish strings into immediate arguments to
various assembly instructions. This makes it hard to read the assembly.

To improve readability, show a string representation of a number’s bytes
when they’re valid UTF-8.

This now also shows a string representation for *unprintable* ASCII
characters, such as `10` being shown as `"\n"` or `1` as `"\u0001"`.

Resolves #6220.

## Examples

([link](https://godbolt.org/z/7hzn6b8YG))

* 8583909746840200552: `8'583'909'746'840'200'552 =
0x7720'2C6F'6C6C'6568 = 6.5188685003648344e+265 = "hello, w"`
* 1684828783: `1'684'828'783 = 0x646C'726F = 1.74467096e+22f = "orld"`
* -6934491452449512253: `-6'934'491'452'449'512'253 =
0x9FC3'BCC3'B6C3'A4C3 = -1.1500622354593239e-155 = "äöüß"`
* 1633837924: `1'633'837'924 = 0x6162'6364 = 2.61007876e+20f = "dcba"`
* 97: `97 = 0x61 = 1.35925951e-43f = "a"`
* 10: `10 = 0xA = 1.40129846e-44f = "\n"`
* 92: `92 = 0x5C = 1.28919459e-43f = "\\"`

## Open questions

* The code assumes little-endian encoding, so the string representation
is reversed compared to the numeric representation (see `integer`
example). Should this be configurable or should the bytes not be
reversed?
* Negative numbers are masked to 64-bit unsigned ints (same as in the
hex representation), so if the number is shorter than 8 bytes, it has
some leading `ff` bytes and is not valid UTF-8 (see
`small_negative_number` in the example link). Is this an acceptable
limitation?
* I'd like to add some tests for `getNumericToolTip`, but I’m not really
familiar with TypeScript. I tried to importing
`static/panes/compiler.ts` in a test file, but
([after](https://github.com/vitest-dev/vitest/discussions/1806#discussioncomment-3570047)
some [struggling](https://vitest.dev/config/#environment)) it seems that
that file needs a [specific DOM
element](https://github.com/compiler-explorer/compiler-explorer/blob/3c26c64ca320853cb383b3751d3e08a86b581639/static/options.ts#L27)
that is not present during testing. The simplest solution I could come
up with is moving `getNumericToolTip` into another file (such as
`static/utils.ts`). Is that okay or is is it possible test
`static/panes/compiler.ts` some other way?

---------

Co-authored-by: Patrick Quist <partouf@gmail.com>
2024-03-17 12:43:43 +02:00
Cassio Neri 6a65100568 fix month (#5599) 2023-10-14 17:56:36 +02:00
Patrick Quist 9b983d6965 Load and show creation_date of shortlink (#5236) 2023-07-17 23:36:36 +02:00
Rubén Rincón BlancoandMatt Godbolt 2dbca646f0 Address some low-hanging fruits from webstorm code inspection (#3582)
* Address some low-hanging fruits from webstorm code inspection
* Change editor code to silence eslint

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2022-04-29 14:24:29 -05:00
Rubén Rincón Blanco db229b94bc Add strict tsc flag for the frontend ts code (#3356) 2022-02-12 02:41:01 +01:00
partouf f778e769cb lintfixes 2022-02-11 15:38:06 +01:00
Luca Natilla 810cb5ad6f Ability to name panes (#3323) 2022-02-11 15:25:02 +01:00
Rubén Rincón Blanco 6a1dbe14f7 Some general UI touches (#2910)
* Touches and changes to the UI to make it more consistent

It fixes some problems, improves the UX of certain actions,
 and clears some code up

* More minor tweaks to the UI

* Fix class typo

* Add compiler picker opt group header background color in default theme

* Fix conformance view

* Removes some &nbsp; in favour of margins

Removes boostrap-slider, there's a built-in html solution
Fixes tab width setting having a wrong input type

* More UI tweaks

* Remove empty CSS rule
2021-09-03 05:51:05 +02:00