Compare commits
7
Commits
bb943fb84b
...
aa419fdfc9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa419fdfc9
|
||
|
|
407ce00ab9
|
||
|
|
d427d05b96
|
||
|
|
c2897aa21a
|
||
|
|
f72528c474
|
||
|
|
1317c4ad39
|
||
|
|
fdb8317d24
|
No files matched your search
@@ -170,6 +170,7 @@ tests/scripts/pdf-recovery.sh 真窗口 ElyPDF:加锁文件的封存恢复点
|
||||
tests/scripts/autosave.sh 真窗口 ElyDoc:自动保存开关、停手即写、外部改动不覆盖(需辅助功能权限)
|
||||
tests/scripts/print.sh 真窗口 ElyDoc:打印用文档自己的纸张,取消不动文档(需辅助功能权限)
|
||||
tests/scripts/show-fullscreen.sh 真窗口 ElyShow:F5 放映的窗口盖住整块屏幕(菜单栏与程序坞之上,需辅助功能权限)
|
||||
tests/scripts/dock-macos.sh dist 里 ElyDoc、ElyTable、ElyShow 与包外的 target/debug/ely-doc 各启动数次:LOK worker 从未登记为程序坞应用,图块照出
|
||||
tests/scripts/windows-installer.sh 假应用的安装程序:所选目录原有的文件经两次安装与卸载都在,旧版按注册表清理,文件被占用或程序在运行时什么也不改,写不进时放回旧版(缺 makensis 时 SKIP)
|
||||
tests/scripts/types.sh packaging/types.tsv 的文件类型在 Linux 桌面项、Windows 安装程序与 macOS 文档类型里一致,从不设为默认
|
||||
tests/scripts/layout.sh 真窗口:六个应用在 640、800、1100 宽下无元素越出窗口左右,留截图(需辅助功能与屏幕录制权限)
|
||||
@@ -303,3 +304,5 @@ cargo run -p ely-doc 启动一个应用(ElyDoc 先 cargo build -p ely
|
||||
- 2026-10-15(用户报:ElyMark 代码块后的“你好↵测试”离开输入框后成了“你好 测试”):单个换行照 Typora 的默认(编辑时保留,导出与打印不保留):组件库 93efa7f 起 `MarkdownReader::new`(屏上:可视、预览、右键与命令的读法)把软换行读作换行,`MarkdownReader::joined`(输出)照 GFM 读作空格;标题的大纲与目录文字照旧一行。ElyMark 的 HTML、PDF、富文本复制与纯文本导出用 `joined`(R6.7)。组件库 c31d092 与 26af4be:画出成一个换行的 CRLF 对回其起点(原先按在 CRLF 行末键入落在 CR 与 LF 之间),行内代码照留两字则逐字对回。
|
||||
- 2026-10-15(用户报:ElyMark 源码模式“测”后的插入点画在“测”的中间):组件库 `CodeEditor` 原按“列 × m 的宽”放插入点、选区、按下处与输入法框,中日韩字与表情约宽两格。组件库 9fb607b 起按 gpui 排好的这一行定位(`editor::measure`,含着色带来的字重),块状与下划线插入点取所在字的宽;标尺与缩进参考线仍按列(R6.8)。上下移动仍按字数记目标列。cd61653:按下处取最近的字首或行末(gpui 的 `closest_index_for_x` 越过末字字首即给行末);上次绘制得出的括号与配对位置只属当时的文字(`Buffer` 每次改动换一个戳),输入法改字后、下次绘制前的测量不用它们(原先把新字切进不同字体段,DirectWrite 崩溃)。
|
||||
- 2026-10-15(用户报:ElyMark 三、四级标题不显眼):组件库 5954132 起标题字号随正文按 Typora 的倍数(一至六级 2.25、1.75、1.5、1.25、1、1),一律加粗,六级为次要色,行高为字号的 1.3 倍(原为固定的 24、20、16、14 像素,正文 13,三、四级只是中等字重)(R6.9)。90bd37b:粗体与标题同一字重(原粗体为半粗,标题里的粗体反而更细,正文粗体随之由半粗改为粗,同 Typora);标题行高按自身字号取 1.3 倍。Windows 真窗口核对(`.work/r69`):可视模式各级标题分明、“你好↵测试”两行,源码模式“测”后的插入点落在两字之间。
|
||||
- 2026-10-15(用户报:macOS 打开一个文档,程序坞里有两个同样的图标):LOK worker 在应用包的 `Contents/MacOS` 里启动 AppKit,系统按包的 Info.plist 把它也登记为常规应用(`lsappinfo` 里应用与 worker 都是 Foreground),程序坞多一个图标;内核自己从不设激活策略。worker 在内核启动 AppKit 之前(`Lok::hook` 打开内核之后、调钩子之前)把本进程主包信息里的 `LSUIElement` 设为真,AppKit 登记时即为辅助应用(无程序坞图标、无菜单栏,仍可建屏外窗口);钩子之后核对激活策略是辅助,不是即报错、不启动(`ffi/accessory.rs`);包外的 worker(`cargo run`、单测)无包可登记,策略为禁止,此时改设辅助(R6.12 第 2 轮)。原先在登记之后才改策略,审查实测 15 次启动有 11 次先登记为 Foreground 约 30 毫秒(R6.12 第 1 轮)。`tests/scripts/dock-macos.sh` 连续启动三个应用与包外的开发构建,从 worker 启动起采样其类型到首块图块,见 Foreground 即失败(R6.12)。
|
||||
- 2026-10-15(用户报:ElyShow 编辑区滚轮与上下键不换页,三端):内核在未选中对象时把上下键当作滚动窗口(`fupoor.cxx`),Ely 的画布整页适合、无处可滚,滚轮同样。`LokView::turn_parts`(ElyShow 首次适合时调用)之后:整页可见时滚轮换页(`view/turn.rs`):滚轮的行按本平台每格的行数(`ely_lok::notch`:macOS 1,Windows 取系统设置,X11 与 Wayland 为 3)折成格,整格的行每格一页(快速连滚与一次多格都照格数);一串行里出现不足一格的(X11、Windows 的触控板)即为平滑滚动,此后到停顿前不再换页,像素(macOS、Wayland 的触控板)同按手势:一次手势换一页(满一格或 50 像素),惯性不算;有起止的手势(macOS)只到结束才算完,没有起止的停 200 毫秒即为下一次。X11 的滚轮与触控板同为行、gpui 不分,以整格开头的触控板滑动在出现小数之前会按格换页(已知限制)。未选中对象、未编辑文字时上下键换页。换页一律经有序输入队列交 worker(`TURN`):worker 按之前各输入回报后的状态判定,有选区、选中对象或插入点即把方向键照常交内核,否则当场切页(到首末页即停,同缩略图条的 `setPart`),视图在落地时换上 worker 所示的页,其后排队的键与点按都落在新页上(Tab 后紧接的 Down 移动所选对象;Down、Tab、Down 是换页后在新页上选中并移动);ElyShow 后台读回的当前页只在视图已无待落地输入时采用(R6.13)。
|
||||
@@ -95,7 +95,10 @@ impl Host for Deck {
|
||||
&& !tab.extra.fitted
|
||||
{
|
||||
tab.extra.fitted = true;
|
||||
view.update(cx, |view, cx| view.fit_page(cx));
|
||||
view.update(cx, |view, cx| {
|
||||
view.fit_page(cx);
|
||||
view.turn_parts();
|
||||
});
|
||||
}
|
||||
// Pictures follow the kernel's light or dark scheme.
|
||||
let dark = view.read(cx).dark();
|
||||
@@ -263,7 +266,12 @@ impl Deck {
|
||||
Ok(((slides, at), (design, objects, notes, remarks, (motion, media)), size, history)) => {
|
||||
tab.extra.read_at = Some(at);
|
||||
log::info!("show: tab {id} has {} parts", slides.list.len());
|
||||
view.update(cx, |view, _| view.set_part(slides.current));
|
||||
// A queued turn or part outranks an earlier read.
|
||||
view.update(cx, |view, _| {
|
||||
if view.settled() {
|
||||
view.set_part(slides.current)
|
||||
}
|
||||
});
|
||||
let names: HashSet<&String> =
|
||||
slides.list.iter().map(|slide| &slide.name).collect();
|
||||
tab.extra.keep_pictures(&names);
|
||||
|
||||
@@ -19,6 +19,7 @@ mod play_time;
|
||||
mod review;
|
||||
mod slides;
|
||||
mod strip;
|
||||
mod turn;
|
||||
|
||||
/// An unrendered Deck over a fresh worker, if LOK exists.
|
||||
pub(super) fn deck(cx: &mut TestAppContext, dir: &Path) -> Option<Entity<Deck>> {
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
use ely_lok::LokView;
|
||||
use ely_office::prelude::*;
|
||||
use gpui::{Entity, ScrollDelta, ScrollWheelEvent, TestAppContext, VisualTestContext, point};
|
||||
|
||||
use super::objects::{blank, selection};
|
||||
use super::{counts, quiet, settle, update};
|
||||
use crate::deck::Deck;
|
||||
|
||||
/// The slide canvas alone in a window.
|
||||
struct Host(Entity<LokView>);
|
||||
|
||||
impl gpui::Render for Host {
|
||||
fn render(&mut self, _: &mut gpui::Window, _: &mut gpui::Context<Self>) -> impl gpui::IntoElement {
|
||||
use gpui::{ParentElement as _, Styled as _};
|
||||
gpui::div().size_full().child(self.0.clone())
|
||||
}
|
||||
}
|
||||
|
||||
/// The current slide once every turn landed.
|
||||
fn current(shown: &mut VisualTestContext, deck: &Entity<Deck>) -> usize {
|
||||
quiet(shown, deck);
|
||||
shown.update(|_, app| deck.read(app).active_tab().map(|tab| tab.extra.slides.current).expect("a tab"))
|
||||
}
|
||||
|
||||
/// Whole notches, in this platform's lines.
|
||||
fn wheel(shown: &mut VisualTestContext, notches: f32) {
|
||||
let middle = shown.update(|window, _| window.viewport_size()).center();
|
||||
let delta = ScrollDelta::Lines(point(0.0, notches * ely_lok::notch()));
|
||||
shown.simulate_event(ScrollWheelEvent { position: middle.into(), delta, ..Default::default() });
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_wheel_and_up_down_turn_slides() {
|
||||
let dir = tempfile::tempdir().expect("a temp dir");
|
||||
let mut cx = TestAppContext::single();
|
||||
let Some(deck) = blank(&mut cx, dir.path()) else {
|
||||
return eprintln!("SKIP: no LOK build");
|
||||
};
|
||||
for n in 2..=3 {
|
||||
update(&mut cx, &deck, |deck, cx| deck.object_command("slide.insert", &[], cx));
|
||||
settle(&cx, |app| counts(app, &deck).0 == n);
|
||||
}
|
||||
let view = cx.update(|app| deck.read(app).active_tab().expect("a tab").view.clone());
|
||||
cx.update(|app| view.update(app, |view, _| view.show_part(0)));
|
||||
let window = cx.add_window(|_, _| Host(view.clone()));
|
||||
let mut shown = VisualTestContext::from_window(window.into(), &cx);
|
||||
shown.run_until_parked();
|
||||
assert_eq!(current(&mut shown, &deck), 0);
|
||||
wheel(&mut shown, -2.0);
|
||||
assert_eq!(current(&mut shown, &deck), 2, "two notches in one event turn two");
|
||||
wheel(&mut shown, 1.0);
|
||||
wheel(&mut shown, 1.0);
|
||||
assert_eq!(current(&mut shown, &deck), 0, "rapid notches each turn");
|
||||
wheel(&mut shown, -1.0);
|
||||
assert_eq!(current(&mut shown, &deck), 1, "the wheel turns down");
|
||||
shown.update(|window, app| {
|
||||
let focus = view.read(app).focus_handle().clone();
|
||||
window.focus(&focus, app)
|
||||
});
|
||||
shown.simulate_keystrokes("down");
|
||||
assert_eq!(current(&mut shown, &deck), 2, "Down turns");
|
||||
shown.simulate_keystrokes("down");
|
||||
assert_eq!(current(&mut shown, &deck), 2, "the last slide stays");
|
||||
shown.simulate_keystrokes("up");
|
||||
assert_eq!(current(&mut shown, &deck), 1, "Up turns back");
|
||||
wheel(&mut shown, 1.0);
|
||||
assert_eq!(current(&mut shown, &deck), 0, "the wheel turns up");
|
||||
// Down queued behind Tab moves the object Tab picks.
|
||||
shown.simulate_keystrokes("tab down");
|
||||
assert_eq!(current(&mut shown, &deck), 0, "Down after Tab moves, not turns");
|
||||
assert!(shown.update(|_, app| selection(app, &deck)).is_some(), "Tab picked an object");
|
||||
// A turn lands before the keys queued after it.
|
||||
shown.simulate_keystrokes("escape down tab down");
|
||||
assert_eq!(current(&mut shown, &deck), 1, "Down turns, then moves");
|
||||
assert!(shown.update(|_, app| selection(app, &deck)).is_some(), "Tab picked on the new slide");
|
||||
}
|
||||
@@ -237,6 +237,15 @@ impl Worker {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Turns `step` parts, or posts `key` if something is picked.
|
||||
pub fn turn(&mut self, doc: &Doc, step: i32, key: Option<(u32, i32)>) -> io::Result<Option<usize>> {
|
||||
let (char_code, key_code) = key.unwrap_or_default();
|
||||
let doc_id = self.doc_id(doc)?;
|
||||
let payload = Pack::new().u64(doc_id).i64(step.into()).i64(char_code.into()).i64(key_code.into()).bytes();
|
||||
let shown = Unpack::new(&self.request(tag::TURN, &payload)?).i64()?;
|
||||
Ok(usize::try_from(shown).ok())
|
||||
}
|
||||
|
||||
/// Drags a selected object's handle, start then end.
|
||||
pub fn drag_graphic(&mut self, doc: &Doc, from: (i32, i32), to: (i32, i32)) -> io::Result<()> {
|
||||
for (kind, (x, y)) in [(0, from), (1, to)] {
|
||||
|
||||
@@ -362,11 +362,14 @@ pub fn stop_all(docs: &HashMap<u64, Document>) {
|
||||
|
||||
/// The current generation of `id`.
|
||||
pub fn generation(id: u64) -> u64 {
|
||||
slots()
|
||||
.lock()
|
||||
.expect("the events lock")
|
||||
.get(&id)
|
||||
.map_or(0, |slot| slot.batch.generation)
|
||||
slots().lock().expect("the events lock").get(&id).map_or(0, |slot| slot.batch.generation)
|
||||
}
|
||||
|
||||
/// Whether `id` shows a selection, object or caret.
|
||||
pub fn picked(id: u64) -> bool {
|
||||
let slots = slots().lock().expect("the events lock");
|
||||
let Some(batch) = slots.get(&id).map(|slot| &slot.batch) else { return false };
|
||||
batch.graphic.is_some() || !batch.selection.is_empty() || batch.cursor_visible && batch.cursor.is_some()
|
||||
}
|
||||
|
||||
/// Blocks until documents have unpushed events.
|
||||
@@ -399,12 +402,7 @@ pub fn clear_result(id: u64) {
|
||||
|
||||
/// The completion the last dispatch reported.
|
||||
pub fn take_result(id: u64) -> Option<(String, bool)> {
|
||||
slots()
|
||||
.lock()
|
||||
.expect("the events lock")
|
||||
.get_mut(&id)?
|
||||
.result
|
||||
.take()
|
||||
slots().lock().expect("the events lock").get_mut(&id)?.result.take()
|
||||
}
|
||||
|
||||
/// The bridged a11y text now.
|
||||
|
||||
@@ -60,6 +60,8 @@ macro_rules! call {
|
||||
}};
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
mod accessory;
|
||||
mod document;
|
||||
mod slideshow;
|
||||
pub use document::{Raw, close_window};
|
||||
@@ -80,6 +82,9 @@ impl Lok {
|
||||
let install_c = cstring(&install_str)?;
|
||||
let profile_c = cstring(profile_url)?;
|
||||
let lib = Library::open(install)?;
|
||||
// Before the kit starts, so no Dock icon shows.
|
||||
#[cfg(target_os = "macos")]
|
||||
accessory::hide()?;
|
||||
let hook: Hook2 = unsafe {
|
||||
lib.symbol(b"libreofficekit_hook_2\0")
|
||||
.or_else(|_| lib.symbol(b"libreofficekit_hook\0"))
|
||||
@@ -97,6 +102,8 @@ impl Lok {
|
||||
"lok hook failed for {install_str}"
|
||||
)));
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
accessory::check()?;
|
||||
log::info!("lok: hooked {}", install_str);
|
||||
Ok(Self { kit, _lib: lib })
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
//! The worker stays out of the Dock (macOS).
|
||||
|
||||
use std::ffi::{c_char, c_void};
|
||||
use std::io;
|
||||
|
||||
#[link(name = "Foundation", kind = "framework")]
|
||||
#[link(name = "objc")]
|
||||
unsafe extern "C" {
|
||||
fn objc_getClass(name: *const c_char) -> *mut c_void;
|
||||
fn sel_registerName(name: *const c_char) -> *mut c_void;
|
||||
fn objc_msgSend();
|
||||
}
|
||||
|
||||
/// NSApplicationActivationPolicyAccessory: no Dock icon, no menu bar.
|
||||
const ACCESSORY: isize = 1;
|
||||
/// NSApplicationActivationPolicyProhibited: an unbundled worker starts so.
|
||||
const PROHIBITED: isize = 2;
|
||||
|
||||
type Id = *mut c_void;
|
||||
|
||||
fn send() -> unsafe extern "C" fn() {
|
||||
objc_msgSend as unsafe extern "C" fn()
|
||||
}
|
||||
|
||||
fn class(name: &std::ffi::CStr) -> io::Result<Id> {
|
||||
let class = unsafe { objc_getClass(name.as_ptr()) };
|
||||
if class.is_null() {
|
||||
return Err(io::Error::other(format!("no {} class", name.to_string_lossy())));
|
||||
}
|
||||
Ok(class)
|
||||
}
|
||||
|
||||
fn get(object: Id, selector: &std::ffi::CStr) -> io::Result<Id> {
|
||||
type F = unsafe extern "C" fn(Id, Id) -> Id;
|
||||
let f: F = unsafe { std::mem::transmute(send()) };
|
||||
let result = unsafe { f(object, sel_registerName(selector.as_ptr())) };
|
||||
if result.is_null() {
|
||||
return Err(io::Error::other(format!("{} gave nothing", selector.to_string_lossy())));
|
||||
}
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
/// Marks the process a UI element before registration.
|
||||
pub fn hide() -> io::Result<()> {
|
||||
// The kit reads the bundle's LSUIElement when it registers.
|
||||
let info = get(get(class(c"NSBundle")?, c"mainBundle")?, c"infoDictionary")?;
|
||||
type Text = unsafe extern "C" fn(Id, Id, *const c_char) -> Id;
|
||||
type Flag = unsafe extern "C" fn(Id, Id, i8) -> Id;
|
||||
type Set = unsafe extern "C" fn(Id, Id, Id, Id);
|
||||
let text: Text = unsafe { std::mem::transmute(send()) };
|
||||
let flag: Flag = unsafe { std::mem::transmute(send()) };
|
||||
let set: Set = unsafe { std::mem::transmute(send()) };
|
||||
unsafe {
|
||||
let key = text(class(c"NSString")?, sel_registerName(c"stringWithUTF8String:".as_ptr()), c"LSUIElement".as_ptr());
|
||||
let yes = flag(class(c"NSNumber")?, sel_registerName(c"numberWithBool:".as_ptr()), 1);
|
||||
set(info, sel_registerName(c"setObject:forKey:".as_ptr()), yes, key);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Fails unless the kernel's application came up an accessory.
|
||||
pub fn check() -> io::Result<()> {
|
||||
type Policy = unsafe extern "C" fn(Id, Id) -> isize;
|
||||
type SetPolicy = unsafe extern "C" fn(Id, Id, isize) -> i8;
|
||||
let policy: Policy = unsafe { std::mem::transmute(send()) };
|
||||
let set: SetPolicy = unsafe { std::mem::transmute(send()) };
|
||||
let app = get(class(c"NSApplication")?, c"sharedApplication")?;
|
||||
let read = || unsafe { policy(app, sel_registerName(c"activationPolicy".as_ptr())) };
|
||||
let mut found = read();
|
||||
if found == PROHIBITED {
|
||||
// Outside a bundle nothing registers; accessory lets it draw.
|
||||
let done = unsafe { set(app, sel_registerName(c"setActivationPolicy:".as_ptr()), ACCESSORY) };
|
||||
found = read();
|
||||
log::info!("lok: the unbundled worker asked for accessory ({done})");
|
||||
}
|
||||
if found != ACCESSORY {
|
||||
return Err(io::Error::other(format!("the worker's activation policy is {found}, not accessory")));
|
||||
}
|
||||
log::info!("lok: the worker is an accessory app");
|
||||
Ok(())
|
||||
}
|
||||
@@ -88,6 +88,8 @@ pub mod tag {
|
||||
pub const REVISION: u8 = 34;
|
||||
/// One layer's pixels from the last `SLIDE_LAYERS`.
|
||||
pub const SLIDE_LAYER: u8 = 35;
|
||||
/// Turns parts; an arrow with something picked goes in.
|
||||
pub const TURN: u8 = 36;
|
||||
pub const OK: u8 = 100;
|
||||
pub const ERR: u8 = 101;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ pub use client::{
|
||||
};
|
||||
#[cfg(feature = "view")]
|
||||
pub use view::{
|
||||
CONTEXT, Copy, Cut, Geom, Layout, LokError, LokView, Paste, Reported, ZOOM_STEPS,
|
||||
CONTEXT, Copy, Cut, Geom, Layout, LokError, LokView, Paste, Reported, ZOOM_STEPS, notch,
|
||||
Zoomed, init, layout, paper, read_off, scheme,
|
||||
};
|
||||
#[cfg(feature = "view")]
|
||||
|
||||
@@ -32,7 +32,9 @@ mod scroll;
|
||||
mod sheet;
|
||||
pub use input::{CONTEXT, Copy, Cut, Paste, init};
|
||||
pub use off::read_off;
|
||||
pub use render::scheme;
|
||||
pub use render::{paper, scheme};
|
||||
mod turn;
|
||||
pub use turn::notch;
|
||||
|
||||
pub(crate) use crate::{TILE_TWIPS, TWIPS_PER_PIXEL};
|
||||
|
||||
@@ -125,6 +127,8 @@ pub struct LokView {
|
||||
dark: Option<bool>,
|
||||
/// The zoom follows the viewport so a page fits.
|
||||
fit: bool,
|
||||
/// Set when the wheel and Up, Down turn parts.
|
||||
turning: Option<turn::Turning>,
|
||||
/// The sheet shown, and the offered function chosen.
|
||||
part: usize,
|
||||
picked: usize,
|
||||
@@ -150,17 +154,6 @@ pub type Layout = ((i64, i64), Vec<Rect>);
|
||||
|
||||
use sheet::{Measured, measure};
|
||||
|
||||
/// A page's colour; the kernel's Ely schemes share it.
|
||||
pub fn paper(cx: &gpui::App) -> gpui::Hsla {
|
||||
use ely_gpui_component::theme::ActiveTheme as _;
|
||||
let theme = cx.theme();
|
||||
if theme.is_dark() {
|
||||
theme.colors.surface
|
||||
} else {
|
||||
theme.colors.paper
|
||||
}
|
||||
}
|
||||
|
||||
/// Reads `doc`'s size and page frames.
|
||||
pub fn layout(worker: &mut Worker, doc: &Doc) -> io::Result<Layout> {
|
||||
Ok((doc.size(worker)?, doc.pages(worker)?))
|
||||
@@ -227,6 +220,7 @@ impl LokView {
|
||||
cell: crate::Cell::default(),
|
||||
dark: None,
|
||||
fit: false,
|
||||
turning: None,
|
||||
part: 0,
|
||||
picked: 0,
|
||||
marked: None,
|
||||
|
||||
@@ -64,6 +64,14 @@ pub(super) enum Input {
|
||||
Visible(Rect, (u32, i32)),
|
||||
/// Shows sheet or slide `part`, from 0.
|
||||
Part(usize),
|
||||
/// Turns `step` parts; a picked object takes the arrow `key`.
|
||||
Turn { step: i32, key: Option<(u32, i32)> },
|
||||
}
|
||||
|
||||
/// What an input gives back.
|
||||
pub(super) enum Back {
|
||||
Copied(String),
|
||||
Shown(usize),
|
||||
}
|
||||
|
||||
impl Input {
|
||||
@@ -73,6 +81,7 @@ impl Input {
|
||||
// Arrows, Home, End, Page keys, Escape.
|
||||
Input::Key { key_code, .. } => !matches!(key_code & 0x0FFF, 1024..=1031 | 1281),
|
||||
Input::Mouse(_)
|
||||
| Input::Turn { .. }
|
||||
| Input::Copy { cut: false }
|
||||
| Input::Visible(..)
|
||||
| Input::Part(_)
|
||||
@@ -169,7 +178,7 @@ fn lok_button(button: MouseButton) -> Option<i32> {
|
||||
}
|
||||
|
||||
/// Runs one input; gives a copy's mark and the revision.
|
||||
pub(super) fn run(worker: &Mutex<Worker>, doc: &Doc, input: Input) -> (io::Result<Option<String>>, Option<u64>) {
|
||||
pub(super) fn run(worker: &Mutex<Worker>, doc: &Doc, input: Input) -> (io::Result<Option<Back>>, Option<u64>) {
|
||||
let mut worker = worker.lock().expect("the worker lock");
|
||||
let counts = !matches!(input, Input::Visible(..));
|
||||
let copied = apply(&mut worker, doc, input);
|
||||
@@ -181,12 +190,13 @@ pub(super) fn run(worker: &Mutex<Worker>, doc: &Doc, input: Input) -> (io::Resul
|
||||
(copied, now)
|
||||
}
|
||||
|
||||
fn apply(worker: &mut Worker, doc: &Doc, input: Input) -> io::Result<Option<String>> {
|
||||
fn apply(worker: &mut Worker, doc: &Doc, input: Input) -> io::Result<Option<Back>> {
|
||||
let done = match input {
|
||||
Input::Key {
|
||||
char_code,
|
||||
key_code,
|
||||
} => worker.post_key(doc, char_code, key_code),
|
||||
Input::Turn { step, key } => return Ok(worker.turn(doc, step, key)?.map(Back::Shown)),
|
||||
Input::Mouse(event) => worker.post_mouse(doc, event),
|
||||
Input::Drag { from, to } => worker.drag_graphic(doc, from, to),
|
||||
Input::Visible(area, scale) => doc.visible_area(worker, area, scale),
|
||||
@@ -195,9 +205,8 @@ fn apply(worker: &mut Worker, doc: &Doc, input: Input) -> io::Result<Option<Stri
|
||||
Input::Theme(scheme) => worker.run(doc, "view.theme", &[scheme]),
|
||||
Input::Text { commit, text } => worker.post_text(doc, commit, &text),
|
||||
Input::Copy { cut } => {
|
||||
return clip::copy_out(worker, doc, cut, |clip| {
|
||||
clipboard::write(clip).map_err(io::Error::other)
|
||||
});
|
||||
let copied = clip::copy_out(worker, doc, cut, |clip| clipboard::write(clip).map_err(io::Error::other));
|
||||
return copied.map(|copied| copied.map(Back::Copied));
|
||||
}
|
||||
Input::Run { commands, at } => {
|
||||
let values: Vec<Vec<&str>> =
|
||||
@@ -298,7 +307,10 @@ impl LokView {
|
||||
_: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
if self.walk(&event.keystroke, cx) || self.key_down(&event.keystroke) {
|
||||
if self.walk(&event.keystroke, cx)
|
||||
|| self.turn_key(&event.keystroke)
|
||||
|| self.key_down(&event.keystroke)
|
||||
{
|
||||
cx.stop_propagation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@ use std::{
|
||||
use futures::{StreamExt, channel::mpsc, select_biased};
|
||||
use gpui::Context;
|
||||
|
||||
use super::{Geom, LokError, LokView, Reported, TILE_TWIPS, input::Input};
|
||||
use super::input::{Back, Input};
|
||||
use super::{Geom, LokError, LokView, Reported, TILE_TWIPS};
|
||||
use crate::{Doc, Tile, Worker};
|
||||
|
||||
/// An input slower than this is logged as a warning.
|
||||
@@ -24,7 +25,7 @@ pub(super) struct Job {
|
||||
/// What came back from the lane.
|
||||
enum Landed {
|
||||
/// Sequence, whether it edits, whether it switched part, outcome.
|
||||
Input(u64, bool, bool, (io::Result<Option<String>>, Option<u64>)),
|
||||
Input(u64, bool, bool, (io::Result<Option<Back>>, Option<u64>)),
|
||||
Tile(Job, io::Result<Tile>),
|
||||
}
|
||||
|
||||
@@ -111,7 +112,13 @@ impl LokView {
|
||||
}
|
||||
self.seen_revision(now.unwrap_or(0));
|
||||
match outcome {
|
||||
Ok(Some(copied)) => self.copied = Some(copied),
|
||||
Ok(Some(Back::Copied(copied))) => self.copied = Some(copied),
|
||||
Ok(Some(Back::Shown(part))) if part != self.part => {
|
||||
// The worker turned in order.
|
||||
self.part = part;
|
||||
self.invalidate(cx);
|
||||
}
|
||||
Ok(Some(Back::Shown(_))) => {}
|
||||
Ok(None) => {}
|
||||
Err(error) => {
|
||||
log::error!("lok: input failed ({:?})", error.kind());
|
||||
|
||||
@@ -24,6 +24,16 @@ pub fn scheme(dark: bool) -> &'static str {
|
||||
if dark { DARK } else { LIGHT }
|
||||
}
|
||||
|
||||
/// A page's colour; the kernel's Ely schemes share it.
|
||||
pub fn paper(cx: &gpui::App) -> gpui::Hsla {
|
||||
let theme = cx.theme();
|
||||
if theme.is_dark() {
|
||||
theme.colors.surface
|
||||
} else {
|
||||
theme.colors.paper
|
||||
}
|
||||
}
|
||||
|
||||
impl LokView {
|
||||
/// Paints with the app's light or dark scheme.
|
||||
pub(super) fn follow_theme(&mut self, dark: bool) {
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
//! The wheel and Up, Down turn slides (SHOW-01).
|
||||
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use gpui::{Keystroke, Modifiers, ScrollDelta, ScrollWheelEvent, TouchPhase};
|
||||
|
||||
use super::LokView;
|
||||
use super::input::{Input, vcl_key};
|
||||
|
||||
/// Trackpad pixels one turn takes.
|
||||
const SWIPE: f32 = 50.0;
|
||||
/// A pause this long ends a gesture without phases.
|
||||
const PAUSE: Duration = Duration::from_millis(200);
|
||||
|
||||
/// Lines one wheel notch scrolls on this platform.
|
||||
pub fn notch() -> f32 {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use windows_sys::Win32::UI::WindowsAndMessaging::{SPI_GETWHEELSCROLLLINES, SystemParametersInfoW};
|
||||
let mut lines = 3u32;
|
||||
// Same setting gpui scales the wheel by.
|
||||
unsafe { SystemParametersInfoW(SPI_GETWHEELSCROLLLINES, 0, (&raw mut lines).cast(), 0) };
|
||||
lines as f32
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
1.0
|
||||
}
|
||||
// gpui's X11 and Wayland scroll three lines a notch.
|
||||
#[cfg(not(any(windows, target_os = "macos")))]
|
||||
{
|
||||
3.0
|
||||
}
|
||||
}
|
||||
|
||||
/// The wheel's progress towards a turn.
|
||||
#[derive(Default)]
|
||||
pub(super) struct Turning {
|
||||
/// This gesture's travel, in turns.
|
||||
travel: f32,
|
||||
/// This gesture already turned.
|
||||
spent: bool,
|
||||
/// The platform began a gesture it has not ended.
|
||||
held: bool,
|
||||
/// Fractional lines in this run: a touchpad, not a wheel.
|
||||
smooth: bool,
|
||||
last: Option<Instant>,
|
||||
}
|
||||
|
||||
impl Turning {
|
||||
/// The turn a wheel event makes; 0 for none.
|
||||
pub(super) fn wheel(&mut self, delta: ScrollDelta, phase: TouchPhase, now: Instant, notch: f32) -> i32 {
|
||||
let paused = self.last.is_none_or(|last| now.duration_since(last) >= PAUSE);
|
||||
self.last = Some(now);
|
||||
// X11 lines mix wheels and touchpads; they carry no phase.
|
||||
let (travel, phase) = match delta {
|
||||
ScrollDelta::Lines(_) if notch <= 0.0 => return 0,
|
||||
ScrollDelta::Lines(lines) => (lines.y / notch, None),
|
||||
ScrollDelta::Pixels(pixels) => (f32::from(pixels.y) / SWIPE, Some(phase)),
|
||||
};
|
||||
// Phases bound a gesture; without them, a pause does.
|
||||
if phase == Some(TouchPhase::Started) || paused && !self.held {
|
||||
(self.travel, self.spent, self.smooth) = (0.0, false, false);
|
||||
}
|
||||
let whole = travel.round();
|
||||
if phase.is_none() && (whole == 0.0 || (travel - whole).abs() >= 1e-3) {
|
||||
self.smooth = true;
|
||||
}
|
||||
// Whole wheel notches each turn, until fractions show a touchpad.
|
||||
if phase.is_none() && !self.smooth {
|
||||
(self.travel, self.spent, self.held) = (0.0, true, false);
|
||||
return -(whole as i32);
|
||||
}
|
||||
self.held = match phase {
|
||||
Some(TouchPhase::Started) => true,
|
||||
Some(TouchPhase::Moved) => self.held,
|
||||
Some(TouchPhase::Ended | TouchPhase::Cancelled) | None => false,
|
||||
};
|
||||
// One gesture turns once, momentum included.
|
||||
if self.spent {
|
||||
return 0;
|
||||
}
|
||||
self.travel += travel;
|
||||
if self.travel.abs() < 1.0 - 1e-3 {
|
||||
return 0;
|
||||
}
|
||||
self.spent = true;
|
||||
// Content moving down shows the part before.
|
||||
-(self.travel.signum() as i32)
|
||||
}
|
||||
}
|
||||
|
||||
impl LokView {
|
||||
/// The wheel and Up, Down turn parts from now on.
|
||||
pub fn turn_parts(&mut self) {
|
||||
self.turning.get_or_insert_default();
|
||||
}
|
||||
|
||||
/// Queues Up, Down; the worker turns if nothing is picked.
|
||||
pub(super) fn turn_key(&mut self, keystroke: &Keystroke) -> bool {
|
||||
if self.turning.is_none() || keystroke.modifiers != Modifiers::none() {
|
||||
return false;
|
||||
}
|
||||
let step = match keystroke.key.as_str() {
|
||||
"down" => 1,
|
||||
"up" => -1,
|
||||
_ => return false,
|
||||
};
|
||||
let Some(key) = vcl_key(keystroke) else {
|
||||
return false;
|
||||
};
|
||||
self.send(Input::Turn { step, key: Some(key) });
|
||||
true
|
||||
}
|
||||
|
||||
/// The wheel turns while the whole page shows.
|
||||
pub(super) fn turn_wheel(&mut self, event: &ScrollWheelEvent) -> bool {
|
||||
let (width, height) = self.extent();
|
||||
// A pixel of slack for rounding.
|
||||
let whole = self.geom.px_of(width) <= self.viewport.0 + 1.0
|
||||
&& self.geom.px_of(height) <= self.viewport.1 + 1.0;
|
||||
let Some(turning) = self.turning.as_mut().filter(|_| whole) else {
|
||||
return false;
|
||||
};
|
||||
let step = turning.wheel(event.delta, event.touch_phase, Instant::now(), notch());
|
||||
if step != 0 {
|
||||
// In order with the input around it.
|
||||
self.send(Input::Turn { step, key: None });
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use gpui::{ScrollDelta, TouchPhase, point, px};
|
||||
|
||||
use super::{PAUSE, Turning};
|
||||
|
||||
const NOTCH: f32 = 3.0;
|
||||
|
||||
fn lines(y: f32) -> ScrollDelta {
|
||||
ScrollDelta::Lines(point(0.0, y))
|
||||
}
|
||||
|
||||
fn pixels(y: f32) -> ScrollDelta {
|
||||
ScrollDelta::Pixels(point(px(0.0), px(y)))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn each_notch_with_a_pause_turns_once() {
|
||||
let (mut turning, now) = (Turning::default(), std::time::Instant::now());
|
||||
let mut wheel = |y, at| turning.wheel(lines(y), TouchPhase::Moved, at, NOTCH);
|
||||
assert_eq!(wheel(-3.0, now), 1, "Windows and Linux scroll three lines a notch");
|
||||
assert_eq!(wheel(-3.0, now + PAUSE), 1);
|
||||
assert_eq!(wheel(3.0, now + PAUSE * 2), -1);
|
||||
assert_eq!(wheel(-6.0, now + PAUSE * 3), 2, "two notches in one event");
|
||||
assert_eq!(wheel(-3.0, now + PAUSE * 3), 1, "rapid notches each turn");
|
||||
assert_eq!(wheel(-3.0, now + PAUSE * 3), 1);
|
||||
assert_eq!(wheel(-1.0, now + PAUSE * 4), 0, "a third of a notch");
|
||||
let mut mac = Turning::default();
|
||||
assert_eq!(mac.wheel(lines(-1.0), TouchPhase::Moved, now, 1.0), 1, "macOS scrolls a line a notch");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_stream_of_lines_turns_once() {
|
||||
let (mut turning, now) = (Turning::default(), std::time::Instant::now());
|
||||
// A whole step, then fractions: no more turns once smooth.
|
||||
let stream = [-3.0, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -3.0];
|
||||
let turned: i32 = stream.iter().map(|&y| turning.wheel(lines(y), TouchPhase::Moved, now, NOTCH)).sum();
|
||||
assert_eq!(turned, 1, "one swipe turns once");
|
||||
let mut turning = Turning::default();
|
||||
let turned: i32 = (0..30).map(|_| turning.wheel(lines(-0.4), TouchPhase::Moved, now, NOTCH)).sum();
|
||||
assert_eq!(turned, 1, "fractions add up once");
|
||||
assert_eq!(turning.wheel(lines(-3.0), TouchPhase::Moved, now + PAUSE, NOTCH), 1, "a pause ends it");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_swipe_turns_once_until_the_next() {
|
||||
let (mut turning, now) = (Turning::default(), std::time::Instant::now());
|
||||
let mut swipe = |y, phase, at| turning.wheel(pixels(y), phase, at, NOTCH);
|
||||
assert_eq!(swipe(-30.0, TouchPhase::Started, now), 0);
|
||||
assert_eq!(swipe(-30.0, TouchPhase::Moved, now), 1);
|
||||
// A pause with fingers down is the same gesture.
|
||||
assert_eq!(swipe(-60.0, TouchPhase::Moved, now + PAUSE * 2), 0);
|
||||
assert_eq!(swipe(0.0, TouchPhase::Ended, now + PAUSE * 2), 0);
|
||||
// Momentum after the turn turns nothing more.
|
||||
for _ in 0..20 {
|
||||
assert_eq!(swipe(-80.0, TouchPhase::Moved, now + PAUSE * 2), 0);
|
||||
}
|
||||
assert_eq!(swipe(60.0, TouchPhase::Started, now + PAUSE * 2), -1);
|
||||
assert_eq!(swipe(0.0, TouchPhase::Ended, now + PAUSE * 2), 0);
|
||||
// Without phases a pause ends a gesture (Wayland).
|
||||
let later = now + PAUSE * 4;
|
||||
assert_eq!(swipe(60.0, TouchPhase::Moved, later), -1);
|
||||
assert_eq!(swipe(60.0, TouchPhase::Moved, later), 0);
|
||||
assert_eq!(swipe(60.0, TouchPhase::Moved, later + PAUSE), -1);
|
||||
}
|
||||
}
|
||||
@@ -65,9 +65,9 @@ impl LokView {
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
/// Ctrl (macOS: Cmd) and the wheel zoom; else scroll.
|
||||
/// Ctrl (macOS: Cmd) wheel zooms; else it turns or scrolls.
|
||||
pub(super) fn on_wheel(&mut self, event: &ScrollWheelEvent, window: &mut Window, cx: &mut Context<Self>) {
|
||||
if !self.wheel_zoom(event, cx) {
|
||||
if !self.wheel_zoom(event, cx) && !self.turn_wheel(event) {
|
||||
self.on_scroll(event, window, cx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,6 +218,7 @@ fn answer(lok: &Lok, tag: u8, id: u64, payload: &[u8]) {
|
||||
}
|
||||
}),
|
||||
tag::POST_KEY => input::key(unpack),
|
||||
tag::TURN => input::turn(unpack),
|
||||
tag::POST_MOUSE => input::mouse(unpack),
|
||||
tag::GRAPHIC => input::graphic(unpack),
|
||||
tag::POST_TEXT => input::text(unpack),
|
||||
|
||||
@@ -99,6 +99,28 @@ pub(super) fn key(unpack: &mut Unpack) -> io::Result<Vec<u8>> {
|
||||
Ok(Vec::new())
|
||||
}
|
||||
|
||||
/// Turns `step` parts in order, or posts the arrow (-1).
|
||||
pub(super) fn turn(unpack: &mut Unpack) -> io::Result<Vec<u8>> {
|
||||
let (id, step, char_code, key_code) = (unpack.u64()?, unpack.i64()?, unpack.i64()?, unpack.i64()?);
|
||||
// Earlier input's callbacks already landed here.
|
||||
if key_code != 0 && crate::events::picked(id) {
|
||||
with_doc(id, |doc| {
|
||||
doc.post_key(0, char_code as i32, key_code as i32);
|
||||
doc.post_key(1, char_code as i32, key_code as i32);
|
||||
})?;
|
||||
return Ok(Pack::new().i64(-1).bytes());
|
||||
}
|
||||
let shown = with_doc(id, |doc| {
|
||||
let (part, last) = (i64::from(doc.part()), i64::from(doc.parts()) - 1);
|
||||
let next = (part + step).clamp(0, last.max(0));
|
||||
if next != part {
|
||||
doc.set_part(next as i32);
|
||||
}
|
||||
next
|
||||
})?;
|
||||
Ok(Pack::new().i64(shown).bytes())
|
||||
}
|
||||
|
||||
/// One mouse event: kind, x, y, count, buttons, modifiers.
|
||||
pub(super) fn mouse(unpack: &mut Unpack) -> io::Result<Vec<u8>> {
|
||||
let id = unpack.u64()?;
|
||||
|
||||
@@ -51,7 +51,7 @@ pub fn expect(unpack: &mut Unpack) -> io::Result<Vec<u8>> {
|
||||
pub fn bump(request: u8, payload: &[u8]) {
|
||||
let changes = matches!(
|
||||
request,
|
||||
tag::POST_KEY | tag::POST_MOUSE | tag::GRAPHIC | tag::POST_TEXT | tag::POST_UNO | tag::PASTE | tag::CUT | tag::COMPLETE_FUNCTION
|
||||
tag::POST_KEY | tag::TURN | tag::POST_MOUSE | tag::GRAPHIC | tag::POST_TEXT | tag::POST_UNO | tag::PASTE | tag::CUT | tag::COMPLETE_FUNCTION
|
||||
);
|
||||
let mut unpack = Unpack::new(payload);
|
||||
let Ok(id) = unpack.u64() else {
|
||||
|
||||
@@ -270,3 +270,6 @@
|
||||
- [x] R6.9 ElyMark 三、四级标题不显眼(用户报):各级字号随正文按 Typora 的倍数(2.25、1.75、1.5、1.25、1、1),一律加粗,六级为次要色(组件库渲染)
|
||||
- [x] R6.11 Windows 升级后旧文件仍在(R6.10 本机重装查出):安装程序只覆盖不删除,旧版 ElyMark 的 `git` 与 CEF 文件留在安装目录;安装程序记下所装的文件,升级与卸载只移去这些;文件被占用即什么也不改,失败时放回旧版。第 3 轮后(最后一轮,修完不再审查):备份按清单次序编号,近 260 字的路径照样升级与卸载;卸载先查清单本身,删不掉即放回全部
|
||||
- [x] R6.10 重发 0.1.5(用户定:仍为 0.1.5):删去 v0.1.5 的全部文件,标签移到修复的提交,三端全部包重建并上传,本机重装(标签在 53630ce;推标签即起发布流程,其 Windows 与 Linux 任务建出并上传,与本机同时起的 Windows 构建撞上,本机那份未上传;macOS 任务未上传,dmg 由 Mac mini 本机建、公证、钉票;44 个文件,同名的源码包只留 Linux 的一份,见 P3-16;下载回的 ElyMark 安装程序与清单的散列与构建相同;本机六个应用 0.1.5 经新安装程序升级,ElyMark 目录无 `git`,冒烟启动均正常退出、日志无警告)
|
||||
- [x] R6.12 macOS 打开一个文档,程序坞里 ElyDoc、ElyTable、ElyShow 各出现两个图标(用户 2026-10-15 报):LOK worker 在应用包内启动 AppKit,系统按包的 Info.plist 把它也登记为常规应用(`lsappinfo` 两个 Foreground);worker 在内核启动 AppKit 前把本进程主包信息的 `LSUIElement` 设为真,登记即为辅助应用,钩子后核对策略(第 1 轮:原先登记后才改,15 次有 11 次先为 Foreground);`tests/scripts/dock-macos.sh` 在 Mac mini 上 30 次启动全为 UIElement,旧 worker 即失败;第 2 轮:包外的 worker(`cargo run`、单测)策略为禁止,原核对即退出,改设辅助,测试另启包外的开发构建(40 次全过);第 3 轮通过
|
||||
- [x] R6.13 ElyShow 编辑区的滚轮与上下键不换页(用户报,三端;放映时正常):内核在未选中对象时把上下键当作滚动窗口,Ely 的画布整页适合、无处可滚;整页可见时滚轮换页(每格一页,触控板一次手势一页),未选中对象、未编辑文字时上下键换页,同缩略图条的路径,到首末页即停;第 1 轮:Windows 一格三行原换三页,X11 触控板的小数行一次滑动换多页,按住手指停顿后再滑又换一页,Tab 后紧接的 Down 按旧状态换页;改为按平台每格行数计格、小数行与像素按手势计、有起止的手势只到结束才算完、上下键由 worker 按输入次序判定;第 2 轮:换页在 worker 回复后才排进队列,排在其后的键先作用于旧页,以整格开头的 X11 平滑滚动仍按格多次换页;改为换页(键与滚轮)都由 worker 在输入次序中当场切页;第 3 轮:一律按手势计使快速连滚与一次多格只换一页,`LokView::part` 已无调用者;改为整格的行每格一页、出现小数即按手势,删去 `part`(第 3 轮为最后一轮,修后不再审查)
|
||||
- [ ] R6.14 重发 0.1.5(用户定:仍为 0.1.5,全部重建并重传):删去 v0.1.5 的全部文件,标签移到 R6.12、R6.13 的提交,三端全部包重建并上传,本机重装
|
||||
@@ -0,0 +1,3 @@
|
||||
FAIL
|
||||
|
||||
- crates/ely-lok/src/ffi/accessory.rs:38 — The worker still registers briefly as a foreground application: `sharedApplication` initializes AppKit under the parent bundle's regular identity before line 42 sets the accessory policy. On macOS 27.0.1 arm64, I built this revision and launched the worker under the shipped Doc/Table/Show bundle identities five times each. Eleven of fifteen launches reported `Foreground` before `UIElement`; one ElyTable launch reported those states at 0.1602 s and 0.1892 s respectively. All launches still loaded documents and painted tiles (`.work/R6.12-r1/dock-repeat.log`). This leaves a startup window for the second Dock entry and disproves the claim that the worker registers as UIElement from the outset; bundled apps default to the Dock-visible regular policy ([Apple documentation](https://developer.apple.com/documentation/appkit/nsapplication/activationpolicy-swift.enum/regular)). Establish the worker's agent identity before AppKit first registers it, preserving the main application's regular identity, and add a bundled-startup regression test that rejects any `Foreground` observation while checking document loading and rendering.
|
||||
@@ -0,0 +1,5 @@
|
||||
FAIL
|
||||
|
||||
- crates/ely-lok/src/ffi/accessory.rs:65 — Unbundled macOS workers now fail during startup. Setting the main bundle dictionary's `LSUIElement` leaves their activation policy at 2, which this check rejects. On macOS 27.0.1 arm64, the independently built round 2 worker exited 1 before answering its first IPC request with `the worker's activation policy is 2, not accessory`; the independently built round 1 worker, using the same engine and fresh profiles, loaded and rendered Writer, Calc and Impress documents and shut down successfully (`.work/R6.12-r2/unbundled-r2-worker.log`, `unbundled-r1.log`). This breaks the standalone worker layout used by `cargo run` and the macOS worker tests. Establish an appropriate policy for unbundled workers while retaining the pre-registration bundle fix, and cover both launch layouts in the regression test.
|
||||
|
||||
- crates/ely-lok/src/ffi/accessory.rs:41 — The new documentation comment contains eleven words, exceeding the explicit ten-word limit. Running `python tests/scripts/comments.py` exits 1 and identifies this line (`.work/R6.12-r2/comments.log`). Shorten it to ten words or fewer, or remove it.
|
||||
@@ -0,0 +1 @@
|
||||
PASS
|
||||
@@ -0,0 +1,9 @@
|
||||
FAIL
|
||||
|
||||
- crates/ely-lok/src/view/turn.rs:41 — Logical scroll lines are counted as physical wheel notches. Windows multiplies each notch by the system scroll-line setting (`vendor/gpui-pre-windows/src/events.rs:589`); with three lines configured, one downward notch produces `Lines(0, -3)`. Replaying that event through ElyShow and the rebuilt LOK worker moved from slide 1 to slide 4, rather than slide 2 (`.work/R6.13-r1/probe-explicit.log`). The pinned Linux X11 backend also uses three lines per notch. Normalize platform wheel units before counting slide changes, and cover realistic platform deltas; the existing tests only exercise unit notches.
|
||||
|
||||
- crates/ely-lok/src/view/turn.rs:37 — The line-delta branch never applies the one-turn-per-gesture limit, but the pinned GPUI X11 backend also represents smooth touchpad scrolling as `ScrollDelta::Lines` (`gpui-pre-linux-0.3.8`, `x11/client.rs`, `get_scroll_delta_and_update_state` and `make_scroll_wheel_event`). Replaying ten consecutive `-0.4` line deltas in one UI update through ElyShow/LOK moved from slide 1 to slide 5 instead of slide 2 (`.work/R6.13-r1/probe-extra.log`). Preserve the distinction between discrete wheel steps and smooth XInput gestures in the input adapter, and apply gesture limiting to the latter; clamping each event individually would still turn repeatedly during one swipe.
|
||||
|
||||
- crates/ely-lok/src/view/turn.rs:48 — A 250 ms pause resets `spent` even when the platform reports continuation of the same gesture. With a fitted deck, a `Started` event of -60 pixels turns one slide; keeping fingers down, pausing 300 ms, then sending a `Moved` event of -60 pixels turns another. This reproduced through ElyShow/LOK with slide index 2 instead of 1 (`.work/R6.13-r1/probe-explicit.log`). Track explicit gesture lifetime when phases are available; elapsed time must not reopen an explicitly ongoing gesture. Reserve timeout inference for streams without gesture boundaries and test continuation after a pause.
|
||||
|
||||
- crates/ely-lok/src/view/turn.rs:80 — The arrow-key decision uses the last selection callback without accounting for earlier queued input. On a title slide, press Tab to select its placeholder and Down before the worker's selection callback arrives: Down emits `Turn`, so the queued Tab selects the object and the following part change leaves the slide instead of moving that object. The integration probe changed slide index 0 to 1; its control case, waiting for Tab's selection before Down, stayed on slide 0 (`.work/R6.13-r1/probe-extra.log`). Resolve the arrow's action against the selection/editing state after preceding inputs and their callbacks have landed, while preserving input order, and add this queued-input regression.
|
||||
@@ -0,0 +1,5 @@
|
||||
FAIL
|
||||
|
||||
- crates/ely-lok/src/view/lane.rs:116 — An arrow's actual page change is queued only after its worker reply returns to the UI, behind subsequent inputs already in the lane. On slide 1, queue Down–Tab–Down before the worker catches up: Tab selects slide 1's title and the second Down moves it, then the deferred turn shows slide 2. The rebuilt-worker integration probe changed the departing title's y coordinate from 628 to 728 (1/100 mm); Down–Tab also loses the intended selection on slide 2, while the settled control passes (`.work/R6.13-r2/probe-final.log`). Complete the page change in input order before processing following keys or mouse events, and cover navigation immediately followed by selection/editing.
|
||||
|
||||
- crates/ely-lok/src/view/turn.rs:67 — Round 1's smooth-scroll defect remains when a gesture begins with whole increments: these events are classified as discrete wheel notches until a fractional delta appears. The pinned X11 adapter emits `Lines` for smooth motion and permits whole increments. Replaying `-3, -3`, then eight `-0.4` line deltas without a pause produces three turns instead of one (`.work/R6.13-r2/scroll-probe.log`); the equivalent stream normalized to this Windows machine's seven-line setting moves ElyShow from slide 1 to slide 4 (`.work/R6.13-r2/probe-final.log`). Preserve the smooth-versus-discrete distinction in the input adapter instead of inferring it from fractional values, and test gestures beginning with whole increments.
|
||||
@@ -0,0 +1,5 @@
|
||||
FAIL
|
||||
|
||||
- crates/ely-lok/src/view/turn.rs:69 — Treating every line delta as one gesture breaks R6.13's one-page-per-wheel-notch requirement. In the rebuilt-worker integration probes, three physical notches delivered without a 200 ms pause advance from slide 1 to slide 2 instead of slide 4; one event containing two notches reaches slide 2 instead of slide 3 (`.work/R6.13-r3/probe-tests.log`). The new unit test even expects two notches to turn once. Preserve the adapter's discrete-wheel versus smooth-scroll distinction, count every discrete notch, and retain the one-turn limit for touchpad gestures; cover both rapid notches and multi-notch events.
|
||||
|
||||
- crates/ely-lok/src/view/turn.rs:89 — `LokView::part()` is now dead code: this round deletes its sole caller, `Deck::turn`, and no production or checked-in test caller remains under `apps/` or `crates/` (`.work/R6.13-r3/part-callers.log`). The worker-driven navigation path no longer uses this accessor, violating agents.md rule 6. Remove the unused accessor.
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
# dock-macos.sh: the LOK worker never registers as a Dock app.
|
||||
set -euo pipefail
|
||||
[ "$(uname)" = Darwin ] || { echo "SKIP: macOS only"; exit 0; }
|
||||
runs=${ELY_DOCK_RUNS:-5}
|
||||
apps=("$@")
|
||||
# Bundled apps from dist and one unbundled dev build.
|
||||
[ ${#apps[@]} -gt 0 ] || apps=(dist/ElyDoc.app dist/ElyTable.app dist/ElyShow.app target/debug/ely-doc)
|
||||
|
||||
# One launch: samples the worker's type until a tile shows.
|
||||
launch() {
|
||||
local bin=$1 log=$2 start pid worker="" types="" asn i=0
|
||||
start=$(( $( [ -f "$log" ] && wc -l < "$log" || echo 0 ) + 1 ))
|
||||
ELY_NO_DIALOG=1 ELY_SMOKE=hold ELY_LOG=debug "$bin" >/dev/null 2>&1 &
|
||||
pid=$!
|
||||
local end=$((SECONDS + 60)) shown=0
|
||||
while [ $SECONDS -lt $end ] && kill -0 "$pid" 2>/dev/null; do
|
||||
[ -n "$worker" ] || worker=$(pgrep -P "$pid" -x ely-lok-worker || true)
|
||||
if [ -n "$worker" ]; then
|
||||
asn=$(lsappinfo find "pid=$worker" || true)
|
||||
[ -z "$asn" ] || types+=" $(lsappinfo info -only applicationtype "$asn" | grep -o 'type="[A-Za-z]*"' || true)"
|
||||
fi
|
||||
i=$((i + 1))
|
||||
if [ $((i % 20)) -eq 0 ] && tail -n +"$start" "$log" 2>/dev/null | grep -q 'lok: tile ('; then shown=1; break; fi
|
||||
done
|
||||
kill "$pid" 2>/dev/null || true
|
||||
wait "$pid" 2>/dev/null || true
|
||||
local seen
|
||||
seen=$(tr ' ' '\n' <<<"$types" | grep . | sort | uniq -c | tr -s ' \n' ' ')
|
||||
echo "$(basename "$bin"): worker $worker:$seen"
|
||||
[ "$shown" = 1 ] || { echo "FAIL: no tile shown"; return 1; }
|
||||
[ -n "$worker" ] || { echo "FAIL: no worker started"; return 1; }
|
||||
case $types in *Foreground*) echo "FAIL: the worker was a Dock app"; return 1 ;; esac
|
||||
case $types in *UIElement*) ;; *) echo "FAIL: the worker's type was never seen"; return 1 ;; esac
|
||||
tail -n +"$start" "$log" | grep -q 'lok: the worker is an accessory app' || { echo "FAIL: no accessory log"; return 1; }
|
||||
}
|
||||
|
||||
for app in "${apps[@]}"; do
|
||||
if [ -f "$app" ]; then
|
||||
bin=$app
|
||||
[ -x "$(dirname "$app")/ely-lok-worker" ] || { echo "FAIL: no worker beside $app (cargo build -p ely-lok --bins)"; exit 1; }
|
||||
else
|
||||
[ -d "$app" ] || { echo "FAIL: $app is missing"; exit 1; }
|
||||
bin=$(find "$app/Contents/MacOS" -maxdepth 1 -type f -name 'ely-*' ! -name 'ely-lok-worker' | head -1)
|
||||
[ -n "$bin" ] || { echo "FAIL: $app has no app binary"; exit 1; }
|
||||
fi
|
||||
log="$HOME/Library/Application Support/ElyOffice/$(basename "$bin")/ely.log"
|
||||
for _ in $(seq 1 "$runs"); do launch "$bin" "$log"; done
|
||||
done
|
||||
echo "PASS: no LOK worker registered as a Dock app"
|
||||
Reference in new issue
Block a user