Work around race condition when editor content has not loaded yet
Rect, RenderContext, Size, Target, UpdateCtx, Widget, WidgetId, WidgetPod,
};
use lapce_data::{
- buffer::BufferContent,
+ buffer::{BufferContent, LocalBufferKind},
command::{LapceUICommand, LAPCE_UI_COMMAND},
config::LapceTheme,
data::{
@@ -352,6 +352,13 @@ fn event(
let EditorTabChildInfo::Editor(info) =
active.child_info(data, 4);
+ if info.content
+ == BufferContent::Local(LocalBufferKind::Empty)
+ {
+ // File has not yet been loaded, most likely.
+ return;
+ }
+
ctx.submit_command(Command::new(
LAPCE_UI_COMMAND,
LapceUICommand::ActiveFileChanged {
