6 files changed
+47
-3
No files matched your search
+9
-2
@@ -12,7 +12,7 @@
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(clippy::range_plus_one))]
|
||||
|
||||
use anyhow::{bail, Context as _, Error};
|
||||
use config::keyassignment::PaneDirection;
|
||||
use config::keyassignment::{PaneDirection, ScrollbackEraseMode};
|
||||
use mux::client::{ClientId, ClientInfo};
|
||||
use mux::pane::PaneId;
|
||||
use mux::renderable::{RenderableDimensions, StableCursorPosition};
|
||||
@@ -418,7 +418,7 @@ macro_rules! pdu {
|
||||
/// The overall version of the codec.
|
||||
/// This must be bumped when backwards incompatible changes
|
||||
/// are made to the types and protocol.
|
||||
pub const CODEC_VERSION: usize = 38;
|
||||
pub const CODEC_VERSION: usize = 39;
|
||||
|
||||
// Defines the Pdu enum.
|
||||
// Each struct has an explicit identifying number.
|
||||
@@ -475,6 +475,7 @@ pdu! {
|
||||
TabTitleChanged: 56,
|
||||
WindowTitleChanged: 57,
|
||||
RenameWorkspace: 58,
|
||||
EraseScrollbackRequest: 59,
|
||||
}
|
||||
|
||||
impl Pdu {
|
||||
@@ -1046,6 +1047,12 @@ pub struct GetLinesResponse {
|
||||
pub lines: SerializedLines,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, PartialEq, Debug)]
|
||||
pub struct EraseScrollbackRequest {
|
||||
pub pane_id: PaneId,
|
||||
pub erase_mode: ScrollbackEraseMode,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, PartialEq, Debug)]
|
||||
pub struct SearchScrollbackRequest {
|
||||
pub pane_id: PaneId,
|
||||
|
||||
@@ -291,7 +291,7 @@ impl PaneDirection {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, FromDynamic, ToDynamic)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, FromDynamic, ToDynamic, Serialize, Deserialize)]
|
||||
pub enum ScrollbackEraseMode {
|
||||
ScrollbackOnly,
|
||||
ScrollbackAndViewport,
|
||||
|
||||
@@ -80,6 +80,7 @@ As features stabilize some brief notes about them will accumulate here.
|
||||
the remote server, so any tab title changes were lost when reconnecting. #1598
|
||||
* `wezterm connect --workspace WS DOM` didn't use the provided workspace when
|
||||
starting up the mux server. #2734
|
||||
* mux: `ClearScrollback` was not forwarded to remote server. #2624
|
||||
|
||||
### 20230326-111934-3666303c
|
||||
|
||||
|
||||
@@ -1317,4 +1317,5 @@ impl Client {
|
||||
rpc!(set_tab_title, TabTitleChanged, UnitResponse);
|
||||
rpc!(set_window_title, WindowTitleChanged, UnitResponse);
|
||||
rpc!(rename_workspace, RenameWorkspace, UnitResponse);
|
||||
rpc!(erase_scrollback, EraseScrollbackRequest, UnitResponse);
|
||||
}
|
||||
@@ -5,6 +5,7 @@ use anyhow::bail;
|
||||
use async_trait::async_trait;
|
||||
use codec::*;
|
||||
use config::configuration;
|
||||
use config::keyassignment::ScrollbackEraseMode;
|
||||
use mux::domain::DomainId;
|
||||
use mux::pane::{
|
||||
alloc_pane_id, CloseReason, ForEachPaneLogicalLine, LogicalLine, Pane, PaneId, Pattern,
|
||||
@@ -537,6 +538,21 @@ impl Pane for ClientPane {
|
||||
}
|
||||
}
|
||||
|
||||
fn erase_scrollback(&self, erase_mode: ScrollbackEraseMode) {
|
||||
let client = Arc::clone(&self.client);
|
||||
let remote_pane_id = self.remote_pane_id;
|
||||
promise::spawn::spawn(async move {
|
||||
client
|
||||
.client
|
||||
.erase_scrollback(EraseScrollbackRequest {
|
||||
pane_id: remote_pane_id,
|
||||
erase_mode,
|
||||
})
|
||||
.await
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
|
||||
fn advise_focus(&self) {
|
||||
let mut focused_pane = self.client.focused_remote_pane_id.lock().unwrap();
|
||||
if *focused_pane != Some(self.remote_pane_id) {
|
||||
|
||||
@@ -387,6 +387,25 @@ impl SessionHandler {
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
Pdu::EraseScrollbackRequest(EraseScrollbackRequest {
|
||||
pane_id,
|
||||
erase_mode,
|
||||
}) => {
|
||||
spawn_into_main_thread(async move {
|
||||
catch(
|
||||
move || {
|
||||
let mux = Mux::get();
|
||||
let pane = mux
|
||||
.get_pane(pane_id)
|
||||
.ok_or_else(|| anyhow!("no such pane {}", pane_id))?;
|
||||
pane.erase_scrollback(erase_mode);
|
||||
Ok(Pdu::UnitResponse(UnitResponse {}))
|
||||
},
|
||||
send_response,
|
||||
);
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
Pdu::KillPane(KillPane { pane_id }) => {
|
||||
let sender = self.to_write_tx.clone();
|
||||
let per_pane = self.per_pane(pane_id);
|
||||
|
||||
Reference in new issue
Block a user