Repository navigation
Conversation
c72b296 to
40d914e
Compare
316c861 to
3bd03b6
Compare
04987c2 to
f897f3a
Compare
|
Pins iced/cosmic-text to @luca020400’s underline Style work |
f897f3a to
7d351eb
Compare
|
brought inline with #2388 work. |
englut
left a comment
There was a problem hiding this comment.
Works pretty well from my tests! @rtmongold could you add the following patch?
You can apply via: patch assets/flatpak/org.squidowl.halloy.json < halloy-flatpak-hunspell.patch
This addresses hunspell build errors for flatpak.
We'll likely need squidowl/iced#4 to be rebased and merged as well. @luca020400 when you have time, could you rebase and fix the conflicts in that PR? Can give it a proper review once that's done 🙏
After that iced PR is merged, will need to update this Cargo.toml to point to the new commit hash for our iced repo.
|
@englut I applied the SDK extension. The LLVM 22 README also lists these two build paths, so I added them: |
My test worked without, but probably good to follow the readme! Good call 🫡 |
|
https://github.com/squidowl/cosmic-text/tree/emoji now has the text decors fix, update the sha to af189a4cb4056f23215f90a35e93b9e1ce5d26de when you can squidowl/iced#4 has been rebased, once merged (that'll likely happen when this pr is close to getting merged as well) mind updating the sha as well? ty :) |
f4b0819 to
3ad936d
Compare
|
fyi I just updated cosmic text as a whole, the current tree already contains the fix so you can drop the sha change |
|
I just tried building on my asahi linux machine. It's an aarch64 chip rather than x86_64. I am seeing build errors relating to spellkit: Checking ipc v0.1.0 (/home/quaff/develop/squidowl/halloy/ipc)
error[E0308]: mismatched types
--> /home/quaff/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spellkit-0.4.0/src/unix.rs:189:51
|
189 | unsafe { Hunspell_spell(hunspell, cstr.as_bytes_with_nul().as_ptr() as *const i8) }
| -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const u8`, found `*const i8`
| |
| arguments to this function are incorrect
|
= note: expected raw pointer `*const u8`
found raw pointer `*const i8`
note: function defined here
--> /home/quaff/develop/squidowl/halloy/target/debug/build/hunspell-sys-2aafe668120392ac/out/bindings.rs:36:12
|
36 | pub fn Hunspell_spell(
| ^^^^^^^^^^^^^^
error[E0308]: arguments to this function are incorrect
--> /home/quaff/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spellkit-0.4.0/src/unix.rs:158:21
|
158 | let n = Hunspell_suggest(
| ^^^^^^^^^^^^^^^^
|
note: expected `*mut *mut *mut u8`, found `&mut *mut *mut i8`
--> /home/quaff/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spellkit-0.4.0/src/unix.rs:160:17
|
160 | &mut list,
| ^^^^^^^^^
= note: expected raw pointer `*mut *mut *mut u8`
found mutable reference `&mut *mut *mut i8`
note: expected `*const u8`, found `*const i8`
--> /home/quaff/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spellkit-0.4.0/src/unix.rs:161:17
|
161 | cstr.as_bytes_with_nul().as_ptr() as *const i8,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: expected raw pointer `*const u8`
found raw pointer `*const i8`
note: function defined here
--> /home/quaff/develop/squidowl/halloy/target/debug/build/hunspell-sys-2aafe668120392ac/out/bindings.rs:48:12
|
48 | pub fn Hunspell_suggest(
| ^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> /home/quaff/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spellkit-0.4.0/src/unix.rs:174:47
|
174 | if let Ok(s) = CStr::from_ptr(p).to_str() {
| -------------- ^ expected `*const u8`, found `*mut i8`
| |
| arguments to this function are incorrect
|
= note: expected raw pointer `*const u8`
found raw pointer `*mut i8`
note: associated function defined here
--> /home/quaff/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ffi/c_str.rs:254:25
|
254 | pub const unsafe fn from_ptr<'a>(ptr: *const c_char) -> &'a CStr {
| ^^^^^^^^
error[E0308]: mismatched types
--> /home/quaff/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spellkit-0.4.0/src/unix.rs:178:47
|
178 | Hunspell_free_list(self.hunspell, &mut list, n);
| ------------------ ^^^^^^^^^ expected `*mut *mut *mut u8`, found `&mut *mut *mut i8`
| |
| arguments to this function are incorrect
|
= note: expected raw pointer `*mut *mut *mut u8`
found mutable reference `&mut *mut *mut i8`
note: function defined here
--> /home/quaff/develop/squidowl/halloy/target/debug/build/hunspell-sys-2aafe668120392ac/out/bindings.rs:128:12
|
128 | pub fn Hunspell_free_list(
| ^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> /home/quaff/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spellkit-0.4.0/src/unix.rs:211:17
|
209 | Hunspell_add(
| ------------ arguments to this function are incorrect
210 | self.hunspell,
211 | cstr.as_bytes_with_nul().as_ptr() as *const i8,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const u8`, found `*const i8`
|
= note: expected raw pointer `*const u8`
found raw pointer `*const i8`
note: function defined here
--> /home/quaff/develop/squidowl/halloy/target/debug/build/hunspell-sys-2aafe668120392ac/out/bindings.rs:101:12
|
101 | pub fn Hunspell_add(
| ^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0308`.
error: could not compile `spellkit` (lib) due to 5 previous errors
warning: build failed, waiting for other jobs to finish...If I remove all the |
|
@englut Thanks for the report and for checking both arches. Happy to take a PR if you have the time; once it’s in I’ll cut a new spellkit release and update this PR to pull it in. |
7629298 to
02c85ac
Compare
|
@luca020400 thanks for the updated I have made the change. |
|
Cleaned up my approach a little and submitted a PR 🙏 |
| libhunspell-dev | ||
| libclang-dev |
There was a problem hiding this comment.
We should add libhunspell-dev (and what appears to be the equivalent hunspell-devel) to the packages comment in scripts/install-linux.sh. And potentially libclang-dev, but that was not necessary on my system for some reason? (It's not already installed, but looks like maybe it's getting pulled in by libc6? Probably better too many packages than too few.)
|
Good news, the iced PR has been merged 🙌 @rtmongold can you please update the Building successfully with:
spell check works on x86_64, |
|
Have been testing a bit, and I think it works really nicely and is a very solid first implementation. A couple minor things that might make sense for the first implementation:
|
|
@englut Yeah I saw that merged that is great, I was working on it and got tired should have it updated soon, as well as the new spellkit version. On aarch64, is there anything in the Logs pane / halloy log files that mentions spellcheck? |
My bad. I was testing with the wrong branch last night 😅. Can confirm that the recent version of spellkit and the updated iced sha works on aarch64 linux 🫡 |
02c85ac to
3591420
Compare
Opt-in platform spellchecking via spellkit (buffer.text_input.spellcheck): highlighting, optional locale, Tab suggestion cycling after autocomplete, and skips for channel names / known nicks. Misspellings use text.spellcheck_misspelled (default text.error + italic) with a solid underline (underline = true by default; optional underline_color). Pins iced to squidowl/iced @ 6317712 (underline Style / squidowl#4) and cosmic-text to af189a4 (decoration fix) until those land on main's pins.
3591420 to
def497a
Compare
|
@andymandias Added buffer.text_input.spellcheck.ignore for exempt words (case-insensitive). Default misspell styling is now normal text with an error-colored underline (underline = true by default). |
Opt-in spellcheck for the message input (
buffer.text_input.spellcheck).Adds a dependency on
spellkit(0.4), a small cross-platform crate (rtmongold/spellkit) that I updated from an orphaned repo (euclio/spellbound).NSSpellCheckerISpellCheckerhunspell-en_us)If no dictionary is available, spellcheck is a no-op (a warning is logged). Optional
locale(e.g."en-US") selects the language; unset uses the system/default.How it works
While typing a word
The word under/just before the caret is not marked misspelled. You are not flagged mid-word.
After the word is finished
Once you leave the word (space, punctuation, or move the caret off it), misspellings are highlighted with
text.spellcheck_misspelled(fallback:text.errorin italic). Withunderline = true(default), a solid underline is drawn; color from optional themeunderline_color, otherwise the misspelled text color.Tab / Shift+Tab
Nick and command autocomplete still run first. If Tab would complete a nick, command, etc., that wins. Spell suggestions only run when autocomplete does not produce a candidate: with
suggestions = true, put the caret in a finished misspelled word and Tab / Shift+Tab cycles native dictionary replacements, then back to the original spelling.Skipped as misspellings
Channel names (
#…), your nick, nicks in the current channel, and the query peer.Disabled by default:
Pins iced/cosmic-text to @luca020400’s underline Style work (squidowl/iced#4, 6317712) until that lands on main’s iced pin.