Adding Setting to control palette preview editor's width#895
Adding Setting to control palette preview editor's width#895dzhou121 merged 9 commits intolapce:masterfrom
Conversation
… preview editor's width. Adding a default value to the preview editor's width.
… check if the preview_editor_width is greater that the input bar width.
|
You need to fix the rustfmt of the files. (I'd also suggest making it a single commit) That method does work, though I think it would be better to split the palette's width from the preview editor's width. Being able to set the width of the preview separate from the width of the palette would be nice (as typically the palette entries are small). |
|
@MinusGix Okok, I see. That solution is cool and I think that I can still jump back to such approach. However, the UI looked like if it was broken in some cases; that's the only reason why I took another approach (any suggestions in regards to this will be helpful) 🤕. |
|
To just do the preview-width editing, you can revert the size changing for the content rect and input box, and also the set origins. |
|
@MinusGix I reverted to the original implementation. I also sneaked in a little logic from the second implementation, in order to center the editor. I was able to come up with this (the |
…w editor width from the pallete width.
ctx.set_paint_insets(4000.0);
let self_size = Size::new(width, input_size.height + content_height + preview_height);
self.content_rect = Size::new(width, self_size.height)
.to_rect()
.with_origin(Point::new(0.0, 0.0));I did see the bug where the line-numbers disappear, when I didn't have the
|
|
@MinusGix Ok, cool. I'll try the second option first (since that seems to be easier and the quicker to apply). If that doesn't work, I'll proceed to ask more details about the first one 👍 |
…order allow overpainting, so the preview editor can be centered. The default value of the preview_editor_width was updated to 600px.
|
@MinusGix I think its done! I added the line you suggested while keeping the negative x coordinate, in order to center the editor (worked pretty well). I try the changes using different widths ( |
|
Nice work. Thanks! Could you also 'collapse' the PR into a single commit? |
|
@MinusGix Thanks for all the guidance! No problem, I'll make the change! |
|
@MinusGix Can you give me a hand with the squash part? (tried a rebase locally but didn't seem to work) 😭 |
|
It's fine :) |
|
@MinusGix Hey! Hope you're doing great! |
It depends on @dzhou121 |


Closes #872
preview_editor_widthan its respective getter function were added to theUIConfigstruct onlapce-data/config.rs.preview_editor_widthwas added todefaults/settings.toml.input_widthwas added to thelayoutmethod onpallete.rs, it's value will be the difference between theinput_size.widthandwidth, if the value ofdata.config.ui.preview_editor_widthis greater than the value contained onwidth, or zero. Such variable is used as helper to center theinputbar appropriately based on thepreview_editor_width.layoutfunction is now computed usingf64::maxin order to keep consistency on the UI.