Commit graph

13236 commits

Author SHA1 Message Date
Daniel Bertalan
6003b6f4d3 LibTextCodec: Do not allocate the various decoders
These objects contain no data members, so there is no point in creating
1-byte heap allocations for them. We don't need to have them as static
local variables, as they are trivially constructible, so they can simply
be global variables.
2022-01-28 23:31:00 +01:00
Daniel Bertalan
7d11edbe17 Userland: Fix unnecessary heap allocation of singleton objects
In order to avoid having multiple instances, we were keeping a pointer
to these singleton objects and only allocating them when it was null.

We have `__cxa_guard_{acquire,release}` in the userland, so there's no
need to do this dance, as the compiler will ensure that the constructors
are only called once.
2022-01-28 23:31:00 +01:00
Ali Mohammad Pur
c1184c1fde RequestServer: Replace disconnected sockets in the grace period too
We previously only replaced disconnected sockets on the queued-request
path, leading to attempts to send requests on a disconnected socket if
the disconnection happened in the deletion grace period.
2022-01-28 23:29:32 +01:00
Timothy Flynn
b387ac56b6 LibCore: Change DateTime format strings to be StringViews
There's no need to allocate a String for these. Note the "string"
parameter of DateTime::parse is left as a String for now; the parser is
currently using strtol which needs a NUL-terminated string. This method
can likely be rewritten with GenericLexer.
2022-01-28 20:19:05 +00:00
Timothy Flynn
9c80430eea LibCore: Remove time zone from default format string
The default format string is used in many applications/services like
FileManager/FileSystemAccessServer. Showing the time zone in e.g. the
last modified time for every file in FileManager is feeling a bit over
the top, so let's revert this change and assume the user is smart enough
to know what time zone they are in.
2022-01-28 20:19:05 +00:00
Timothy Flynn
5ca1c54c27 date: Use an explicit time format string for default option
This is to prepare for removing the time zone from DateTime's default
format string. The date utility on most system show time zone by default
so let's keep that.
2022-01-28 20:19:05 +00:00
Ali Mohammad Pur
58ed00f633 run-tests: Dump a backtrace for crashed tests
It only makes sense to see what a crashed test was up to, so generate a
backtrace if we can find the coredump and read it.
2022-01-28 20:18:46 +00:00
Ali Mohammad Pur
1c121d7488 js: Use generic reference instead of Variant<A,B>
As the two types are used in exactly the same way, just make the lambda
generic over the type instead of explicitly moving them into a variant
and then visiting with a generic lambda.
2022-01-28 20:18:46 +00:00
Timothy Flynn
74939eb943 LibJS: Implement Intl.PluralRules.prototype.resolvedOptions 2022-01-28 19:38:47 +00:00
Timothy Flynn
8b3f49ff84 LibJS: Implement Intl.PluralRules.supportedLocalesOf 2022-01-28 19:38:47 +00:00
Timothy Flynn
624fad3821 js: Implement pretty-printing of Intl.PluralRules 2022-01-28 19:38:47 +00:00
Timothy Flynn
348059bffd LibJS: Implement the Intl.PluralRules constructor 2022-01-28 19:38:47 +00:00
Timothy Flynn
0087804d10 LibJS: Implement a nearly empty Intl.PluralRules object
This adds plumbing for the Intl.PluralRules object, constructor, and
prototype.
2022-01-28 19:38:47 +00:00
Timothy Flynn
ac3e42a8de LibJS: Move some Intl.NumberFormat fields into a NumberFormatBase class
Other Intl objects, such as PluralRules, are to be treated as a
NumberFormat object in some AOs. There's only a handful of fields which
are to be shared between those objects - move them to a base class for
shared reuse.

This also updates the couple of NumberFormat AOs that are meant to
operate on these NumberFormat-like objects.

