lotabout.skim/examples
Jinzhou Zhang 40099ce0cc [lib] add as_any for SkimItem for downcast
1. add `as_any` for `SkimItem`
2. fix preview: deal with multi-lines prepared text
3. API for preview (non-)colored text

Skim will take trait object `Arc<dyn SkimItem>` and will return it back
in `SkimOutput`. Caller will need the concrete type reference to call
some type-specific methods.  The `AsAny` trait is used for downcasting
`Arc<dyn SkimItem>` back to reference to its concrete type.

Q: Why not use associated type?
1. Associated type would pollute all the type signatures that deals with
   `SkimItem`. Some traits could no longer be made into trait object
   with generic type in their method signature.
   ```
    pub trait MatchEngine: Sync + Send {
        fn match_item<T: SkimItem>(&self, item: Arc<ItemWrapper<T>>) -> Option<MatchedItem<T>>;
    }
   ```
   To fix it would require much more work than I think.
2. Currently the support for "interaction mode" and "append-and-select"
   action is done inside skim. That means some items added to skim could
   not guaentee to be the associated type.
2020-02-07 10:34:29 +08:00
..
custom_item.rs [lib] add as_any for SkimItem for downcast 2020-02-07 10:34:29 +08:00
option_builder.rs [lib] add as_any for SkimItem for downcast 2020-02-07 10:34:29 +08:00
sample.rs fix #216 support item specific preview hook method 2020-02-05 15:04:15 +08:00