aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/application.rs21
-rw-r--r--helix-term/src/commands.rs17
2 files changed, 33 insertions, 5 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 21595eae..146194bf 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -55,8 +55,29 @@ pub struct Application {
lsp_progress: LspProgressMap,
}
+#[cfg(feature = "integration")]
+fn setup_integration_logging() {
+ // Separate file config so we can include year, month and day in file logs
+ let _ = fern::Dispatch::new()
+ .format(|out, message, record| {
+ out.finish(format_args!(
+ "{} {} [{}] {}",
+ chrono::Local::now().format("%Y-%m-%dT%H:%M:%S%.3f"),
+ record.target(),
+ record.level(),
+ message
+ ))
+ })
+ .level(log::LevelFilter::Debug)
+ .chain(std::io::stdout())
+ .apply();
+}
+
impl Application {
pub fn new(args: Args, config: Config) -> Result<Self, Error> {
+ #[cfg(feature = "integration")]
+ setup_integration_logging();
+
use helix_view::editor::Action;
let config_dir = helix_loader::config_dir();
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index c9c8e6a9..6b01cbe3 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -2094,10 +2094,17 @@ fn insert_mode(cx: &mut Context) {
let (view, doc) = current!(cx.editor);
enter_insert_mode(doc);
- let selection = doc
- .selection(view.id)
- .clone()
- .transform(|range| Range::new(range.to(), range.from()));
+ log::trace!(
+ "entering insert mode with sel: {:?}, text: {:?}",
+ doc.selection(view.id),
+ doc.text().to_string()
+ );
+
+ let selection = doc.selection(view.id).clone().transform(|range| {
+ let new_range = Range::new(range.to(), range.from());
+ new_range
+ });
+
doc.set_selection(view.id, selection);
}
@@ -2444,8 +2451,8 @@ fn normal_mode(cx: &mut Context) {
graphemes::prev_grapheme_boundary(text, range.to()),
)
});
- doc.set_selection(view.id, selection);
+ doc.set_selection(view.id, selection);
doc.restore_cursor = false;
}
}