Alternatively, we could just have objects like PluralRules inherit from
NumberFormat directly. But that messes up the is<NumberFormat> runtime
checks, so this feels safer.
2022-01-28 19:38:47 +00:00
Idan Horowitz
fa7ae7288b zip: Ignore symlinks when recursively zipping files
This prevents infinite loops when symlinks point to a parent directory.
2022-01-28 19:05:52 +02:00
Timothy Flynn
bd5662d6f2 CharacterMap: Move display name strings into the search results object
Now that we're passing the display name directly to the search results
structure, let's move() the string instead of copying it.
2022-01-28 15:26:58 +00:00
Timothy Flynn
54d89401df CharacterMap: Change the search widget to display results in a TableView
Code points that have a bidirectional attribute of right-to-left (e.g.
some Arabic and Hebrew code points) were causing the code point to
render at the end of the search result, rather than the beginning. To
keep the results consistent, split the search results into two columns:
the first for the code point, the second for its name.
2022-01-28 15:26:58 +00:00
Timothy Flynn
acfcad0b06 Revert "FileSystemAccessServer: Display times in the local time zone"
This reverts commit fa016a72fd.
2022-01-28 15:13:35 +00:00
Timothy Flynn
55d28a738e Revert "FileManager: Display times in the user's local time zone"
This reverts commit 080b054695.
2022-01-28 15:13:35 +00:00
Timothy Flynn
0a1e717e40 Revert "ls: Display times in the user's local time zone"
This reverts commit 0c13a3a8ff.
2022-01-28 15:13:35 +00:00
Timothy Flynn
8599ee3049 Revert "Userland: Invoke tzset in apps that care about time zones"
This reverts most of commit ede5c9548e.
The one change not reverted is ClockWidget.h, so that the taskbar clock
can continue to notice time zone changes.
2022-01-28 15:13:35 +00:00
Timothy Flynn
6838333f76 LibMain: Invoke tzset in LibMain so all apps can have time zone info
Rather than finding apps that benefit from time zone awareness one-by-
one, and calling tzset in their serenity_main, let's do it in LibMain.
2022-01-28 15:13:35 +00:00
Lenny Maiorani
899f062673 LibSoftGPU: Simplify clipping logic
The clipping logic is not DRY (Don't Repeat Yourself). The same logic
is repeated in multiple parts of an `if-else` statement. This can be
simplified to contain fewer branches and eliminate the redundant code.
2022-01-28 17:02:04 +02:00
Timothy Flynn
fa016a72fd FileSystemAccessServer: Display times in the user's local time zone 2022-01-28 12:25:20 +00:00
Timothy Flynn
080b054695 FileManager: Display times in the user's local time zone 2022-01-28 12:25:20 +00:00
Timothy Flynn
0c13a3a8ff ls: Display times in the user's local time zone
ls is already using local time, but needs tzset() for that to actually
work.
2022-01-28 12:25:20 +00:00
Timothy Flynn
da2eb63652 BrowserSettings: Use standard text placement for check box text 2022-01-28 13:20:19 +01:00
Timothy Flynn
0a3b1f6bc8 MailSettings: Use standard text placement for check box text 2022-01-28 13:20:19 +01:00
Timothy Flynn
cfd1755910 MouseSettings: Use standard text placement for check box text 2022-01-28 13:20:19 +01:00
Itamar
106e414800 HackStudio: Fix path to language-server IPC socket
The path to the language server local socket was accidentally broken
in 2e1bbcb.
2022-01-28 13:17:54 +01:00
Andreas Kling
3c3c2334fa LibGUI: Alphabetize the available entries in CommandPalette 2022-01-27 23:26:06 +01:00
Andreas Kling
30d4f4b010 LibGUI: Show action icons in CommandPalette when available :^) 2022-01-27 23:26:06 +01:00
Andreas Kling
3e7e52c5f0 LibGUI: Add a universally available "command palette" to GUI programs
You can now press Ctrl+Shift+A in any LibGUI application and we'll give
you a command palette dialog where you can search for context-relevant
actions by name (via the keyboard.)

