Commit Graph

10 Commits

Author SHA1 Message Date
ridiculousfish
dee692759a
Split Reader off from ReaderData
Prior to this commit, there was a stack of ReaderDatas, each one has a
reference to a Parser (same Parser in each, for now). However, the current
ReaderData is globally accessible. Because it holds a Parser, effectively
anything can run fish script; this also prevents us from making the Parser
&mut.

Split these up. Create ReaderData, which holds the data portion of the
reader machinery, and then create Reader which holds a ReaderData and a
Parser. Now `reader_current_data()` can only return the data itself; it
cannot execute fish script.

This results in some other nice simplifications.
2024-06-23 16:39:39 -07:00
Fabian Boehm
20830744a9 Apply some clippy lints
Nothing too surprising, mostly removing useless references and lambdas
2024-05-26 10:37:37 +02:00
Mahmoud Al-Qudsi
2c2f7cb4d1 Use our own thread id
ThreadId is way slower than it should be for the sense that we use it in; it
doesn't cache the id and allocates an Arc internally.

We don't care about the thread id used in crate::threads correlating with any
other thread id the code uses anywhere (not that it does) because it's only used
for our own bookkeeping. Change to something much simpler instead.
2024-05-24 13:34:18 -05:00
Mahmoud Al-Qudsi
cf4ab20055 Use OnceLock in crate::threads
Verified that std::sync::OnceLock<T> compiles to the same assembly at the
*access* site as the Option<T> we were using. The additional overhead upon init
is fine. No need for extra Box<T> indirection for IO_THREAD_POOL.
2024-05-24 12:46:47 -05:00
Mahmoud Al-Qudsi
43d6289c26 Make assert_is_main_thread() simpler to optimize
The compiler cannot guarantee that a `static AtomicBool` is always the same
initial value, but it can do so for a `const bool`.
2024-05-24 09:57:42 -05:00
The0x539
4c3e814a50 Address clippy lints 2024-03-09 13:49:25 +01:00
Mahmoud Al-Qudsi
2ecbc56de9 Change MainThread<T> abstraction
Don't force the internal use of `RefCell<T>`, let the caller place that into
`MainThread<>` manually. This lets us remove the reference to `MainThread<>`
from the definition of `Screen` again and reduces the number of
`assert_is_main_thread()` calls.
2024-03-01 19:42:43 -06:00
Mahmoud Al-Qudsi
f67ce2ac4b Add Sync/Send wrapper for main-thread-only data 2024-02-28 13:06:04 -06:00
Fabian Boehm
fc794bab4c Switch to the terminfo crate
This allows us to get the terminfo information without linking against curses.

That means we can get by without a bunch of awkward C-API trickery.

There is no global "cur_term" kept by a library for us that we need to invalidate.

Note that it still requires a "unhashed terminfo database", and I don't know how well it handles termcap.

I am not actually sure if there are systems that *can't* have terminfo, everything I looked at
has the ncurses terminfo available to install at least.
2024-02-22 20:10:16 +01:00
Johannes Altmanninger
3ae20bdba0 Move fish-rust to project root 2024-01-13 03:58:33 +01:00