The set of actions is currently the same one you'd access via keyboard
shortcuts. In the future, we'll probably want to add APIs to allow
richer integrations with this feature.
2022-01-27 23:26:06 +01:00
Andreas Kling
e0b60d56a5 LibGUI: Make FilteringProxyModel::data() support multi-column data
While the rows are filtered, we can't just return data from column 0
every time, since that breaks underlying multi-column models.
Instead, simply forward the incoming index.
2022-01-27 23:26:06 +01:00
Andreas Kling
af532b22c8 LibGUI: Fix bogus return value on error in FilteringProxyModel::data()
Return an empty GUI::Variant on indexing error.
2022-01-27 23:26:06 +01:00
Andreas Kling
e12d2f9a04 LibGUI: Fix bogus root index column_count() in FilteringProxyModel
The root index (ModelIndex()) should should have the same column count
as the root index in the underlying model.
2022-01-27 23:26:06 +01:00
Mathieu PATUREL
9ec826144f LibGUI: Don't skip non-skipable spans on ctrl+right
Just a couple of typos in
`TextDocument::first_non_skippable_span_after`.
2022-01-27 23:01:19 +01:00
Timothy Flynn
a2e791277e LibJS: Implement Intl.RelativeTimeFormat.prototype.formatToParts 2022-01-27 21:16:44 +00:00
Timothy Flynn
9c5d7e515c LibJS: Implement Intl.RelativeTimeFormat.prototype.format 2022-01-27 21:16:44 +00:00
Timothy Flynn
8098eb273a LibJS: Add explicit constructors for PatternPartition
This is to enable emplacing this struct in containers. GCC is fine with
emplacing without this constructor, but Clang raises an error.
2022-01-27 21:16:44 +00:00
Timothy Flynn
236fd0a2cb LibJS: Change RelativeTimeFormat::number_format to return a reference
In the one place this will be used, we will know that the NumberFormat
object is non-null. So return a reference, as the AO it is passed off to
also expects a reference.
2022-01-27 21:16:44 +00:00
Timothy Flynn
90e68bca6a LibJS: Add missing spec link for InitializeRelativeTimeFormat 2022-01-27 21:16:44 +00:00
Timothy Flynn
f8892fdea2 LibUnicode: Templatize our naive implementation of plurality selection
As we didn't (and still don't) have Intl.PluralRules when we implemented
Intl.NumberFormat, we use a locale-unaware basic implementation to pick
a pattern based on a number's value. Templatize this method for now to
work other other format-like structures (will be used for relative-time
formatting).
2022-01-27 21:16:44 +00:00
Timothy Flynn
789f093b2e LibUnicode: Parse and generate relative-time format patterns
Relative-time format patterns are of one of two forms:

    * Tensed - refer to the past or the future, e.g. "N years ago" or
      "in N years".
    * Numbered - refer to a specific numeric value, e.g. "in 1 year"
      becomes "next year" and "in 0 years" becomes "this year".

In ECMA-402, tensed and numbered refer to the numeric formatting options
of "always" and "auto", respectively.
2022-01-27 21:16:44 +00:00
Lenny Maiorani
25272cabef LibSoftGPU: Reduce Clipper class interface to minimum
Much of the `Clipper` class can be made free functions and their scope
limited.

The purpose of this is to prepare the interface for a change to more
compile-time dispatch.
2022-01-27 20:42:28 +00:00
Lenny Maiorani
d1a87f1219 LibSoftGPU: Use default construction to clear AlphaBlendFactors
Clearing the `m_alpha_blend_factors` is performed manually and in
separate steps. This is error prone for future developers. The
behavior is to reset the entire `struct` to the same state as default
initialization, so this simplifies it to do just that.
2022-01-27 20:39:02 +00:00
Lenny Maiorani
229188b815 LibGL: Set rasterizer material state without copying
Each of the material faces is copied member by member then the copied
material state is passed by `const&` to another function, then
destroyed.

This is changed to simply passing the material state directly without
copying.
2022-01-27 20:35:38 +00:00
Lenny Maiorani
354017e01d LibGL: Set rasterizer light state without copying
There is a loop over the lights in which each light state is copied
member by member then the copied light state is passed by `const&` to
another function, then destroyed.

This is changed to simply passing the light state directly without
copying.
2022-01-27 20:33:46 +00:00
Timothy Flynn
cf92bc42a2 LibJS: Respect per-locale minimum grouping digits when number formatting 2022-01-27 20:30:52 +00:00
Timothy Flynn
2d2f713426 LibUnicode: Generate per-locale minimum grouping digit values
Previously, we were breaking up digits into groups without regard for
the locale's minimumGroupingDigits value in the CLDR. This value is 1 in
most locales, but is 2 in locales such as pl-PL. What this means is that
in those locales, the group separator should only be inserted if the
thousands group has at least 2 digits. So 1000 is formatted as "1,000"
in en-US, but "1000" in pl-PL. And 10000 is "10,000" in en-US and
"10 000" in pl-PL.
2022-01-27 20:30:52 +00:00